[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 67/77: New handler for defun-name and bind it to `D'
From: |
Leo Liu |
Subject: |
[elpa] 67/77: New handler for defun-name and bind it to `D' |
Date: |
Sat, 05 Apr 2014 04:08:26 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit 8235069396ae5ce7901d7a6a1839ce1d0643e506
Author: Leo Liu <address@hidden>
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``
#. address@hidden -> 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)
- [elpa] 54/77: Better control of message emission in an easy-kill session, (continued)
- [elpa] 54/77: Better control of message emission in an easy-kill session, Leo Liu, 2014/04/05
- [elpa] 63/77: Teach easy-kill-activate-keymap to handle command remapping, Leo Liu, 2014/04/05
- [elpa] 59/77: Doc fix, Leo Liu, 2014/04/05
- [elpa] 64/77: Teach easy-kill to handle rectangle-mark from Emacs trunk, Leo Liu, 2014/04/05
- [elpa] 56/77: Doc fix and release v0.9.0, Leo Liu, 2014/04/05
- [elpa] 61/77: Optimise easy-kill-thing-forward when n is 0, Leo Liu, 2014/04/05
- [elpa] 62/77: Small tweak to easy-kill-on-nxml-element, Leo Liu, 2014/04/05
- [elpa] 60/77: Make easy-kill-on-buffer-file-name do nothing in easy-mark, Leo Liu, 2014/04/05
- [elpa] 68/77: Fix easy-kill-append to update clipboard, Leo Liu, 2014/04/05
- [elpa] 65/77: Fix #8: Don't strip trailing blank chars, Leo Liu, 2014/04/05
- [elpa] 67/77: New handler for defun-name and bind it to `D',
Leo Liu <=
- [elpa] 66/77: Fix #9: Work around fixed bug in thingatpt.el, Leo Liu, 2014/04/05
- [elpa] 71/77: In no case should easy-kill-activate-keymap err, Leo Liu, 2014/04/05
- [elpa] 70/77: Adapt to upstream change, Leo Liu, 2014/04/05
- [elpa] 72/77: Rename easy-kill-backward-down to easy-kill-forward-down, Leo Liu, 2014/04/05
- [elpa] 73/77: Support list expand/shrink on js2 nodes, Leo Liu, 2014/04/05
- [elpa] 74/77: Require cl-lib, Leo Liu, 2014/04/05
- [elpa] 76/77: Add easy-kill to externals-list, Leo Liu, 2014/04/05
- [elpa] 77/77: Merge easy-kill as packages/easy-kill, Leo Liu, 2014/04/05
- [elpa] 75/77: Cleanup and preparation for inclusion in GNU ELPA, Leo Liu, 2014/04/05
- [elpa] 69/77: Consolidate easy-mark and easy-mark-sexp into one command, Leo Liu, 2014/04/05