Skip to content

Commit 6260035

Browse files
kiennqvspinu
authored andcommitted
ci: fix lints and obsolete methods
1 parent 37a9f04 commit 6260035

File tree

7 files changed

+34
-31
lines changed

7 files changed

+34
-31
lines changed

polymode-compat.el

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ are passed to ORIG-FUN."
260260
(setq end (or end (point-max)))
261261
(let ((cmode major-mode)
262262
(end-eol (save-excursion (goto-char end)
263-
(point-at-eol)))
263+
(line-end-position)))
264264
line-acc acc)
265265
(pm-map-over-modes
266266
(lambda (sbeg send)
@@ -273,15 +273,15 @@ are passed to ORIG-FUN."
273273
;; first line of mode; use line-acc
274274
(setq acc (append line-acc acc))
275275
(setq line-acc nil))
276-
;; if cur-mode follows after end on same line, accumulate the
277-
;; last line but not the actual text
276+
;; if cur-mode follows after end on same line,
277+
;; accumulate the last line but not the actual text
278278
(when (< beg1 end)
279279
(push (buffer-substring-no-properties beg1 end1) acc)))
280280
(goto-char beg1)
281-
(if (<= end1 (point-at-eol))
281+
(if (<= end1 (line-end-position))
282282
(when (< beg1 end1) ; don't accumulate on last line
283283
(push (make-string (- end1 beg1) ? ) line-acc))
284-
(while (< (point-at-eol) end1)
284+
(while (< (line-end-position) end1)
285285
(push "\n" acc)
286286
(forward-line 1))
287287
(setq line-acc (list (make-string (- end1 (point)) ? )))))))
@@ -434,7 +434,8 @@ changes."
434434
;; save the buffers with un-hidden name.
435435

436436
(defun polymode-fix-desktop-buffer-info (fn buffer)
437-
"Unhide poly-mode base buffer which is hidden by removing the leading spaces from the name."
437+
"Unhide poly-mode base buffer which is hidden by removing
438+
the leading spaces from the name."
438439
(with-current-buffer buffer
439440
(let ((out (funcall fn buffer)))
440441
(when (and polymode-mode

polymode-core.el

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Currently, we only use it to track renames of the buffer.")
110110

111111

112112
(defun pm--buffer-name (&optional hidden)
113-
(let ((name (if-let ((bbuf (buffer-base-buffer)))
113+
(let ((name (if-let* ((bbuf (buffer-base-buffer)))
114114
(let ((postfix (replace-regexp-in-string "poly-\\|-mode" "" (symbol-name major-mode)))
115115
(base-name (buffer-local-value 'pm--base-buffer-name bbuf)))
116116
(format "%s[%s]" (replace-regexp-in-string "^ " "" base-name)
@@ -874,7 +874,7 @@ forward spans from pos."
874874
(cons (point-max) (point-max)))))
875875
(when can-overlap
876876
(goto-char (cdr head))
877-
(when-let ((hbeg (car (funcall head-matcher 1))))
877+
(when-let* ((hbeg (car (funcall head-matcher 1))))
878878
(when (< hbeg (car tail))
879879
(setq tail (cons hbeg hbeg)))))
880880
(list (car head) (cdr head) (car tail) (cdr tail))))))))
@@ -926,7 +926,7 @@ TYPE is either a symbol or a list of symbols of span types."
926926
(unless pm-initialization-in-progress
927927
(when global-hook
928928
(run-hooks global-hook))
929-
(pm--run-hooks object :init-functions (or type 'host))))
929+
(pm--run-hooks object 'init-functions (or type 'host))))
930930

931931
(defun pm--collect-parent-slots (object slot &optional do-when inclusive)
932932
"Descend into parents of OBJECT and return a list of SLOT values.
@@ -940,7 +940,7 @@ of the first object for which DO-WHEN failed."
940940
(failed nil))
941941
(while inst
942942
(if (not (slot-boundp inst slot))
943-
(setq inst (and (slot-boundp inst :parent-instance)
943+
(setq inst (and (slot-boundp inst 'parent-instance)
944944
(eieio-oref inst 'parent-instance)))
945945
(push (eieio-oref inst slot) vals)
946946
(setq inst (and
@@ -950,7 +950,7 @@ of the first object for which DO-WHEN failed."
950950
(or (funcall do-when inst)
951951
(and inclusive
952952
(setq failed t)))))
953-
(slot-boundp inst :parent-instance)
953+
(slot-boundp inst 'parent-instance)
954954
(eieio-oref inst 'parent-instance)))))
955955
vals))
956956

@@ -1125,8 +1125,8 @@ switch."
11251125
(set-window-start (get-buffer-window new-buffer t) window-start))
11261126

11271127
(run-hook-with-args 'polymode-after-switch-buffer-hook old-buffer new-buffer)
1128-
(pm--run-hooks pm/polymode :switch-buffer-functions old-buffer new-buffer)
1129-
(pm--run-hooks pm/chunkmode :switch-buffer-functions old-buffer new-buffer)))
1128+
(pm--run-hooks pm/polymode 'switch-buffer-functions old-buffer new-buffer)
1129+
(pm--run-hooks pm/chunkmode 'switch-buffer-functions old-buffer new-buffer)))
11301130

11311131
(defun pm--move-overlays (from-buffer to-buffer)
11321132
"Delete all overlays in TO-BUFFER, then copy FROM-BUFFER overlays to it."
@@ -1998,7 +1998,7 @@ Return FALLBACK if non-nil, otherwise the value of
19981998
(setq VALS (append (and (slot-boundp object slot) ; don't cascade
19991999
(eieio-oref object slot))
20002000
VALS)
2001-
object (and (slot-boundp object :parent-instance)
2001+
object (and (slot-boundp object 'parent-instance)
20022002
(eieio-oref object 'parent-instance))))
20032003
VALS))
20042004

@@ -2078,7 +2078,8 @@ Elements of LIST can be either strings or symbols."
20782078
(goto-char pos)))))))
20792079

20802080
(defmacro pm-with-synchronized-points (&rest body)
2081-
"Run BODY and ensure the points in all polymode buffers are synchronized before and after BODY."
2081+
"Run BODY and ensure the points in all polymode buffers are
2082+
synchronized before and after BODY."
20822083
(declare (indent 0) (debug (body)))
20832084
(pm--synchronize-points)
20842085
`(prog1

polymode-debug.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,7 @@ Key bindings:
104104
(pm-base-buffer) (with-current-buffer (pm-base-buffer) (point))
105105
(buffer-name) (point)
106106
(get-buffer-window (pm-base-buffer))
107-
(with-current-buffer (pm-base-buffer) (window-point))
108-
;; FIXME: This arg is not used.
109-
(window-point))))
107+
(with-current-buffer (pm-base-buffer) (window-point)))))
110108

111109
;; (defun pm-debug-beore-change (&rest r)
112110
;; (pm--debug-report-point "|before|" this-command))
@@ -420,6 +418,8 @@ currently traced functions."
420418
(setq args "[...]"))
421419
(funcall orig-fn fn level args context)))
422420

421+
(declare-function trace-entry-message "ext:")
422+
(declare-function trace-exit-message "ext:")
423423
(advice-add #'trace-entry-message :around #'pm-trace--fix-args-for-tracing)
424424
(advice-add #'trace-exit-message :around #'pm-trace--fix-args-for-tracing)
425425
;; (advice-remove #'trace-entry-message #'pm-trace--fix-args-for-tracing)

polymode-export.el

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ If NO-ASK-IF-1 is non-nil, don't ask if there is only one exporter."
351351
(interactive)
352352
(unless pm/polymode
353353
(error "No pm/polymode object found. Not in polymode buffer?"))
354-
(let* ((weavers (delete-dups (pm--oref-with-parents pm/polymode :weavers)))
354+
(let* ((weavers (delete-dups (pm--oref-with-parents pm/polymode 'weavers)))
355355
(exporters (pm--abrev-names
356356
"pm-exporter/\\|-exporter"
357357
(cl-delete-if-not
@@ -368,7 +368,7 @@ If NO-ASK-IF-1 is non-nil, don't ask if there is only one exporter."
368368
when (pm--selector-match el (concat "dummy." (nth 2 w)))
369369
return t))
370370
return t)))
371-
(delete-dups (pm--oref-with-parents pm/polymode :exporters)))))
371+
(delete-dups (pm--oref-with-parents pm/polymode 'exporters)))))
372372
(sel (if exporters
373373
(if (and no-ask-if-1 (= (length exporters) 1))
374374
(car exporters)
@@ -378,16 +378,16 @@ If NO-ASK-IF-1 is non-nil, don't ask if there is only one exporter."
378378
(setq pm--exporter-hist (delete-dups pm--exporter-hist))
379379
(setq-local pm--export:from-last nil)
380380
(setq-local pm--export:to-last nil)
381-
(oset pm/polymode :exporter out)
381+
(oset pm/polymode 'exporter out)
382382
out))
383383

384384
(defmacro polymode-register-exporter (exporter default &rest configs)
385385
"Add EXPORTER to :exporters slot of all config objects in CONFIGS.
386386
When DEFAULT is non-nil, also make EXPORTER the default exporter
387387
for each polymode in CONFIGS."
388388
`(dolist (pm ',configs)
389-
(object-add-to-list (symbol-value pm) :exporters ',exporter)
390-
(when ,default (oset (symbol-value pm) :exporter ',exporter))))
389+
(object-add-to-list (symbol-value pm) 'exporters ',exporter)
390+
(when ,default (oset (symbol-value pm) 'exporter ',exporter))))
391391

392392

393393
;;; GLOBAL EXPORTERS

polymode-methods.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ Ran by the polymode mode function."
6363
;; Set if nil! This allows unspecified host chunkmodes to be used in
6464
;; minor modes.
6565
(host-mode (or (eieio-oref hostmode 'mode)
66-
(oset hostmode :mode major-mode))))
66+
(oset hostmode 'mode major-mode))))
6767
;; FIXME: mode hooks and local var hacking happens here. Need to move it
6868
;; to the end.
6969
(pm--mode-setup host-mode)

polymode-weave.el

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ specification."
258258
When DEFAULT is non-nil, also make weaver the default WEAVER for
259259
each polymode in CONFIGS."
260260
`(dolist (pm ',configs)
261-
(object-add-to-list (symbol-value pm) :weavers ',weaver)
262-
(when ,default (oset (symbol-value pm) :weaver ',weaver))))
261+
(object-add-to-list (symbol-value pm) 'weavers ',weaver)
262+
(when ,default (oset (symbol-value pm) 'weaver ',weaver))))
263263

264264
(defun polymode-set-weaver ()
265265
"Set the current weaver for this polymode."
@@ -268,12 +268,12 @@ each polymode in CONFIGS."
268268
(error "No pm/polymode object found. Not in polymode buffer?"))
269269
(let* ((weavers (pm--abrev-names
270270
"pm-weaver/\\|-weaver$"
271-
(delete-dups (pm--oref-with-parents pm/polymode :weavers))))
271+
(delete-dups (pm--oref-with-parents pm/polymode 'weavers))))
272272
(sel (pm--completing-read "Choose weaver: " weavers nil t nil 'pm--weaver-hist))
273273
(out (intern (cdr sel))))
274274
(setq pm--weaver-hist (delete-dups pm--weaver-hist))
275275
(setq-local pm--weave:fromto-last nil)
276-
(oset pm/polymode :weaver out)
276+
(oset pm/polymode 'weaver out)
277277
out))
278278

279279
(provide 'polymode-weave)

polymode.el

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ Not effective after loading the polymode library.
5353
Instead of setting this key you can programatically bind it directly
5454
in `polymode-minor-mode-map` keymap:
5555
56-
(define-key polymode-minor-mode-map (kbd \"M-n\") nil) ;unbind the default M-n prefix
56+
(define-key polymode-minor-mode-map (kbd \"M-n\") nil)
57+
;unbind the default M-n prefix
5758
(define-key polymode-minor-mode-map (kbd \"C-c n\") polymode-map)
5859
")
5960

@@ -443,7 +444,7 @@ non-nil, don't throw if `polymode-eval-region-function' is nil."
443444
(pi parent-conf)
444445
(parent-map))
445446
(while pi
446-
(let ((map (and (slot-boundp pi :keylist)
447+
(let ((map (and (slot-boundp pi 'keylist)
447448
(eieio-oref pi 'keylist))))
448449
(when map
449450
(if (and (symbolp map)
@@ -453,7 +454,7 @@ non-nil, don't throw if `polymode-eval-region-function' is nil."
453454
(setq parent-map map
454455
pi nil)
455456
;; list, descend to next parent and append the key list to keylist
456-
(setq pi (and (slot-boundp pi :parent-instance)
457+
(setq pi (and (slot-boundp pi 'parent-instance)
457458
(eieio-oref pi 'parent-instance))
458459
keylist (append map keylist))))))
459460
(when (and parent-map (symbolp parent-map))

0 commit comments

Comments
 (0)