mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2025-10-13 13:03:03 +00:00
eliminate byte-compilation warnings
- long docstrings - "defcustom fails to specify type" - use '(sexp) - keyword arguments in define-minor-mode - deprecations
This commit is contained in:
parent
8a60fc7ef0
commit
aae47aebc0
@ -92,7 +92,7 @@
|
|||||||
((fboundp 'cl-return-from)
|
((fboundp 'cl-return-from)
|
||||||
(cl-return-from mc/cycle nil))
|
(cl-return-from mc/cycle nil))
|
||||||
((fboundp 'return-from)
|
((fboundp 'return-from)
|
||||||
(return-from mc/cycle nil))))
|
(cl-return-from mc/cycle nil))))
|
||||||
(setf next-cursor fallback-cursor))
|
(setf next-cursor fallback-cursor))
|
||||||
(mc/create-fake-cursor-at-point)
|
(mc/create-fake-cursor-at-point)
|
||||||
(mc/pop-state-from-overlay next-cursor)
|
(mc/pop-state-from-overlay next-cursor)
|
||||||
|
@ -54,8 +54,9 @@ also hum/lines-to-expand below and above) To make use of this
|
|||||||
mode press \"C-'\" while multiple-cursor-mode is active. You can
|
mode press \"C-'\" while multiple-cursor-mode is active. You can
|
||||||
still edit lines while you are in mc-hide-unmatched-lines
|
still edit lines while you are in mc-hide-unmatched-lines
|
||||||
mode. To leave this mode press <return> or \"C-g\""
|
mode. To leave this mode press <return> or \"C-g\""
|
||||||
nil " hu"
|
:init-value nil
|
||||||
hum/hide-unmatched-lines-mode-map
|
:lighter " hu"
|
||||||
|
:keymap hum/hide-unmatched-lines-mode-map
|
||||||
(if mc-hide-unmatched-lines-mode
|
(if mc-hide-unmatched-lines-mode
|
||||||
;;just in case if mc mode will be disabled while hide-unmatched-lines is active
|
;;just in case if mc mode will be disabled while hide-unmatched-lines is active
|
||||||
(progn
|
(progn
|
||||||
|
@ -210,9 +210,13 @@ With zero ARG, skip the last one and mark next."
|
|||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun mc/mark-previous-like-this (arg)
|
(defun mc/mark-previous-like-this (arg)
|
||||||
"Find and mark the previous part of the buffer matching the currently active region
|
"Find and mark the previous part of the buffer matching the
|
||||||
If no region is active add a cursor on the previous line
|
currently active region.
|
||||||
|
|
||||||
|
If no region is active ,add a cursor on the previous line.
|
||||||
|
|
||||||
With negative ARG, delete the last one instead.
|
With negative ARG, delete the last one instead.
|
||||||
|
|
||||||
With zero ARG, skip the last one and mark next."
|
With zero ARG, skip the last one and mark next."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(if (< arg 0)
|
(if (< arg 0)
|
||||||
@ -227,9 +231,14 @@ With zero ARG, skip the last one and mark next."
|
|||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun mc/mark-previous-like-this-word (arg)
|
(defun mc/mark-previous-like-this-word (arg)
|
||||||
"Find and mark the previous part of the buffer matching the currently active region
|
"Find and mark the previous part of the buffer matching the
|
||||||
If no region is active, mark the word at the point and find the previous match
|
currently active region.
|
||||||
|
|
||||||
|
If no region is active, mark the word at the point and find the
|
||||||
|
previous match.
|
||||||
|
|
||||||
With negative ARG, delete the last one instead.
|
With negative ARG, delete the last one instead.
|
||||||
|
|
||||||
With zero ARG, skip the last one and mark previous."
|
With zero ARG, skip the last one and mark previous."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(if (< arg 0)
|
(if (< arg 0)
|
||||||
@ -244,9 +253,14 @@ With zero ARG, skip the last one and mark previous."
|
|||||||
(mc/maybe-multiple-cursors-mode))
|
(mc/maybe-multiple-cursors-mode))
|
||||||
|
|
||||||
(defun mc/mark-previous-like-this-symbol (arg)
|
(defun mc/mark-previous-like-this-symbol (arg)
|
||||||
"Find and mark the previous part of the buffer matching the currently active region
|
"Find and mark the previous part of the buffer matching the
|
||||||
If no region is active, mark the symbol at the point and find the previous match
|
currently active region.
|
||||||
|
|
||||||
|
If no region is active, mark the symbol at the point and find the
|
||||||
|
previous match.
|
||||||
|
|
||||||
With negative ARG, delete the last one instead.
|
With negative ARG, delete the last one instead.
|
||||||
|
|
||||||
With zero ARG, skip the last one and mark previous."
|
With zero ARG, skip the last one and mark previous."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(if (< arg 0)
|
(if (< arg 0)
|
||||||
@ -263,10 +277,15 @@ With zero ARG, skip the last one and mark previous."
|
|||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun mc/mark-previous-word-like-this (arg)
|
(defun mc/mark-previous-word-like-this (arg)
|
||||||
"Find and mark the previous part of the buffer matching the currently active region
|
"Find and mark the previous part of the buffer matching the
|
||||||
The matching region must be a whole word to be a match
|
currently active region.
|
||||||
If no region is active add a cursor on the previous line
|
|
||||||
|
The matching region must be a whole word to be a match.
|
||||||
|
|
||||||
|
If no region is active, add a cursor on the previous line.
|
||||||
|
|
||||||
With negative ARG, delete the last one instead.
|
With negative ARG, delete the last one instead.
|
||||||
|
|
||||||
With zero ARG, skip the last one and mark next."
|
With zero ARG, skip the last one and mark next."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(let ((mc/enclose-search-term 'words))
|
(let ((mc/enclose-search-term 'words))
|
||||||
@ -274,10 +293,15 @@ With zero ARG, skip the last one and mark next."
|
|||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun mc/mark-previous-symbol-like-this (arg)
|
(defun mc/mark-previous-symbol-like-this (arg)
|
||||||
"Find and mark the previous part of the buffer matching the currently active region
|
"Find and mark the previous part of the buffer matching
|
||||||
The matching region must be a whole symbol to be a match
|
the currently active region.
|
||||||
If no region is active add a cursor on the previous line
|
|
||||||
|
The matching region must be a whole symbol to be a match.
|
||||||
|
|
||||||
|
If no region is active add a cursor on the previous line.
|
||||||
|
|
||||||
With negative ARG, delete the last one instead.
|
With negative ARG, delete the last one instead.
|
||||||
|
|
||||||
With zero ARG, skip the last one and mark next."
|
With zero ARG, skip the last one and mark next."
|
||||||
(interactive "p")
|
(interactive "p")
|
||||||
(let ((mc/enclose-search-term 'symbols))
|
(let ((mc/enclose-search-term 'symbols))
|
||||||
@ -324,13 +348,15 @@ With zero ARG, skip the last one and mark next."
|
|||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun mc/skip-to-next-like-this ()
|
(defun mc/skip-to-next-like-this ()
|
||||||
"Skip the current one and select the next part of the buffer matching the currently active region."
|
"Skip the current one and select the next part of the buffer
|
||||||
|
matching the currently active region."
|
||||||
(interactive)
|
(interactive)
|
||||||
(mc/mark-next-like-this 0))
|
(mc/mark-next-like-this 0))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun mc/skip-to-previous-like-this ()
|
(defun mc/skip-to-previous-like-this ()
|
||||||
"Skip the current one and select the prev part of the buffer matching the currently active region."
|
"Skip the current one and select the prev part of the buffer
|
||||||
|
matching the currently active region."
|
||||||
(interactive)
|
(interactive)
|
||||||
(mc/mark-previous-like-this 0))
|
(mc/mark-previous-like-this 0))
|
||||||
|
|
||||||
@ -471,7 +497,7 @@ remove the keymap depends on user input and KEEP-PRED:
|
|||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun mc/mark-more-like-this-extended ()
|
(defun mc/mark-more-like-this-extended ()
|
||||||
"Like mark-more-like-this, but then lets you adjust with arrows key.
|
"Like mark-more-like-this, but then lets you adjust with arrow keys.
|
||||||
The adjustments work like this:
|
The adjustments work like this:
|
||||||
|
|
||||||
<up> Mark previous like this and set direction to 'up
|
<up> Mark previous like this and set direction to 'up
|
||||||
@ -487,13 +513,15 @@ If direction is 'down:
|
|||||||
<left> Remove the cursor furthest down
|
<left> Remove the cursor furthest down
|
||||||
<right> Skip past the cursor furthest down
|
<right> Skip past the cursor furthest down
|
||||||
|
|
||||||
The bindings for these commands can be changed. See `mc/mark-more-like-this-extended-keymap'."
|
The bindings for these commands can be changed.
|
||||||
|
See `mc/mark-more-like-this-extended-keymap'."
|
||||||
(interactive)
|
(interactive)
|
||||||
(mc/mmlte--down)
|
(mc/mmlte--down)
|
||||||
(set-temporary-overlay-map mc/mark-more-like-this-extended-keymap t))
|
(set-transient-map mc/mark-more-like-this-extended-keymap t))
|
||||||
|
|
||||||
(defvar mc/mark-more-like-this-extended-direction nil
|
(defvar mc/mark-more-like-this-extended-direction nil
|
||||||
"When using mc/mark-more-like-this-extended are we working on the next or previous cursors?")
|
"When using mc/mark-more-like-this-extended
|
||||||
|
are we working on the next or previous cursors?")
|
||||||
|
|
||||||
(make-variable-buffer-local 'mc/mark-more-like-this-extended)
|
(make-variable-buffer-local 'mc/mark-more-like-this-extended)
|
||||||
|
|
||||||
@ -639,7 +667,7 @@ If the region is inactive or on a single line, it will behave like
|
|||||||
(last
|
(last
|
||||||
(progn
|
(progn
|
||||||
(when (looking-at "<") (forward-char 1))
|
(when (looking-at "<") (forward-char 1))
|
||||||
(when (looking-back ">") (forward-char -1))
|
(when (looking-back ">" 100) (forward-char -1))
|
||||||
(sgml-get-context)))))
|
(sgml-get-context)))))
|
||||||
|
|
||||||
(defun mc--on-tag-name-p ()
|
(defun mc--on-tag-name-p ()
|
||||||
|
@ -138,7 +138,7 @@ rendered or shift text."
|
|||||||
"Create overlay to look like cursor at end of line."
|
"Create overlay to look like cursor at end of line."
|
||||||
(let ((overlay (make-overlay pos pos nil nil nil)))
|
(let ((overlay (make-overlay pos pos nil nil nil)))
|
||||||
(if (and mc/match-cursor-style (mc/cursor-is-bar))
|
(if (and mc/match-cursor-style (mc/cursor-is-bar))
|
||||||
(overlay-put overlay 'before-string (propertize "|" 'face 'mc/cursor-bar-face))
|
(overlay-put overlay 'before-string (propertize "|" 'face 'mc/cursor-bar-face))
|
||||||
(overlay-put overlay 'after-string (propertize " " 'face 'mc/cursor-face)))
|
(overlay-put overlay 'after-string (propertize " " 'face 'mc/cursor-face)))
|
||||||
overlay))
|
overlay))
|
||||||
|
|
||||||
@ -146,7 +146,7 @@ rendered or shift text."
|
|||||||
"Create overlay to look like cursor inside text."
|
"Create overlay to look like cursor inside text."
|
||||||
(let ((overlay (make-overlay pos (1+ pos) nil nil nil)))
|
(let ((overlay (make-overlay pos (1+ pos) nil nil nil)))
|
||||||
(if (and mc/match-cursor-style (mc/cursor-is-bar))
|
(if (and mc/match-cursor-style (mc/cursor-is-bar))
|
||||||
(overlay-put overlay 'before-string (propertize "|" 'face 'mc/cursor-bar-face))
|
(overlay-put overlay 'before-string (propertize "|" 'face 'mc/cursor-bar-face))
|
||||||
(overlay-put overlay 'face 'mc/cursor-face))
|
(overlay-put overlay 'face 'mc/cursor-face))
|
||||||
overlay))
|
overlay))
|
||||||
|
|
||||||
@ -192,8 +192,8 @@ highlights the entire width of the window."
|
|||||||
"Store relevant info about point and mark in the given overlay."
|
"Store relevant info about point and mark in the given overlay."
|
||||||
(overlay-put o 'point (set-marker (make-marker) (point)))
|
(overlay-put o 'point (set-marker (make-marker) (point)))
|
||||||
(overlay-put o 'mark (set-marker (make-marker)
|
(overlay-put o 'mark (set-marker (make-marker)
|
||||||
(let ((mark-even-if-inactive t))
|
(let ((mark-even-if-inactive t))
|
||||||
(mark))))
|
(mark))))
|
||||||
(dolist (var mc/cursor-specific-vars)
|
(dolist (var mc/cursor-specific-vars)
|
||||||
(when (boundp var) (overlay-put o var (symbol-value var))))
|
(when (boundp var) (overlay-put o var (symbol-value var))))
|
||||||
o)
|
o)
|
||||||
@ -250,8 +250,11 @@ If this value is nil, there is no ceiling."
|
|||||||
:group 'multiple-cursors)
|
:group 'multiple-cursors)
|
||||||
|
|
||||||
(defun mc/create-fake-cursor-at-point (&optional id)
|
(defun mc/create-fake-cursor-at-point (&optional id)
|
||||||
"Add a fake cursor and possibly a fake active region overlay based on point and mark.
|
"Add a fake cursor and possibly a fake active region overlay
|
||||||
Saves the current state in the overlay to be restored later."
|
based on point and mark.
|
||||||
|
|
||||||
|
Saves the current state in the overlay
|
||||||
|
to be restored later."
|
||||||
(unless mc--max-cursors-original
|
(unless mc--max-cursors-original
|
||||||
(setq mc--max-cursors-original mc/max-cursors))
|
(setq mc--max-cursors-original mc/max-cursors))
|
||||||
(when mc/max-cursors
|
(when mc/max-cursors
|
||||||
@ -271,7 +274,8 @@ Saves the current state in the overlay to be restored later."
|
|||||||
overlay))
|
overlay))
|
||||||
|
|
||||||
(defun mc/execute-command (cmd)
|
(defun mc/execute-command (cmd)
|
||||||
"Run command, simulating the parts of the command loop that makes sense for fake cursors."
|
"Run command, simulating the parts of the command loop that
|
||||||
|
makes sense for fake cursors."
|
||||||
(setq this-command cmd)
|
(setq this-command cmd)
|
||||||
(run-hooks 'pre-command-hook)
|
(run-hooks 'pre-command-hook)
|
||||||
(unless (eq this-command 'ignore)
|
(unless (eq this-command 'ignore)
|
||||||
@ -350,7 +354,8 @@ cursor with updated info."
|
|||||||
"Variable to keep the state of the real cursor while undoing a fake one")
|
"Variable to keep the state of the real cursor while undoing a fake one")
|
||||||
|
|
||||||
(defun activate-cursor-for-undo (id)
|
(defun activate-cursor-for-undo (id)
|
||||||
"Called when undoing to temporarily activate the fake cursor which action is being undone."
|
"Called when undoing to temporarily activate the fake cursor
|
||||||
|
which action is being undone."
|
||||||
(let ((cursor (mc/cursor-with-id id)))
|
(let ((cursor (mc/cursor-with-id id)))
|
||||||
(when cursor
|
(when cursor
|
||||||
(setq mc--stored-state-for-undo (mc/store-current-state-in-overlay
|
(setq mc--stored-state-for-undo (mc/store-current-state-in-overlay
|
||||||
@ -567,13 +572,16 @@ They are temporarily disabled when multiple-cursors are active.")
|
|||||||
`(" mc:" (:eval (format ,(propertize "%d" 'face 'font-lock-warning-face)
|
`(" mc:" (:eval (format ,(propertize "%d" 'face 'font-lock-warning-face)
|
||||||
(mc/num-cursors))))
|
(mc/num-cursors))))
|
||||||
"What to display in the mode line while multiple-cursors-mode is active."
|
"What to display in the mode line while multiple-cursors-mode is active."
|
||||||
|
:type '(sexp)
|
||||||
:group 'multiple-cursors)
|
:group 'multiple-cursors)
|
||||||
(put 'mc/mode-line 'risky-local-variable t)
|
(put 'mc/mode-line 'risky-local-variable t)
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(define-minor-mode multiple-cursors-mode
|
(define-minor-mode multiple-cursors-mode
|
||||||
"Mode while multiple cursors are active."
|
"Mode while multiple cursors are active."
|
||||||
nil mc/mode-line mc/keymap
|
:init-value nil
|
||||||
|
:lighter mc/mode-line
|
||||||
|
:keymap mc/keymap
|
||||||
(if multiple-cursors-mode
|
(if multiple-cursors-mode
|
||||||
(progn
|
(progn
|
||||||
(mc/temporarily-disable-unsupported-minor-modes)
|
(mc/temporarily-disable-unsupported-minor-modes)
|
||||||
@ -617,7 +625,7 @@ from being executed if in multiple-cursors-mode."
|
|||||||
|
|
||||||
;; Make sure pastes from other programs are added to all kill-rings when yanking
|
;; Make sure pastes from other programs are added to all kill-rings when yanking
|
||||||
(defadvice current-kill (before interprogram-paste-for-all-cursors
|
(defadvice current-kill (before interprogram-paste-for-all-cursors
|
||||||
(n &optional do-not-move) activate)
|
(n &optional do-not-move) activate)
|
||||||
(let ((interprogram-paste (and (= n 0)
|
(let ((interprogram-paste (and (= n 0)
|
||||||
interprogram-paste-function
|
interprogram-paste-function
|
||||||
(funcall interprogram-paste-function))))
|
(funcall interprogram-paste-function))))
|
||||||
@ -693,8 +701,8 @@ for running commands with multiple cursors."
|
|||||||
mc/edit-ends-of-lines
|
mc/edit-ends-of-lines
|
||||||
mc/edit-beginnings-of-lines
|
mc/edit-beginnings-of-lines
|
||||||
mc/mark-next-like-this
|
mc/mark-next-like-this
|
||||||
mc/mark-next-like-this-word
|
mc/mark-next-like-this-word
|
||||||
mc/mark-next-like-this-symbol
|
mc/mark-next-like-this-symbol
|
||||||
mc/mark-next-word-like-this
|
mc/mark-next-word-like-this
|
||||||
mc/mark-next-symbol-like-this
|
mc/mark-next-symbol-like-this
|
||||||
mc/mark-previous-like-this
|
mc/mark-previous-like-this
|
||||||
@ -713,7 +721,7 @@ for running commands with multiple cursors."
|
|||||||
mc/mark-all-dwim
|
mc/mark-all-dwim
|
||||||
mc/mark-sgml-tag-pair
|
mc/mark-sgml-tag-pair
|
||||||
mc/insert-numbers
|
mc/insert-numbers
|
||||||
mc/insert-letters
|
mc/insert-letters
|
||||||
mc/sort-regions
|
mc/sort-regions
|
||||||
mc/reverse-regions
|
mc/reverse-regions
|
||||||
mc/cycle-forward
|
mc/cycle-forward
|
||||||
|
@ -52,8 +52,9 @@
|
|||||||
(defun set-rectangular-region-anchor ()
|
(defun set-rectangular-region-anchor ()
|
||||||
"Anchors the rectangular region at point.
|
"Anchors the rectangular region at point.
|
||||||
|
|
||||||
Think of this one as `set-mark' except you're marking a rectangular region. It is
|
Think of this one as `set-mark' except you're marking a
|
||||||
an exceedingly quick way of adding multiple cursors to multiple lines."
|
rectangular region. It is an exceedingly quick way of adding
|
||||||
|
multiple cursors to multiple lines."
|
||||||
(interactive)
|
(interactive)
|
||||||
(set-marker rrm/anchor (point))
|
(set-marker rrm/anchor (point))
|
||||||
(push-mark (point))
|
(push-mark (point))
|
||||||
@ -111,7 +112,9 @@ an exceedingly quick way of adding multiple cursors to multiple lines."
|
|||||||
;;;###autoload
|
;;;###autoload
|
||||||
(define-minor-mode rectangular-region-mode
|
(define-minor-mode rectangular-region-mode
|
||||||
"A mode for creating a rectangular region to edit"
|
"A mode for creating a rectangular region to edit"
|
||||||
nil " rr" rectangular-region-mode-map
|
:init-value nil
|
||||||
|
:lighter " rr"
|
||||||
|
:keymap rectangular-region-mode-map
|
||||||
(if rectangular-region-mode
|
(if rectangular-region-mode
|
||||||
(progn
|
(progn
|
||||||
(add-hook 'after-change-functions 'rrm/switch-to-multiple-cursors t t)
|
(add-hook 'after-change-functions 'rrm/switch-to-multiple-cursors t t)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user