From: Alan Mackenzie <acm@muc.de>
To: emacs-devel@gnu.org
Subject: Bug #29083: Is it OK to add a new function to the emacs-26 branch?
Date: Wed, 1 Nov 2017 11:21:44 +0000 [thread overview]
Message-ID: <20171101112144.GB5276@ACM> (raw)
Hello, Emacs.
This bug said that doing M-x c-defun-name failed to display the current
function name. This is true; c-defun-name merely returns that name to
the calling lisp program, and should never have been interactive. It's
not going to be interactive for much longer.
However, the OP has requested that a function which actually displays
this name be put into CC Mode. Would it still be OK to do this on the
emacs-26 branch, or is this branch now closed for such things?
The function I'm proposing adding to cc-cmds.el is "harmless", having no
interaction with the rest of CC Mode. It would look like this:
(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)))
It has been well tested by me personally.
I haven't yet decided whether or not it should get a major mode key
binding, say C-c C-m.
--
Alan Mackenzie (Nuremberg, Germany).
next reply other threads:[~2017-11-01 11:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-01 11:21 Alan Mackenzie [this message]
2017-11-01 13:27 ` Bug #29083: Is it OK to add a new function to the emacs-26 branch? Compro Prasad
2017-11-01 17:05 ` John Wiegley
2017-11-01 19:43 ` Eli Zaretskii
2017-11-01 19:56 ` John Wiegley
2017-11-02 19:24 ` Alan Mackenzie
2017-11-03 15:35 ` Stefan Monnier
2017-11-03 16:22 ` Alan Mackenzie
2017-11-03 17:04 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171101112144.GB5276@ACM \
--to=acm@muc.de \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.