Created
April 9, 2012 08:44
-
-
Save hidsh/2342369 to your computer and use it in GitHub Desktop.
xyzzy: backward-delete-word-no-kill, kill-word-no-kill
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;@@@ backward-delete-word-no-kill | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(defun backward-delete-word-no-kill () | |
(interactive) | |
(let ((dest (save-excursion | |
(progn (backward-word) | |
(point))))) | |
(if (bolp) (backward-delete-char-untabify 1) | |
(while (and (< dest (point)) (not (bolp))) | |
(backward-delete-char-untabify 1))))) | |
(global-set-key #\M-h 'backward-delete-word-no-kill) | |
;; for minibuffer | |
(define-key minibuffer-local-must-match-map #\M-h 'backward-delete-word-no-kill) | |
(define-key minibuffer-local-completion-map #\M-h 'backward-delete-word-no-kill) | |
(define-key minibuffer-local-map #\M-h 'backward-delete-word-no-kill) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;;@@@ kill-word-no-kill | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(defun kill-word-no-kill () | |
(interactive) | |
(let ((n (- (save-excursion | |
(progn (forward-word) | |
(point))) | |
(point)))) | |
(if (eolp) (delete-char 1) | |
(while (and (< 0 n) (char/= (following-char) (code-char 10))) | |
(delete-char 1) (setq n (1- n)))))) | |
(global-set-key #\M-d 'kill-word-no-kill) | |
;; for minibuffer | |
(define-key minibuffer-local-must-match-map #\M-d 'kill-word-no-kill) | |
(define-key minibuffer-local-completion-map #\M-d 'kill-word-no-kill) | |
(define-key minibuffer-local-map #\M-d 'kill-word-no-kill) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment