leoliu pushed a commit to branch master in repository elpa. commit 8235069396ae5ce7901d7a6a1839ce1d0643e506 Author: Leo Liu <sdl....@gmail.com> Date: Thu Nov 7 14:03:46 2013 +0800
New handler for defun-name and bind it to `D' --- README.rst | 1 + easy-kill.el | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletions(-) diff --git a/README.rst b/README.rst index d953a13..f5fb6e6 100644 --- a/README.rst +++ b/README.rst @@ -25,6 +25,7 @@ active: #. ``f`` -> file at point #. ``l`` -> list at point #. ``d`` -> defun at point +#. ``D`` -> defun-name; works even when in a diff hunk #. ``b`` -> ``buffer-file-name`` or ``default-directory`` #. ``@`` -> append selection to previous kill #. ``C-w`` -> kill selection diff --git a/easy-kill.el b/easy-kill.el index f8db73f..994a5b0 100644 --- a/easy-kill.el +++ b/easy-kill.el @@ -74,7 +74,8 @@ (?f . filename) (?d . defun) (?e . line) - (?b . buffer-file-name)) + (?b . buffer-file-name) + (?D . defun-name)) "A list of (CHAR . THING). CHAR is used immediately following `easy-kill' to select THING." :type '(repeat (cons character symbol)) @@ -414,6 +415,17 @@ party; +, full path." (_ file)))) (easy-kill-adjust-candidate 'buffer-file-name text)))))) +;;; Handler for `defun-name'. + +(defun easy-kill-on-defun-name (_n) + "Get current defun name." + (if easy-kill-mark + (easy-kill-message-nolog "Not supported in `easy-mark'") + (let ((defun-name (add-log-current-defun))) + (if defun-name + (easy-kill-adjust-candidate 'defun-name defun-name) + (easy-kill-message-nolog "No `defun-name' at point"))))) + ;;; Handler for `url'. (defun easy-kill-on-url (&optional _n)