1 new commit in cc-mode:
https://bitbucket.org/xemacs/cc-mode/commits/c4233994df9a/
Changeset: c4233994df9a
User: acm
Date: 2017-11-03 19:23:39+00:00
Summary: Introduce a function to CC Mode which displays the current function name
Remove an erroneous interactive specification from two functions.
* cc-cmds.el (c-display-defun-name): New command.
(c-defun-name, c-cpp-define-name): Remove interactive specification.
* cc-mode.el (c-mode-base-map): Add binding C-c C-z for the new command.
* cc-mode.texi (Other Commands): Add documentation for the new command.
Affected #: 3 files
diff -r a63d84d98dedcefec044dfec5e286b57ad4f79ce -r
c4233994df9a33d8455917fb88c16c1492402ab0 cc-cmds.el
--- a/cc-cmds.el
+++ b/cc-cmds.el
@@ -1776,7 +1776,6 @@
"Return the name of the current defun, or NIL if there isn't one.
\"Defun\" here means a function, or other top level construct
with a brace block."
- (interactive)
(c-save-buffer-state
(beginning-of-defun-function end-of-defun-function
where pos name-end case-fold-search)
@@ -1985,6 +1984,23 @@
(eq (char-after) ?\{)
(cons (point-min) (point-max))))))))
+(defun c-display-defun-name (&optional arg)
+ "Display the name of the current CC mode defun and the position in it.
+With a prefix arg, push the name onto the kill ring too."
+ (interactive "P")
+ (save-restriction
+ (widen)
+ (c-save-buffer-state ((name (c-defun-name))
+ (limits (c-declaration-limits t))
+ (point-bol (c-point 'bol)))
+ (when name
+ (message "%s. Line %s/%s." name
+ (1+ (count-lines (car limits) point-bol))
+ (count-lines (car limits) (cdr limits)))
+ (if arg (kill-new name))
+ (sit-for 3 t)))))
+(put 'c-display-defun-name 'isearch-scroll t)
+
(defun c-mark-function ()
"Put mark at end of the current top-level declaration or macro, point at
beginning.
If point is not inside any then the closest following one is
@@ -2033,7 +2049,6 @@
(defun c-cpp-define-name ()
"Return the name of the current CPP macro, or NIL if we're not in one."
- (interactive)
(let (case-fold-search)
(save-excursion
(and c-opt-cpp-macro-define-start
diff -r a63d84d98dedcefec044dfec5e286b57ad4f79ce -r
c4233994df9a33d8455917fb88c16c1492402ab0 cc-mode.el
--- a/cc-mode.el
+++ b/cc-mode.el
@@ -371,7 +371,8 @@
;;(define-key c-mode-base-map "\C-c\C-v" 'c-version)
;; (define-key c-mode-base-map "\C-c\C-y" 'c-toggle-hungry-state)
Commented out by ACM, 2005-11-22.
(define-key c-mode-base-map "\C-c\C-w" 'c-subword-mode)
- (define-key c-mode-base-map "\C-c\C-k" 'c-toggle-comment-style))
+ (define-key c-mode-base-map "\C-c\C-k" 'c-toggle-comment-style)
+ (define-key c-mode-base-map "\C-c\C-z" 'c-display-defun-name))
;; We don't require the outline package, but we configure it a bit anyway.
(cc-bytecomp-defvar outline-level)
diff -r a63d84d98dedcefec044dfec5e286b57ad4f79ce -r
c4233994df9a33d8455917fb88c16c1492402ab0 cc-mode.texi
--- a/cc-mode.texi
+++ b/cc-mode.texi
@@ -1761,6 +1761,7 @@
see @ref{Indentation Commands} and @ref{Filling and Breaking}.
For details of the @ccmode{} style system, see @ref{Styles}.
+
@item @kbd{C-c :} (@code{c-scope-operator})
@kindex C-c :
@findex c-scope-operator
@@ -1769,6 +1770,18 @@
operator without performing the electric behavior of colon insertion.
@kbd{C-c :} does just this.
+@item @kbd{C-c C-z} (@code{c-display-defun-name})
+@kindex C-c C-z
+@findex c-display-defun-name
+@findex display-defun-name (c-)
+Display the current function name, if any, in the minibuffer.
+Additionally, if a prefix argument is given, push the function name to
+the kill ring. If there is no current function,
+@code{c-display-defun-name} does nothing. In Emacs, you can use this
+command in the middle of an interactive search if you set the
+customizable option @code{isearch-allow-scoll} to non-@code{nil}.
+@xref{Not Exiting Isearch,,,emacs, GNU Emacs Manual}.
+
@item @kbd{C-c C-\} (@code{c-backslash-region})
@kindex C-c C-\
@findex c-backslash-region
Repository URL:
https://bitbucket.org/xemacs/cc-mode/
--
This is a commit notification from
bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.