Emacs: no more overloading mark-word
parent
dad9ab299b
commit
08998aecb3
|
@ -210,36 +210,21 @@ fallback to the mode provided in symbol DEFAULT."
|
||||||
(warn "Could not load %s, fallback to %s"
|
(warn "Could not load %s, fallback to %s"
|
||||||
(symbol-name ',feature) (symbol-name ',default))))))))))
|
(symbol-name ',feature) (symbol-name ',default))))))))))
|
||||||
|
|
||||||
;; TODO: use defadvice instead of duplicate code.
|
;; TODO: try defadvice.
|
||||||
(defun mark-word-alt (&optional arg allow-extend)
|
(defun mark-word-from-beginning (&optional arg allow-extend)
|
||||||
"Set mark ARG words away from point.
|
"Set the point at the beginning of the word and call `mark-word'."
|
||||||
The place mark goes is the same place \\[forward-word] would move
|
|
||||||
to with the same argument. Interactively, if this command is
|
|
||||||
repeated or (in Transient Mark mode) if the mark is active, it
|
|
||||||
marks the next ARG words after the ones already marked.\n
|
|
||||||
This overloads the vanilla function to mark words from the
|
|
||||||
beginning."
|
|
||||||
(interactive "P\np")
|
(interactive "P\np")
|
||||||
(cond ((and allow-extend
|
(cond ((and allow-extend
|
||||||
(or (and (eq last-command this-command) (mark t))
|
(or (and (eq last-command this-command) (mark t))
|
||||||
(region-active-p)))
|
(region-active-p)))
|
||||||
(setq arg (if arg (prefix-numeric-value arg)
|
(mark-word arg allow-extend))
|
||||||
(if (< (mark) (point)) -1 1)))
|
|
||||||
(set-mark
|
|
||||||
(save-excursion
|
|
||||||
(goto-char (mark))
|
|
||||||
(forward-word arg)
|
|
||||||
(point))))
|
|
||||||
(t
|
(t
|
||||||
;; The next line makes sure the word at point gets selected if point is
|
;; The next line makes sure the word at point gets selected if point is
|
||||||
;; on the first letter. We need to ignore error if point is at EOF.
|
;; on the first letter. We need to ignore error if point is at EOF.
|
||||||
(ignore-errors (forward-char))
|
(ignore-errors (forward-char))
|
||||||
(backward-word)
|
(backward-word)
|
||||||
(push-mark
|
(mark-word arg allow-extend))))
|
||||||
(save-excursion
|
(define-key my-keys-minor-mode-map (kbd "M-@") 'mark-word-from-beginning)
|
||||||
(forward-word (prefix-numeric-value arg))
|
|
||||||
(point))
|
|
||||||
nil t))))
|
|
||||||
|
|
||||||
(defun move-border-left (arg)
|
(defun move-border-left (arg)
|
||||||
"Move window border in a natural manner.
|
"Move window border in a natural manner.
|
||||||
|
|
Loading…
Reference in New Issue