Package: emacs;
Reported by: "Geyslan G. Bem" <geyslan <at> gmail.com>
Date: Thu, 14 Jan 2016 01:53:02 UTC
Severity: wishlist
Found in version 24.5
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22369 in the body.
You can then email your comments to 22369 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
View this report as an mbox folder, status mbox, maintainer mbox
bug-gnu-emacs <at> gnu.org
:bug#22369
; Package emacs
.
(Thu, 14 Jan 2016 01:53:02 GMT) Full text and rfc822 format available."Geyslan G. Bem" <geyslan <at> gmail.com>
:bug-gnu-emacs <at> gnu.org
.
(Thu, 14 Jan 2016 01:53:02 GMT) Full text and rfc822 format available.Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
From: "Geyslan G. Bem" <geyslan <at> gmail.com> To: bug-gnu-emacs <at> gnu.org Subject: 24.5; comment-style 'extra-line' doesn't correctly indent with tabs Date: Wed, 13 Jan 2016 22:44:52 -0300
(setq c-basic-offset 8 tab-width 8 indent-tabs-mode t comment-style 'extra-line) (c-set-style "linux") Using the above settings the comment-dwim (with region active) indent the second and last lines with spaces instead of tabs. /* * void main() * { * int i; * int b; * printf("format string"); * } */ For better comprehension check out this http://stackoverflow.com/questions/34710840/c-comment-in-emacs-linux-kernel-style-v2 May I suggest the addition of a new comment-style option that does like this? /* void main() * { * int i; * int b; * printf("format string"); * } */ In GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.6) of 2015-09-09 on foutrelis Windowing system distributor `The X.Org Foundation', version 11.0.11800000 System Description: Arch Linux Configured using: `configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib --localstatedir=/var --with-x-toolkit=gtk3 --with-xft 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4' CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro' Important settings: value of $LC_CTYPE: pt_BR.UTF-8 value of $LC_MONETARY: pt_BR.UTF-8 value of $LC_NUMERIC: pt_BR.UTF-8 value of $LC_TIME: pt_BR.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Emacs-Lisp Minor modes in effect: tooltip-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent messages: Load-path shadows: /home/geyslan/.emacs.d/elpa/helm-20151106.2158/helm-multi-match hides /home/geyslan/.emacs.d/elpa/helm-core-20151104.0/helm-multi-match Features: (shadow sort gnus-util mail-extr emacsbug message idna format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils jka-compr find-func help-fns sregex re-builder debug tabify cc-langs cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs help-mode go-mode-autoloads info easymenu package epg-config edmacro kmacro cl-loaddefs cl-lib time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind gfilenotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) Memory information: ((conses 16 132515 7051) (symbols 48 21866 0) (miscs 40 226 747) (strings 32 23818 4361) (string-bytes 1 883190) (vectors 16 12839) (vector-slots 8 428611 6669) (floats 8 75 442) (intervals 56 799 191) (buffers 960 17) (heap 1024 45432 1517))
bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org
:bug#22369
; Package emacs,cc-mode
.
(Fri, 15 Jan 2016 11:57:01 GMT) Full text and rfc822 format available.Message #8 received at 22369 <at> debbugs.gnu.org (full text, mbox):
From: Alan Mackenzie <acm <at> muc.de> To: "Geyslan G. Bem" <geyslan <at> gmail.com> Cc: 22369 <at> debbugs.gnu.org Subject: Re: bug#22369: 24.5; comment-style 'extra-line' doesn't correctly indent with tabs Date: 15 Jan 2016 11:56:28 -0000
Hello, Geyslan. In article <mailman.2326.1452736388.843.bug-gnu-emacs <at> gnu.org> you wrote: > (setq c-basic-offset 8 > tab-width 8 > indent-tabs-mode t > comment-style 'extra-line) > (c-set-style "linux") > Using the above settings the comment-dwim (with region active) indent > the second and last lines with spaces instead of tabs. > /* > * void main() > * { > * int i; > * int b; > * printf("format string"); > * } > */ Yes. Thanks for taking the trouble to report this. The following patch should fix this bug. After applying the patch (in .../emacs-24.5/lisp), byte-compile the file with: $ emacs -Q -batch -f batch-byte-compile newcomment.el on the command line. If you then load the file (with M-x load-file) it should then work. However, the complication is that newcomment.el is a built-in part of Emacs rather than being a file loaded at runtime. So you then have the choice of either putting "(load newcomment.elc)" into your .emacs, or rebuilding Emacs entirely (which isn't that time-consuming or difficult). To do this, in directory .../emacs-24.5, do: $ make . If there are still problems with the fix, please report these to the bug mailing list at 22369 <at> debbugs.gnu.org. > For better comprehension check out this > http://stackoverflow.com/questions/34710840/c-comment-in-emacs-linux-kernel-style-v2 > May I suggest the addition of a new comment-style option that does like this? > /* void main() > * { > * int i; > * int b; > * printf("format string"); > * } > */ OK, because of this feature request, I'll leave the bug open. This would indeed not be difficult to implement, but it'll have to be discussed on the developers' mailing list. > In GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.6) > of 2015-09-09 on foutrelis > Windowing system distributor `The X.Org Foundation', version 11.0.11800000 > System Description: Arch Linux [ .... ] Here's the patch: --- newcomment.el~ 2015-04-02 07:23:06.000000000 +0000 +++ newcomment.el 2016-01-15 11:41:24.912588709 +0000 @@ -969,6 +969,14 @@ (goto-char (point-max)))))) (set-marker end nil)) +(defun comment-make-bol-ws (len) + "Make a white-space string of width LEN for use at BOL. +When `indent-tabs-mode' is non-nil, tab characters will be used." + (if (and indent-tabs-mode (> tab-width 0)) + (concat (make-string (/ len tab-width) ?\t) + (make-string (% len tab-width) ? )) + (make-string len ? ))) + (defun comment-make-extra-lines (cs ce ccs cce min-indent max-indent &optional block) "Make the leading and trailing extra lines. This is used for `extra-line' style (or `box' style if BLOCK is specified)." @@ -1004,8 +1012,8 @@ (setq cs (replace-match fill t t s))) (string-match re e) (setq ce (replace-match fill t t e)))) - (cons (concat cs "\n" (make-string min-indent ? ) ccs) - (concat cce "\n" (make-string (+ min-indent eindent) ? ) ce)))) + (cons (concat cs "\n" (comment-make-bol-ws min-indent) ccs) + (concat cce "\n" (comment-make-bol-ws (+ min-indent eindent)) ce)))) (defmacro comment-with-narrowing (beg end &rest body) "Execute BODY with BEG..END narrowing. -- Alan Mackenzie (Nuremberg, Germany).
bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org
:bug#22369
; Package emacs,cc-mode
.
(Fri, 15 Jan 2016 12:12:02 GMT) Full text and rfc822 format available.Message #11 received at 22369 <at> debbugs.gnu.org (full text, mbox):
From: "Geyslan G. Bem" <geyslan <at> gmail.com> To: Alan Mackenzie <acm <at> muc.de> Cc: 22369 <at> debbugs.gnu.org Subject: Re: bug#22369: 24.5; comment-style 'extra-line' doesn't correctly indent with tabs Date: Fri, 15 Jan 2016 09:11:00 -0300
2016-01-15 8:56 GMT-03:00 Alan Mackenzie <acm <at> muc.de>: > Hello, Geyslan. > > In article <mailman.2326.1452736388.843.bug-gnu-emacs <at> gnu.org> you wrote: >> (setq c-basic-offset 8 >> tab-width 8 >> indent-tabs-mode t >> comment-style 'extra-line) >> (c-set-style "linux") > >> Using the above settings the comment-dwim (with region active) indent >> the second and last lines with spaces instead of tabs. > >> /* >> * void main() >> * { >> * int i; >> * int b; >> * printf("format string"); >> * } >> */ > > Yes. Thanks for taking the trouble to report this. The following patch > should fix this bug. After applying the patch (in .../emacs-24.5/lisp), > byte-compile the file with: > > $ emacs -Q -batch -f batch-byte-compile newcomment.el > > on the command line. If you then load the file (with M-x load-file) it > should then work. > > However, the complication is that newcomment.el is a built-in part of > Emacs rather than being a file loaded at runtime. So you then have the > choice of either putting "(load newcomment.elc)" into your .emacs, or > rebuilding Emacs entirely (which isn't that time-consuming or difficult). > To do this, in directory .../emacs-24.5, do: > > $ make > You're welcome and thank you for patching. > . > > If there are still problems with the fix, please report these to the bug > mailing list at 22369 <at> debbugs.gnu.org. > >> For better comprehension check out this >> http://stackoverflow.com/questions/34710840/c-comment-in-emacs-linux-kernel-style-v2 > >> May I suggest the addition of a new comment-style option that does like this? > >> /* void main() >> * { >> * int i; >> * int b; >> * printf("format string"); >> * } >> */ > > OK, because of this feature request, I'll leave the bug open. This would > indeed not be difficult to implement, but it'll have to be discussed on > the developers' mailing list. Ok, I think that would be great have extra-lines (as it already is) and the suggested option named extra-bottom-line. > >> In GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.6) >> of 2015-09-09 on foutrelis >> Windowing system distributor `The X.Org Foundation', version 11.0.11800000 >> System Description: Arch Linux > > [ .... ] > > Here's the patch: I'll test later. Thank you so much again. > > > --- newcomment.el~ 2015-04-02 07:23:06.000000000 +0000 > +++ newcomment.el 2016-01-15 11:41:24.912588709 +0000 > @@ -969,6 +969,14 @@ > (goto-char (point-max)))))) > (set-marker end nil)) > > +(defun comment-make-bol-ws (len) > + "Make a white-space string of width LEN for use at BOL. > +When `indent-tabs-mode' is non-nil, tab characters will be used." > + (if (and indent-tabs-mode (> tab-width 0)) > + (concat (make-string (/ len tab-width) ?\t) > + (make-string (% len tab-width) ? )) > + (make-string len ? ))) > + > (defun comment-make-extra-lines (cs ce ccs cce min-indent max-indent &optional block) > "Make the leading and trailing extra lines. > This is used for `extra-line' style (or `box' style if BLOCK is specified)." > @@ -1004,8 +1012,8 @@ > (setq cs (replace-match fill t t s))) > (string-match re e) > (setq ce (replace-match fill t t e)))) > - (cons (concat cs "\n" (make-string min-indent ? ) ccs) > - (concat cce "\n" (make-string (+ min-indent eindent) ? ) ce)))) > + (cons (concat cs "\n" (comment-make-bol-ws min-indent) ccs) > + (concat cce "\n" (comment-make-bol-ws (+ min-indent eindent)) ce)))) > > (defmacro comment-with-narrowing (beg end &rest body) > "Execute BODY with BEG..END narrowing. > > > -- > Alan Mackenzie (Nuremberg, Germany). > -- Regards, Geyslan G. Bem hackingbits.com
bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org
:bug#22369
; Package emacs,cc-mode
.
(Fri, 15 Jan 2016 12:43:02 GMT) Full text and rfc822 format available.Message #14 received at 22369 <at> debbugs.gnu.org (full text, mbox):
From: Alan Mackenzie <acm <at> muc.de> To: 22369 <at> debbugs.gnu.org Cc: "Geyslan G. Bem" <geyslan <at> gmail.com> Subject: Re: bug#22369: 24.5; comment-style 'extra-line' doesn't correctly indent with tabs Date: 15 Jan 2016 12:42:31 -0000
Bug fixed in emacs-25 branch. Bug report left open, due to a feature request in it. -- Alan Mackenzie (Nuremberg, Germany). In article <mailman.2326.1452736388.843.bug-gnu-emacs <at> gnu.org> you wrote: > (setq c-basic-offset 8 > tab-width 8 > indent-tabs-mode t > comment-style 'extra-line) > (c-set-style "linux") > Using the above settings the comment-dwim (with region active) indent > the second and last lines with spaces instead of tabs. > /* > * void main() > * { > * int i; > * int b; > * printf("format string"); > * } > */ > For better comprehension check out this > http://stackoverflow.com/questions/34710840/c-comment-in-emacs-linux-kernel-style-v2 > May I suggest the addition of a new comment-style option that does like this? > /* void main() > * { > * int i; > * int b; > * printf("format string"); > * } > */ > In GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.6) > of 2015-09-09 on foutrelis > Windowing system distributor `The X.Org Foundation', version 11.0.11800000 > System Description: Arch Linux > Configured using: > `configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib > --localstatedir=/var --with-x-toolkit=gtk3 --with-xft > 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong > --param=ssp-buffer-size=4' CPPFLAGS=-D_FORTIFY_SOURCE=2 > LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro' > Important settings: > value of $LC_CTYPE: pt_BR.UTF-8 > value of $LC_MONETARY: pt_BR.UTF-8 > value of $LC_NUMERIC: pt_BR.UTF-8 > value of $LC_TIME: pt_BR.UTF-8 > value of $LANG: en_US.UTF-8 > value of $XMODIFIERS: @im=ibus > locale-coding-system: utf-8-unix > Major mode: Emacs-Lisp > Minor modes in effect: > tooltip-mode: t > electric-indent-mode: t > mouse-wheel-mode: t > tool-bar-mode: t > menu-bar-mode: t > file-name-shadow-mode: t > global-font-lock-mode: t > font-lock-mode: t > blink-cursor-mode: t > auto-composition-mode: t > auto-encryption-mode: t > auto-compression-mode: t > line-number-mode: t > transient-mark-mode: t > Recent messages: > Load-path shadows: > /home/geyslan/.emacs.d/elpa/helm-20151106.2158/helm-multi-match hides > /home/geyslan/.emacs.d/elpa/helm-core-20151104.0/helm-multi-match > Features: > (shadow sort gnus-util mail-extr emacsbug message idna format-spec > rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 > mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums > mm-util mail-prsvr mail-utils jka-compr find-func help-fns sregex > re-builder debug tabify cc-langs cc-mode cc-fonts cc-guess cc-menus > cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs help-mode > go-mode-autoloads info easymenu package epg-config edmacro kmacro > cl-loaddefs cl-lib time-date tooltip electric uniquify ediff-hook > vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image > regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register > page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock > font-lock syntax facemenu font-core frame cham georgian utf-8-lang > misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew > greek romanian slovak czech european ethiopic indian cyrillic chinese > case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice > loaddefs button faces cus-face macroexp files text-properties overlay > sha1 md5 base64 format env code-pages mule custom widget > hashtable-print-readable backquote make-network-process dbusbind > gfilenotify dynamic-setting system-font-setting font-render-setting > move-toolbar gtk x-toolkit x multi-tty emacs) > Memory information: > ((conses 16 132515 7051) > (symbols 48 21866 0) > (miscs 40 226 747) > (strings 32 23818 4361) > (string-bytes 1 883190) > (vectors 16 12839) > (vector-slots 8 428611 6669) > (floats 8 75 442) > (intervals 56 799 191) > (buffers 960 17) > (heap 1024 45432 1517))
bug-gnu-emacs <at> gnu.org
:bug#22369
; Package emacs
.
(Fri, 15 Jan 2016 22:01:02 GMT) Full text and rfc822 format available.Message #17 received at 22369 <at> debbugs.gnu.org (full text, mbox):
From: "Geyslan G. Bem" <geyslan <at> gmail.com> To: Alan Mackenzie <acm <at> muc.de> Cc: 22369 <at> debbugs.gnu.org Subject: Re: bug#22369: 24.5; comment-style 'extra-line' doesn't correctly indent with tabs Date: Fri, 15 Jan 2016 18:59:59 -0300
2016-01-15 9:42 GMT-03:00 Alan Mackenzie <acm <at> muc.de>: > Bug fixed in emacs-25 branch. Alan, tested and it's ok. Thank you. I realized now that comment-dwim leaves a trailing space in the first line of the comment ( /* extra-line). This space isn't needed by c-indent-new-comment-line (M-j), so I think that it could be an issue too, since it's deliberately doing that. > > Bug report left open, due to a feature request in it. > > -- > Alan Mackenzie (Nuremberg, Germany). > > > In article <mailman.2326.1452736388.843.bug-gnu-emacs <at> gnu.org> you wrote: >> (setq c-basic-offset 8 >> tab-width 8 >> indent-tabs-mode t >> comment-style 'extra-line) >> (c-set-style "linux") > >> Using the above settings the comment-dwim (with region active) indent >> the second and last lines with spaces instead of tabs. > >> /* >> * void main() >> * { >> * int i; >> * int b; >> * printf("format string"); >> * } >> */ > >> For better comprehension check out this >> http://stackoverflow.com/questions/34710840/c-comment-in-emacs-linux-kernel-style-v2 > >> May I suggest the addition of a new comment-style option that does like this? > >> /* void main() >> * { >> * int i; >> * int b; >> * printf("format string"); >> * } >> */ > > > >> In GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.6) >> of 2015-09-09 on foutrelis >> Windowing system distributor `The X.Org Foundation', version 11.0.11800000 >> System Description: Arch Linux > >> Configured using: >> `configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib >> --localstatedir=/var --with-x-toolkit=gtk3 --with-xft >> 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong >> --param=ssp-buffer-size=4' CPPFLAGS=-D_FORTIFY_SOURCE=2 >> LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro' > >> Important settings: >> value of $LC_CTYPE: pt_BR.UTF-8 >> value of $LC_MONETARY: pt_BR.UTF-8 >> value of $LC_NUMERIC: pt_BR.UTF-8 >> value of $LC_TIME: pt_BR.UTF-8 >> value of $LANG: en_US.UTF-8 >> value of $XMODIFIERS: @im=ibus >> locale-coding-system: utf-8-unix > >> Major mode: Emacs-Lisp > >> Minor modes in effect: >> tooltip-mode: t >> electric-indent-mode: t >> mouse-wheel-mode: t >> tool-bar-mode: t >> menu-bar-mode: t >> file-name-shadow-mode: t >> global-font-lock-mode: t >> font-lock-mode: t >> blink-cursor-mode: t >> auto-composition-mode: t >> auto-encryption-mode: t >> auto-compression-mode: t >> line-number-mode: t >> transient-mark-mode: t > >> Recent messages: > > >> Load-path shadows: >> /home/geyslan/.emacs.d/elpa/helm-20151106.2158/helm-multi-match hides >> /home/geyslan/.emacs.d/elpa/helm-core-20151104.0/helm-multi-match > >> Features: >> (shadow sort gnus-util mail-extr emacsbug message idna format-spec >> rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 >> mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums >> mm-util mail-prsvr mail-utils jka-compr find-func help-fns sregex >> re-builder debug tabify cc-langs cc-mode cc-fonts cc-guess cc-menus >> cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs help-mode >> go-mode-autoloads info easymenu package epg-config edmacro kmacro >> cl-loaddefs cl-lib time-date tooltip electric uniquify ediff-hook >> vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image >> regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register >> page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock >> font-lock syntax facemenu font-core frame cham georgian utf-8-lang >> misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew >> greek romanian slovak czech european ethiopic indian cyrillic chinese >> case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice >> loaddefs button faces cus-face macroexp files text-properties overlay >> sha1 md5 base64 format env code-pages mule custom widget >> hashtable-print-readable backquote make-network-process dbusbind >> gfilenotify dynamic-setting system-font-setting font-render-setting >> move-toolbar gtk x-toolkit x multi-tty emacs) > >> Memory information: >> ((conses 16 132515 7051) >> (symbols 48 21866 0) >> (miscs 40 226 747) >> (strings 32 23818 4361) >> (string-bytes 1 883190) >> (vectors 16 12839) >> (vector-slots 8 428611 6669) >> (floats 8 75 442) >> (intervals 56 799 191) >> (buffers 960 17) >> (heap 1024 45432 1517)) > > > -- Regards, Geyslan G. Bem hackingbits.com
bug-gnu-emacs <at> gnu.org
:bug#22369
; Package emacs
.
(Mon, 18 Jan 2016 11:15:02 GMT) Full text and rfc822 format available.Message #20 received at 22369 <at> debbugs.gnu.org (full text, mbox):
From: "Geyslan G. Bem" <geyslan <at> gmail.com> To: Alan Mackenzie <acm <at> muc.de>, 22369 <at> debbugs.gnu.org Subject: Re: bug#22369: 24.5; comment-style 'extra-line' doesn't correctly indent with tabs Date: Mon, 18 Jan 2016 08:14:24 -0300
2016-01-16 10:22 GMT-03:00 Geyslan G. Bem <geyslan <at> gmail.com>: > > On 15 Jan 2016 18:59, "Geyslan G. Bem" <geyslan <at> gmail.com> wrote: >> >> 2016-01-15 9:42 GMT-03:00 Alan Mackenzie <acm <at> muc.de>: >> > Bug fixed in emacs-25 branch. >> >> Alan, tested and it's ok. Thank you. >> >> I realized now that comment-dwim leaves a trailing space in the first >> line of the comment ( /* extra-line). > > Actually this space is on all empty lines. I managed it for my C style (/*, * and */) using (save-excursion ;; Cleaning only trailing spaces inserted by comment-region. ;; Existing ones are not touched. (replace-regexp "\\(/+\\|^\\s-+\\)\\(\\*\\)\\(\\s-+$\\)" "\\1\\2" nil beg end)) Maybe an optional parameter (trim-trailing-spaces) would be a good call for comment-region function. > >> This space isn't needed by >> c-indent-new-comment-line (M-j), so I think that it could be an issue >> too, since it's deliberately doing that. >> >> > >> > Bug report left open, due to a feature request in it. >> > >> > -- >> > Alan Mackenzie (Nuremberg, Germany). >> > >> > >> > In article <mailman.2326.1452736388.843.bug-gnu-emacs <at> gnu.org> you >> > wrote: >> >> (setq c-basic-offset 8 >> >> tab-width 8 >> >> indent-tabs-mode t >> >> comment-style 'extra-line) >> >> (c-set-style "linux") >> > >> >> Using the above settings the comment-dwim (with region active) indent >> >> the second and last lines with spaces instead of tabs. >> > >> >> /* >> >> * void main() >> >> * { >> >> * int i; >> >> * int b; >> >> * printf("format string"); >> >> * } >> >> */ >> > >> >> For better comprehension check out this >> >> >> >> http://stackoverflow.com/questions/34710840/c-comment-in-emacs-linux-kernel-style-v2 >> > >> >> May I suggest the addition of a new comment-style option that does like >> >> this? >> > >> >> /* void main() >> >> * { >> >> * int i; >> >> * int b; >> >> * printf("format string"); >> >> * } >> >> */ >> > >> > >> > >> >> In GNU Emacs 24.5.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.16.6) >> >> of 2015-09-09 on foutrelis >> >> Windowing system distributor `The X.Org Foundation', version >> >> 11.0.11800000 >> >> System Description: Arch Linux >> > >> >> Configured using: >> >> `configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib >> >> --localstatedir=/var --with-x-toolkit=gtk3 --with-xft >> >> 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe >> >> -fstack-protector-strong >> >> --param=ssp-buffer-size=4' CPPFLAGS=-D_FORTIFY_SOURCE=2 >> >> LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro' >> > >> >> Important settings: >> >> value of $LC_CTYPE: pt_BR.UTF-8 >> >> value of $LC_MONETARY: pt_BR.UTF-8 >> >> value of $LC_NUMERIC: pt_BR.UTF-8 >> >> value of $LC_TIME: pt_BR.UTF-8 >> >> value of $LANG: en_US.UTF-8 >> >> value of $XMODIFIERS: @im=ibus >> >> locale-coding-system: utf-8-unix >> > >> >> Major mode: Emacs-Lisp >> > >> >> Minor modes in effect: >> >> tooltip-mode: t >> >> electric-indent-mode: t >> >> mouse-wheel-mode: t >> >> tool-bar-mode: t >> >> menu-bar-mode: t >> >> file-name-shadow-mode: t >> >> global-font-lock-mode: t >> >> font-lock-mode: t >> >> blink-cursor-mode: t >> >> auto-composition-mode: t >> >> auto-encryption-mode: t >> >> auto-compression-mode: t >> >> line-number-mode: t >> >> transient-mark-mode: t >> > >> >> Recent messages: >> > >> > >> >> Load-path shadows: >> >> /home/geyslan/.emacs.d/elpa/helm-20151106.2158/helm-multi-match hides >> >> /home/geyslan/.emacs.d/elpa/helm-core-20151104.0/helm-multi-match >> > >> >> Features: >> >> (shadow sort gnus-util mail-extr emacsbug message idna format-spec >> >> rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 >> >> mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums >> >> mm-util mail-prsvr mail-utils jka-compr find-func help-fns sregex >> >> re-builder debug tabify cc-langs cc-mode cc-fonts cc-guess cc-menus >> >> cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs help-mode >> >> go-mode-autoloads info easymenu package epg-config edmacro kmacro >> >> cl-loaddefs cl-lib time-date tooltip electric uniquify ediff-hook >> >> vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image >> >> regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode >> >> register >> >> page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock >> >> font-lock syntax facemenu font-core frame cham georgian utf-8-lang >> >> misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew >> >> greek romanian slovak czech european ethiopic indian cyrillic chinese >> >> case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice >> >> loaddefs button faces cus-face macroexp files text-properties overlay >> >> sha1 md5 base64 format env code-pages mule custom widget >> >> hashtable-print-readable backquote make-network-process dbusbind >> >> gfilenotify dynamic-setting system-font-setting font-render-setting >> >> move-toolbar gtk x-toolkit x multi-tty emacs) >> > >> >> Memory information: >> >> ((conses 16 132515 7051) >> >> (symbols 48 21866 0) >> >> (miscs 40 226 747) >> >> (strings 32 23818 4361) >> >> (string-bytes 1 883190) >> >> (vectors 16 12839) >> >> (vector-slots 8 428611 6669) >> >> (floats 8 75 442) >> >> (intervals 56 799 191) >> >> (buffers 960 17) >> >> (heap 1024 45432 1517)) >> > >> > >> > >> >> >> >> -- >> Regards, >> >> Geyslan G. Bem >> hackingbits.com -- Regards, Geyslan G. Bem hackingbits.com
bug-gnu-emacs <at> gnu.org
:bug#22369
; Package emacs
.
(Thu, 17 Sep 2020 17:39:02 GMT) Full text and rfc822 format available.Message #23 received at 22369 <at> debbugs.gnu.org (full text, mbox):
From: Lars Ingebrigtsen <larsi <at> gnus.org> To: Alan Mackenzie <acm <at> muc.de> Cc: "Geyslan G. Bem" <geyslan <at> gmail.com>, 22369 <at> debbugs.gnu.org Subject: Re: bug#22369: 24.5; comment-style 'extra-line' doesn't correctly indent with tabs Date: Thu, 17 Sep 2020 19:38:33 +0200
Alan Mackenzie <acm <at> muc.de> writes: >> May I suggest the addition of a new comment-style option that does like this? > >> /* void main() >> * { >> * int i; >> * int b; >> * printf("format string"); >> * } >> */ > > OK, because of this feature request, I'll leave the bug open. This would > indeed not be difficult to implement, but it'll have to be discussed on > the developers' mailing list. Was this ever discussed any further? It looks a bit odd to me... -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no
bug-gnu-emacs <at> gnu.org
:bug#22369
; Package emacs
.
(Thu, 17 Sep 2020 19:22:02 GMT) Full text and rfc822 format available.Message #26 received at 22369 <at> debbugs.gnu.org (full text, mbox):
From: Alan Mackenzie <acm <at> muc.de> To: Lars Ingebrigtsen <larsi <at> gnus.org> Cc: "Geyslan G. Bem" <geyslan <at> gmail.com>, 22369 <at> debbugs.gnu.org Subject: Re: bug#22369: 24.5; comment-style 'extra-line' doesn't correctly indent with tabs Date: Thu, 17 Sep 2020 19:21:38 +0000
Hello, Lars and Geyslan. On Thu, Sep 17, 2020 at 19:38:33 +0200, Lars Ingebrigtsen wrote: > Alan Mackenzie <acm <at> muc.de> writes: > >> May I suggest the addition of a new comment-style option that does like this? > >> /* void main() > >> * { > >> * int i; > >> * int b; > >> * printf("format string"); > >> * } > >> */ > > OK, because of this feature request, I'll leave the bug open. This would > > indeed not be difficult to implement, but it'll have to be discussed on > > the developers' mailing list. > Was this ever discussed any further? It looks a bit odd to me... I don't think there was any more discussion about this. To be exact, the feature request was to have another option for comment-style called something like bottom-extra which would add an extra comment line at the bottom of a group, but not one at the top. Four years on, I'm not convinced the feature is worth implementing, even if it wouldn't be difficult. It would involve extending the spec of comment-styles such that each entry would have EXTRA-TOP and EXTRA-BOTTOM in place of the current EXTRA. Backward compatibility could be had at the cost of counting the number of elements in each entry. One quirk the OP, Geyslan, pointed out was a possibly obtrusive space when an empty line gets commented in comment-style extra-line, something like: /* * foo(); * <=========== possibly obtrusive space. * bar(); */ I'm not sure whether or not this is a bug or a feature. If a bug, it wouldn't be difficult to fix. Geyslan, have you any more thoughts about this bug? > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no -- Alan Mackenzie (Nuremberg, Germany).
bug-gnu-emacs <at> gnu.org
:bug#22369
; Package emacs
.
(Sat, 29 Jan 2022 17:02:01 GMT) Full text and rfc822 format available.Message #29 received at 22369 <at> debbugs.gnu.org (full text, mbox):
From: Lars Ingebrigtsen <larsi <at> gnus.org> To: Alan Mackenzie <acm <at> muc.de> Cc: "Geyslan G. Bem" <geyslan <at> gmail.com>, 22369 <at> debbugs.gnu.org Subject: Re: bug#22369: 24.5; comment-style 'extra-line' doesn't correctly indent with tabs Date: Sat, 29 Jan 2022 18:01:14 +0100
Alan Mackenzie <acm <at> muc.de> writes: > I'm not sure whether or not this is a bug or a feature. If a bug, it > wouldn't be difficult to fix. > > Geyslan, have you any more thoughts about this bug? This was a year ago, and there weren't any further input here, so I'm guessing we're going with "it's a feature", and I'm therefore closing this bug report. (If there's something here that should be fixed, please respond to the debbugs address and we'll reopen.) -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no
Lars Ingebrigtsen <larsi <at> gnus.org>
to control <at> debbugs.gnu.org
.
(Sat, 29 Jan 2022 17:02:02 GMT) Full text and rfc822 format available.Debbugs Internal Request <help-debbugs <at> gnu.org>
to internal_control <at> debbugs.gnu.org
.
(Sun, 27 Feb 2022 12:24:06 GMT) Full text and rfc822 format available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.