unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Small `c-electric-paren' fix
@ 2007-03-31 12:15 David Hansen
  2007-04-01 21:06 ` Alan Mackenzie
  2007-04-07 19:55 ` Alan Mackenzie
  0 siblings, 2 replies; 3+ messages in thread
From: David Hansen @ 2007-03-31 12:15 UTC (permalink / raw)
  To: emacs-devel; +Cc: cc-mode-help

Hello,

I've already send this to the cc-mode list some time ago (X-Post
anyway) but seems the maintainer is kinda busy.  Can someone else
please take care of it?  It's clearly a bug and the fix is pretty
short and obvious.

To reproduce:

(defun dh-c-mode-hook ()
  (push 'space-before-funcall c-cleanup-list))

(add-hook 'c-mode-hook #'dh-c-mode-hook)


Now open some .c file and type some parenthesis.  A space is
automatically inserted even if the paren is not a function call.

Fix:

Index: lisp/progmodes/cc-cmds.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/progmodes/cc-cmds.el,v
retrieving revision 1.55
diff -u -r1.55 cc-cmds.el
--- lisp/progmodes/cc-cmds.el	30 Mar 2007 20:20:35 -0000	1.55
+++ lisp/progmodes/cc-cmds.el	31 Mar 2007 09:27:03 -0000
@@ -1262,11 +1262,11 @@
 		     (backward-char)
 		     (skip-chars-backward " \t")
 		     (setq beg (point))
-		     (c-save-buffer-state () (c-on-identifier))
-		     ;; Don't add a space into #define FOO()....
-		     (not (and (c-beginning-of-macro)
-			       (c-forward-over-cpp-define-id)
-			       (eq (point) beg)))))
+		     (and (c-save-buffer-state () (c-on-identifier))
+                          ;; Don't add a space into #define FOO()....
+                          (not (and (c-beginning-of-macro)
+                                    (c-forward-over-cpp-define-id)
+                                    (eq (point) beg))))))
 	      (save-excursion
 		(delete-region beg end)
 		(goto-char beg)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-04-07 19:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-31 12:15 Small `c-electric-paren' fix David Hansen
2007-04-01 21:06 ` Alan Mackenzie
2007-04-07 19:55 ` Alan Mackenzie

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).