GNU bug report logs - #26207
CC Mode 5.32.99 (C/l); add more keywords to c-macro-names-with-semicolon

Previous Next

Package: cc-mode;

Reported by: Mohammed Sadiq <sadiq <at> sadiqpk.org>

Date: Tue, 21 Mar 2017 16:48:02 UTC

Severity: normal

To reply to this bug, email your comments to 26207 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-cc-mode <at> gnu.org:
bug#26207; Package cc-mode. (Tue, 21 Mar 2017 16:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mohammed Sadiq <sadiq <at> sadiqpk.org>:
New bug report received and forwarded. Copy sent to bug-cc-mode <at> gnu.org. (Tue, 21 Mar 2017 16:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mohammed Sadiq <sadiq <at> sadiqpk.org>
To: submit <at> debbugs.gnu.org
Subject: CC Mode 5.32.99 (C/l);
 add more keywords to c-macro-names-with-semicolon
Date: Tue, 21 Mar 2017 22:17:18 +0530
Hi,

Currently the following are the values set for
`c-macro-names-with-semicolon':  ("Q_OBJECT" "Q_PROPERTY" "Q_DECLARE"
"Q_ENUMS")

The following glib (https://en.wikipedia.org/wiki/GLib) variables are
extensively used in several projects including Gtk+. So it would be nice
for those to be added too to `c-macro-names-with-semicolon':

"G_BEGIN_DECLS" "G_END_DECLS" "G_DECLARE_FINAL_TYPE"
"G_DECLARE_DERIVABLE_TYPE" "G_DECLARE_INTERFACE" "G_DEFINE_TYPE"
"G_DEFINE_TYPE_WITH_PRIVATE" "G_DEFINE_ABSTRACT_TYPE"
"G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE"

may be 'G_DEFINE_', 'G_DECLARE_', 'G_BEGIN_DECLS', and 'G_END_DECLS'
shall cover most scenarios.

Thanks

Emacs  : GNU Emacs 26.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.22.8)
 of 2017-03-21
Package: CC Mode 5.32.99 (C/l)
Buffer Style: gnu
c-emacs-features: (pps-extended-state col-0-paren posix-char-classes gen-string-delim gen-comment-delim syntax-properties 1-bit)

current state:
==============
(setq
 c-basic-offset 2
 c-comment-only-line-offset '(0 . 0)
 c-indent-comment-alist '((anchored-comment column . 0) (end-block space . 1)
			  (cpp-end-block space . 2))
 c-indent-comments-syntactically-p nil
 c-block-comment-prefix ""
 c-comment-prefix-regexp '((pike-mode . "//+!?\\|\\**") (awk-mode . "#+")
			   (other . "//+\\|\\**"))
 c-doc-comment-style '((java-mode . javadoc) (pike-mode . autodoc)
		       (c-mode . gtkdoc))
 c-cleanup-list '(scope-operator)
 c-hanging-braces-alist '((substatement-open before after)
			  (arglist-cont-nonempty))
 c-hanging-colons-alist nil
 c-hanging-semi&comma-criteria '(c-semi&comma-inside-parenlist)
 c-backslash-column 48
 c-backslash-max-column 72
 c-special-indent-hook '(c-gnu-impose-minimum)
 c-label-minimum-indentation 1
 c-offsets-alist '((inexpr-class . +)
		   (inexpr-statement . +)
		   (lambda-intro-cont . +)
		   (inlambda . c-lineup-inexpr-block)
		   (template-args-cont c-lineup-template-args +)
		   (incomposition . +)
		   (inmodule . +)
		   (innamespace . +)
		   (inextern-lang . +)
		   (composition-close . 0)
		   (module-close . 0)
		   (namespace-close . 0)
		   (extern-lang-close . 0)
		   (composition-open . 0)
		   (module-open . 0)
		   (namespace-open . 0)
		   (extern-lang-open . 0)
		   (objc-method-call-cont
		    c-lineup-ObjC-method-call-colons
		    c-lineup-ObjC-method-call
		    +
		    )
		   (objc-method-args-cont . c-lineup-ObjC-method-args)
		   (objc-method-intro . [0])
		   (friend . 0)
		   (cpp-define-intro c-lineup-cpp-define +)
		   (cpp-macro-cont . +)
		   (cpp-macro . [0])
		   (inclass . +)
		   (stream-op . c-lineup-streamop)
		   (arglist-cont-nonempty
		    c-lineup-gcc-asm-reg
		    c-lineup-arglist
		    )
		   (arglist-cont c-lineup-gcc-asm-reg 0)
		   (comment-intro
		    c-lineup-knr-region-comment
		    c-lineup-comment
		    )
		   (catch-clause . 0)
		   (else-clause . 0)
		   (do-while-closure . 0)
		   (access-label . -)
		   (case-label . 0)
		   (substatement . +)
		   (statement-case-intro . +)
		   (statement . 0)
		   (brace-entry-open . 0)
		   (brace-list-entry . c-lineup-under-anchor)
		   (brace-list-close . 0)
		   (block-close . 0)
		   (block-open . 0)
		   (inher-cont . c-lineup-multi-inher)
		   (inher-intro . +)
		   (member-init-cont . c-lineup-multi-inher)
		   (member-init-intro . +)
		   (annotation-var-cont . +)
		   (annotation-top-cont . 0)
		   (topmost-intro . 0)
		   (knr-argdecl . 0)
		   (func-decl-cont . +)
		   (inline-close . 0)
		   (class-close . 0)
		   (class-open . 0)
		   (defun-block-intro . +)
		   (defun-close . 0)
		   (defun-open . 0)
		   (c . c-lineup-C-comments)
		   (string . c-lineup-dont-change)
		   (topmost-intro-cont
		    first
		    c-lineup-topmost-intro-cont
		    c-lineup-gnu-DEFUN-intro-cont
		    )
		   (brace-list-intro . c-lineup-arglist-intro-after-paren)
		   (brace-list-open . +)
		   (inline-open . 0)
		   (arglist-close . c-lineup-arglist)
		   (arglist-intro . c-lineup-arglist-intro-after-paren)
		   (statement-cont . +)
		   (statement-case-open . +)
		   (label . 0)
		   (substatement-label . 0)
		   (substatement-open . +)
		   (knr-argdecl-intro . 5)
		   (statement-block-intro . +)
		   )
 c-buffer-is-cc-mode 'c-mode
 c-tab-always-indent t
 c-syntactic-indentation t
 c-syntactic-indentation-in-macros t
 c-ignore-auto-fill '(string cpp code)
 c-auto-align-backslashes t
 c-backspace-function 'backward-delete-char-untabify
 c-delete-function 'delete-char
 c-electric-pound-behavior nil
 c-default-style '((java-mode . "java") (awk-mode . "awk") (other . "gnu"))
 c-enable-xemacs-performance-kludge-p nil
 c-old-style-variable-behavior nil
 defun-prompt-regexp nil
 tab-width 8
 comment-column 32
 parse-sexp-ignore-comments t
 parse-sexp-lookup-properties t
 auto-fill-function nil
 comment-multi-line t
 comment-start-skip "\\(//+\\|/\\*+\\)\\s *"
 fill-prefix nil
 fill-column 70
 paragraph-start "[ 	]*\\(//+\\|\\**\\)[ 	]*$\\|^\f"
 adaptive-fill-mode t
 adaptive-fill-regexp "[ 	]*\\(//+\\|\\**\\)[ 	]*\\([ 	]*\\([-–!|#%;>*·•‣⁃◦]+[ 	]*\\)*\\)"
 )




Information forwarded to bug-cc-mode <at> gnu.org:
bug#26207; Package cc-mode. (Sat, 25 Mar 2017 10:52:02 GMT) Full text and rfc822 format available.

Message #8 received at 26207 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Mohammed Sadiq <sadiq <at> sadiqpk.org>
Cc: 26207 <at> debbugs.gnu.org
Subject: Re: bug#26207: CC Mode 5.32.99 (C/l); add more keywords to
 c-macro-names-with-semicolon
Date: Sat, 25 Mar 2017 10:51:08 +0000
Hello, Mohammed.

On Tue, Mar 21, 2017 at 22:17:18 +0530, Mohammed Sadiq wrote:

> Hi,

> Currently the following are the values set for
> `c-macro-names-with-semicolon':  ("Q_OBJECT" "Q_PROPERTY" "Q_DECLARE"
> "Q_ENUMS")

> The following glib (https://en.wikipedia.org/wiki/GLib) variables are
> extensively used in several projects including Gtk+. So it would be nice
> for those to be added too to `c-macro-names-with-semicolon':

> "G_BEGIN_DECLS" "G_END_DECLS" "G_DECLARE_FINAL_TYPE"
> "G_DECLARE_DERIVABLE_TYPE" "G_DECLARE_INTERFACE" "G_DEFINE_TYPE"
> "G_DEFINE_TYPE_WITH_PRIVATE" "G_DEFINE_ABSTRACT_TYPE"
> "G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE"

> may be 'G_DEFINE_', 'G_DECLARE_', 'G_BEGIN_DECLS', and 'G_END_DECLS'
> shall cover most scenarios.

c-macro-names-with-semicolon is a user option, a configuration variable.
The idea is, each user (or project) sets up this variable in her/his/its
.emacs, probably best done in the hook c-mode-common-hook.  So, any user
can set up all these "G_..." macros if her source code uses them.

Or have I missed something here?

> Thanks

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-cc-mode <at> gnu.org:
bug#26207; Package cc-mode. (Sat, 25 Mar 2017 12:04:02 GMT) Full text and rfc822 format available.

Message #11 received at 26207 <at> debbugs.gnu.org (full text, mbox):

From: Mohammed Sadiq <sadiq <at> sadiqpk.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 26207 <at> debbugs.gnu.org
Subject: Re: bug#26207: CC Mode 5.32.99 (C/l); add more keywords to
 c-macro-names-with-semicolon
Date: Sat, 25 Mar 2017 17:33:41 +0530 (IST)
> On March 25, 2017 at 4:21 PM Alan Mackenzie <acm <at> muc.de> wrote:
> c-macro-names-with-semicolon is a user option, a configuration variable.
> The idea is, each user (or project) sets up this variable in her/his/its
> .emacs, probably best done in the hook c-mode-common-hook.  So, any user
> can set up all these "G_..." macros if her source code uses them.
> 
> Or have I missed something here?

Hm. Probably No. But may be yes. :)

In cc-vars.el, I saw '("Q_OBJECT" "Q_PROPERTY" "Q_DECLARE" "Q_ENUMS") set in GNU 
Emacs source. I believe that they are used in Qt. 

The values I said ("G_DECLARE", "G_DEFINE",
"G_BEGIN_DECLS", "G_END_DECLS") are used extensively in GTk+ and is defined
in GLib. As those both are GNU projects, I find it right to be included in GNU Emacs by
default, especially since Qt variables are already included.

I don't know if I'm wrong to say so.

> 
> > Thanks
> 
> -- 
> Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-cc-mode <at> gnu.org:
bug#26207; Package cc-mode. (Sat, 25 Mar 2017 12:22:01 GMT) Full text and rfc822 format available.

Message #14 received at 26207 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Mohammed Sadiq <sadiq <at> sadiqpk.org>
Cc: 26207 <at> debbugs.gnu.org
Subject: Re: bug#26207: CC Mode 5.32.99 (C/l); add more keywords to
 c-macro-names-with-semicolon
Date: Sat, 25 Mar 2017 12:20:37 +0000
Hello again, Mohammed.

On Sat, Mar 25, 2017 at 17:33:41 +0530, Mohammed Sadiq wrote:

> > On March 25, 2017 at 4:21 PM Alan Mackenzie <acm <at> muc.de> wrote:
> > c-macro-names-with-semicolon is a user option, a configuration variable.
> > The idea is, each user (or project) sets up this variable in her/his/its
> > .emacs, probably best done in the hook c-mode-common-hook.  So, any user
> > can set up all these "G_..." macros if her source code uses them.

> > Or have I missed something here?

> Hm. Probably No. But may be yes. :)

> In cc-vars.el, I saw '("Q_OBJECT" "Q_PROPERTY" "Q_DECLARE" "Q_ENUMS")
> set in GNU Emacs source. I believe that they are used in Qt. 

I think so too, but it's so long ago I can't remember for sure.  ;-)

> The values I said ("G_DECLARE", "G_DEFINE", "G_BEGIN_DECLS",
> "G_END_DECLS") are used extensively in GTk+ and is defined in GLib. As
> those both are GNU projects, I find it right to be included in GNU
> Emacs by default, especially since Qt variables are already included.

> I don't know if I'm wrong to say so.

No, maybe you're right, the default (which was intended as no more than
an illustration, rather than just having a null list as default)
probably should be symbols from a GNU project.  The four you list is a
short enough list not to be unreasonable as a default.  Let me mull this
over for a while.

But another thing that concerns me is, is there anything in the doc
strings or manual, or is there anything missing, which might make it
unclear that c-macro-names-with-semicolon is meant to be a configuration
variable?
 
-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-cc-mode <at> gnu.org:
bug#26207; Package cc-mode. (Sat, 25 Mar 2017 14:45:02 GMT) Full text and rfc822 format available.

Message #17 received at 26207 <at> debbugs.gnu.org (full text, mbox):

From: Mohammed Sadiq <sadiq <at> sadiqpk.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 26207 <at> debbugs.gnu.org
Subject: Re: bug#26207: CC Mode 5.32.99 (C/l); add more keywords to
 c-macro-names-with-semicolon
Date: Sat, 25 Mar 2017 20:14:13 +0530 (IST)
> On March 25, 2017 at 5:50 PM Alan Mackenzie <acm <at> muc.de> wrote:
> <snip>
> But another thing that concerns me is, is there anything in the doc
> strings or manual, or is there anything missing, which might make it
> unclear that c-macro-names-with-semicolon is meant to be a configuration
> variable?

Some part of  the documentation of c-macro-names-with-semicolon is unclear to me:

"List of #defined symbols whose expansion ends with a semicolon..."
which may better be something like "List of #defined symbols that don't require
to be ended with a semicolon..."

Also as a note: some of the symbols I suggested have been used in GNU Emacs source
itself.

Thanks
>  
> -- 
> Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-cc-mode <at> gnu.org:
bug#26207; Package cc-mode. (Sat, 25 Mar 2017 14:56:01 GMT) Full text and rfc822 format available.

Message #20 received at 26207 <at> debbugs.gnu.org (full text, mbox):

From: Mohammed Sadiq <sadiq <at> sadiqpk.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 26207 <at> debbugs.gnu.org
Subject: Re: bug#26207: CC Mode 5.32.99 (C/l); add more keywords to
 c-macro-names-with-semicolon
Date: Sat, 25 Mar 2017 20:25:24 +0530 (IST)
By the way, it seems like "Q_DECLARE" "Q_DEFINE" etc. are strings. But
in the suggested case, G_BEGIN_DECLS and G_END_DECLS are strings
while the others are regexps like "G_DEFINE[A-Z_]*" "G_DECLARE[A-Z_]".




Information forwarded to bug-cc-mode <at> gnu.org:
bug#26207; Package cc-mode. (Sat, 25 Mar 2017 18:48:01 GMT) Full text and rfc822 format available.

Message #23 received at 26207 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Mohammed Sadiq <sadiq <at> sadiqpk.org>
Cc: 26207 <at> debbugs.gnu.org
Subject: Re: bug#26207: CC Mode 5.32.99 (C/l); add more keywords to
 c-macro-names-with-semicolon
Date: Sat, 25 Mar 2017 18:46:39 +0000
Hello, Mahammed.

On Sat, Mar 25, 2017 at 20:25:24 +0530, Mohammed Sadiq wrote:
> By the way, it seems like "Q_DECLARE" "Q_DEFINE" etc. are strings. But
> in the suggested case, G_BEGIN_DECLS and G_END_DECLS are strings
> while the others are regexps like "G_DEFINE[A-Z_]*" "G_DECLARE[A-Z_]".

I hadn't actually noticed that.  c-macro-names-with-semicolon can be
either a list of strings or a regular expression (but not a mixture of
the two ;-).

A regexp matching all four of the things above would look something
like:

    "G_\(\(BEGIN\|END\)_DECLS\|DE\(FINE\|CLARE\)[A-Z_]*\)"

(untested) (that's assuming that there should be a "*" at the end of
"G_DEECLARE[A-Z_]").  But here one must be careful - careful that there
aren't any macro names of that form which require one explicitly to
write a semicolon at their ends.

-- 
Alan Mackenzie (Nuremberg, Germany).




This bug report was last modified 8 years and 80 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.