From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel 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 Message-ID: <20171101112144.GB5276@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1509535716 16858 195.159.176.226 (1 Nov 2017 11:28:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 1 Nov 2017 11:28:36 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 01 12:28:31 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9rC9-0003hs-Q2 for ged-emacs-devel@m.gmane.org; Wed, 01 Nov 2017 12:28:29 +0100 Original-Received: from localhost ([::1]:55290 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e9rCF-0007cc-LV for ged-emacs-devel@m.gmane.org; Wed, 01 Nov 2017 07:28:35 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41874) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e9rC9-0007cX-5a for emacs-devel@gnu.org; Wed, 01 Nov 2017 07:28:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e9rC5-0005mc-71 for emacs-devel@gnu.org; Wed, 01 Nov 2017 07:28:29 -0400 Original-Received: from ocolin.muc.de ([193.149.48.4]:61954 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1e9rC5-0005jM-0f for emacs-devel@gnu.org; Wed, 01 Nov 2017 07:28:25 -0400 Original-Received: (qmail 74291 invoked by uid 3782); 1 Nov 2017 11:28:19 -0000 Original-Received: from acm.muc.de (p548C6F02.dip0.t-ipconnect.de [84.140.111.2]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 01 Nov 2017 12:28:18 +0100 Original-Received: (qmail 5938 invoked by uid 1000); 1 Nov 2017 11:21:44 -0000 Content-Disposition: inline X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:219841 Archived-At: 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).