* Add functions to C-mode? @ 2008-04-19 11:04 saneman 2008-04-19 13:01 ` Ph. Ivaldi ` (4 more replies) 0 siblings, 5 replies; 17+ messages in thread From: saneman @ 2008-04-19 11:04 UTC (permalink / raw) To: help-gnu-emacs I would like to add/change the comment/uncomment function in the C-mode for emacs. Currently it only works when a piece of text is selected and then /* */ is inserted. I would like to change the function to just insert // even though some text might not be selected. Is that possible? ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Add functions to C-mode? 2008-04-19 11:04 Add functions to C-mode? saneman @ 2008-04-19 13:01 ` Ph. Ivaldi 2008-04-19 17:16 ` David Hansen ` (3 subsequent siblings) 4 siblings, 0 replies; 17+ messages in thread From: Ph. Ivaldi @ 2008-04-19 13:01 UTC (permalink / raw) To: help-gnu-emacs saneman wrote : > I would like to add/change the comment/uncomment function in the > C-mode for emacs. > Currently it only works when a piece of text is selected and then /* > */ is inserted. > I would like to change the function to just insert // even though some > text might not be selected. I use this code but one can certainly do better: 8<------8<------8<------8<------8<------8<------8<------8<------8<------ (defun pi-?comment () (interactive) (save-excursion (if mark-active (let ((br (region-beginning)) (be (region-end))) (comment-or-uncomment-region br be) (indent-region br be)) (let ((br (progn (back-to-indentation) (point))) (be (progn (end-of-line) (point)))) (comment-or-uncomment-region br be) (indent-according-to-mode))))) (global-set-key (kbd "C-%") 'pi-?comment) 8<------8<------8<------8<------8<------8<------8<------8<------8<------ -- Philippe Ivaldi. http://piprim.tuxfamily.org/ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Add functions to C-mode? 2008-04-19 11:04 Add functions to C-mode? saneman 2008-04-19 13:01 ` Ph. Ivaldi @ 2008-04-19 17:16 ` David Hansen [not found] ` <mailman.10583.1208625909.18990.help-gnu-emacs@gnu.org> ` (2 subsequent siblings) 4 siblings, 0 replies; 17+ messages in thread From: David Hansen @ 2008-04-19 17:16 UTC (permalink / raw) To: help-gnu-emacs On Sat, 19 Apr 2008 13:04:06 +0200 saneman wrote: > I would like to add/change the comment/uncomment function in the > C-mode for emacs. > > Currently it only works when a piece of text is selected and then /* > */ is inserted. > > I would like to change the function to just insert // even though some > text might not be selected. > > Is that possible? M-; should do just that. Well in c-mode it will insert /* */ if no region is selected and will wrap the comment delimiters if the region is active. If you insist on "//" (which is btw not ANSI C) you have to play around a bit with the `comment-start' and `comment-end' variables. Not tested: (defun cxx-comments () (set (make-local-variable comment-start) "// ") (set (make-local-variable comment-end ""))) (add-hook c-mode-hook #'cxx-comments) David ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <mailman.10583.1208625909.18990.help-gnu-emacs@gnu.org>]
* Re: Add functions to C-mode? [not found] ` <mailman.10583.1208625909.18990.help-gnu-emacs@gnu.org> @ 2008-04-19 21:08 ` Jason Rumney 2008-04-20 7:17 ` David Hansen 0 siblings, 1 reply; 17+ messages in thread From: Jason Rumney @ 2008-04-19 21:08 UTC (permalink / raw) To: help-gnu-emacs On Apr 19, 6:16 pm, David Hansen <david.han...@gmx.net> wrote: > If you insist on "//" (which is btw not ANSI C) Single line comments starting with // are part of the current ANSI and ISO standard (C99) . ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Add functions to C-mode? 2008-04-19 21:08 ` Jason Rumney @ 2008-04-20 7:17 ` David Hansen 2008-04-20 12:26 ` Eli Zaretskii 0 siblings, 1 reply; 17+ messages in thread From: David Hansen @ 2008-04-20 7:17 UTC (permalink / raw) To: help-gnu-emacs On Sat, 19 Apr 2008 14:08:18 -0700 (PDT) Jason Rumney wrote: > On Apr 19, 6:16 pm, David Hansen <david.han...@gmx.net> wrote: > >> If you insist on "//" (which is btw not ANSI C) > > Single line comments starting with // are part of the current ANSI and > ISO standard (C99) > . AFAIK a standard w/o implementation. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Add functions to C-mode? 2008-04-20 7:17 ` David Hansen @ 2008-04-20 12:26 ` Eli Zaretskii 2008-04-20 12:42 ` David Hansen [not found] ` <mailman.10609.1208696003.18990.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 17+ messages in thread From: Eli Zaretskii @ 2008-04-20 12:26 UTC (permalink / raw) To: help-gnu-emacs > From: David Hansen <david.hansen@gmx.net> > Date: Sun, 20 Apr 2008 09:17:15 +0200 > > On Sat, 19 Apr 2008 14:08:18 -0700 (PDT) Jason Rumney wrote: > > > On Apr 19, 6:16 pm, David Hansen <david.han...@gmx.net> wrote: > > > >> If you insist on "//" (which is btw not ANSI C) > > > > Single line comments starting with // are part of the current ANSI and > > ISO standard (C99) > > . > > AFAIK a standard w/o implementation. ??? You mean GCC does not count? The below compiles without any warnings with GCC 3.4.2: $ cat tcomment.c int main (void) { int foo = 3; // C99 comment return foo; } $ gcc -std=c99 -Wall -Wextra -pedantic tcomment.c $ ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Add functions to C-mode? 2008-04-20 12:26 ` Eli Zaretskii @ 2008-04-20 12:42 ` David Hansen 2008-04-20 13:51 ` Eli Zaretskii [not found] ` <mailman.10609.1208696003.18990.help-gnu-emacs@gnu.org> 1 sibling, 1 reply; 17+ messages in thread From: David Hansen @ 2008-04-20 12:42 UTC (permalink / raw) To: help-gnu-emacs On Sun, 20 Apr 2008 15:26:08 +0300 Eli Zaretskii wrote: >> From: David Hansen <david.hansen@gmx.net> >> Date: Sun, 20 Apr 2008 09:17:15 +0200 >> >> On Sat, 19 Apr 2008 14:08:18 -0700 (PDT) Jason Rumney wrote: >> >> > On Apr 19, 6:16 pm, David Hansen <david.han...@gmx.net> wrote: >> > >> >> If you insist on "//" (which is btw not ANSI C) >> > >> > Single line comments starting with // are part of the current ANSI and >> > ISO standard (C99) >> > . >> >> AFAIK a standard w/o implementation. > > ??? You mean GCC does not count? The below compiles without any > warnings with GCC 3.4.2: > > $ cat tcomment.c > int main (void) > { > int foo = 3; // C99 comment > > return foo; > } > > $ gcc -std=c99 -Wall -Wextra -pedantic tcomment.c > $ Supporting one tiny feature doesn't make it a full implementation of C99. David ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Add functions to C-mode? 2008-04-20 12:42 ` David Hansen @ 2008-04-20 13:51 ` Eli Zaretskii 2008-04-22 9:36 ` David Hansen 0 siblings, 1 reply; 17+ messages in thread From: Eli Zaretskii @ 2008-04-20 13:51 UTC (permalink / raw) To: help-gnu-emacs > From: David Hansen <david.hansen@gmx.net> > Date: Sun, 20 Apr 2008 14:42:20 +0200 > > On Sun, 20 Apr 2008 15:26:08 +0300 Eli Zaretskii wrote: > > >> From: David Hansen <david.hansen@gmx.net> > >> Date: Sun, 20 Apr 2008 09:17:15 +0200 > >> > >> On Sat, 19 Apr 2008 14:08:18 -0700 (PDT) Jason Rumney wrote: > >> > >> > On Apr 19, 6:16 pm, David Hansen <david.han...@gmx.net> wrote: > >> > > >> >> If you insist on "//" (which is btw not ANSI C) > >> > > >> > Single line comments starting with // are part of the current ANSI and > >> > ISO standard (C99) > >> > . > >> > >> AFAIK a standard w/o implementation. > > > > ??? You mean GCC does not count? The below compiles without any > > warnings with GCC 3.4.2: > > > > $ cat tcomment.c > > int main (void) > > { > > int foo = 3; // C99 comment > > > > return foo; > > } > > > > $ gcc -std=c99 -Wall -Wextra -pedantic tcomment.c > > $ > > Supporting one tiny feature doesn't make it a full implementation of > C99. But this discussion _was_ about that one feature. ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Add functions to C-mode? 2008-04-20 13:51 ` Eli Zaretskii @ 2008-04-22 9:36 ` David Hansen 0 siblings, 0 replies; 17+ messages in thread From: David Hansen @ 2008-04-22 9:36 UTC (permalink / raw) To: help-gnu-emacs On Sun, 20 Apr 2008 16:51:43 +0300 Eli Zaretskii wrote: >> [C vs C++ comments] > > But this discussion _was_ about that one feature. For me it was about, that there is no benefit in changing c-modes comment style but only potential drawbacks. David ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <mailman.10609.1208696003.18990.help-gnu-emacs@gnu.org>]
* Re: Add functions to C-mode? [not found] ` <mailman.10609.1208696003.18990.help-gnu-emacs@gnu.org> @ 2008-04-20 13:28 ` Richard G Riley 2008-04-22 9:39 ` David Hansen 0 siblings, 1 reply; 17+ messages in thread From: Richard G Riley @ 2008-04-20 13:28 UTC (permalink / raw) To: help-gnu-emacs David Hansen <david.hansen@gmx.net> writes: > On Sun, 20 Apr 2008 15:26:08 +0300 Eli Zaretskii wrote: > >>> From: David Hansen <david.hansen@gmx.net> >>> Date: Sun, 20 Apr 2008 09:17:15 +0200 >>> >>> On Sat, 19 Apr 2008 14:08:18 -0700 (PDT) Jason Rumney wrote: >>> >>> > On Apr 19, 6:16 pm, David Hansen <david.han...@gmx.net> wrote: >>> > >>> >> If you insist on "//" (which is btw not ANSI C) >>> > >>> > Single line comments starting with // are part of the current ANSI and >>> > ISO standard (C99) >>> > . >>> >>> AFAIK a standard w/o implementation. >> >> ??? You mean GCC does not count? The below compiles without any >> warnings with GCC 3.4.2: >> >> $ cat tcomment.c >> int main (void) >> { >> int foo = 3; // C99 comment >> >> return foo; >> } >> >> $ gcc -std=c99 -Wall -Wextra -pedantic tcomment.c >> $ > > Supporting one tiny feature doesn't make it a full implementation of > C99. > > David http://gcc.gnu.org/c99status.html It's far from "one tiny feature". ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Add functions to C-mode? 2008-04-20 13:28 ` Richard G Riley @ 2008-04-22 9:39 ` David Hansen 0 siblings, 0 replies; 17+ messages in thread From: David Hansen @ 2008-04-22 9:39 UTC (permalink / raw) To: help-gnu-emacs On Sun, 20 Apr 2008 15:28:46 +0200 Richard G. Riley wrote: > David Hansen <david.hansen@gmx.net> writes: > >> Supporting one tiny feature doesn't make it a full implementation of >> C99. >> >> David > > http://gcc.gnu.org/c99status.html > > It's far from "one tiny feature". Still there is AFAIK no C99 implementation, and I think GCC is far leading here. If you want to write portable code it's better to not use C99 features or at least limit yourself as much as feasible. David ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Add functions to C-mode? 2008-04-19 11:04 Add functions to C-mode? saneman ` (2 preceding siblings ...) [not found] ` <mailman.10583.1208625909.18990.help-gnu-emacs@gnu.org> @ 2008-04-20 12:01 ` Alan Mackenzie [not found] ` <mailman.10605.1208691810.18990.help-gnu-emacs@gnu.org> 4 siblings, 0 replies; 17+ messages in thread From: Alan Mackenzie @ 2008-04-20 12:01 UTC (permalink / raw) To: saneman; +Cc: help-gnu-emacs Hi, Saneman! On Sat, Apr 19, 2008 at 01:04:06PM +0200, saneman wrote: > I would like to add/change the comment/uncomment function in the C-mode > for emacs. > Currently it only works when a piece of text is selected and then /* */ > is inserted. OK, just to check, "it" here means "M-;" (or your newly bound C-d), bound to `comment-dwim', doesn't it? I'm not sure about "selected" (I don't use delete-selection-mode and stuff like that), but the "/* */" style of comments is fixed for C. Somebody asked some while ago for a way to change this to "//", and I'm planning to add a command to CC Mode (probably C-c C-;) in the next release to toggle the commenting style. > I would like to change the function to just insert // even though some > text might not be selected. In the meantime, you could use the following workaround. M-; (or your C-d ;-) will then insert "// ". (defun sm-do-line-comments () (setq comment-start "// ") (setq comment-end "")) (add-hook 'c-mode-hook 'sm-do-line-comments) > Is that possible? Hey, what sort of a question is that? This is Emacs. :-) -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <mailman.10605.1208691810.18990.help-gnu-emacs@gnu.org>]
* Re: Add functions to C-mode? [not found] ` <mailman.10605.1208691810.18990.help-gnu-emacs@gnu.org> @ 2008-04-21 7:36 ` saneman 2008-04-21 10:51 ` Alan Mackenzie [not found] ` <mailman.10650.1208777518.18990.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 17+ messages in thread From: saneman @ 2008-04-21 7:36 UTC (permalink / raw) To: help-gnu-emacs Alan Mackenzie wrote: > Hi, Saneman! > > On Sat, Apr 19, 2008 at 01:04:06PM +0200, saneman wrote: >> I would like to add/change the comment/uncomment function in the C-mode >> for emacs. > >> Currently it only works when a piece of text is selected and then /* */ >> is inserted. > > OK, just to check, "it" here means "M-;" (or your newly bound C-d), bound > to `comment-dwim', doesn't it? > > I'm not sure about "selected" (I don't use delete-selection-mode and > stuff like that), but the "/* */" style of comments is fixed for C. > Somebody asked some while ago for a way to change this to "//", and I'm > planning to add a command to CC Mode (probably C-c C-;) in the next > release to toggle the commenting style. > >> I would like to change the function to just insert // even though some >> text might not be selected. > > In the meantime, you could use the following workaround. M-; (or your > C-d ;-) will then insert "// ". > > (defun sm-do-line-comments () > (setq comment-start "// ") > (setq comment-end "")) > (add-hook 'c-mode-hook 'sm-do-line-comments) > But I still have to select the lines that I want to comment out. If the cursor is on a line the I would like to comment out and I press C-d the // get inserted and the end of the line. Only when I select the line and then press C-d it works. Is there some way to insert // at the start of the line without first selecting it? ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Add functions to C-mode? 2008-04-21 7:36 ` saneman @ 2008-04-21 10:51 ` Alan Mackenzie [not found] ` <mailman.10650.1208777518.18990.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 17+ messages in thread From: Alan Mackenzie @ 2008-04-21 10:51 UTC (permalink / raw) To: saneman; +Cc: help-gnu-emacs Morning, Saneman On Mon, Apr 21, 2008 at 09:36:55AM +0200, saneman wrote: > Alan Mackenzie wrote: > >On Sat, Apr 19, 2008 at 01:04:06PM +0200, saneman wrote: > >>I would like to add/change the comment/uncomment function in the > >>C-mode for emacs. > >>Currently it only works when a piece of text is selected and then /* */ > >>is inserted. [ .... ] > But I still have to select the lines that I want to comment out. If the > cursor is on a line the I would like to comment out and I press C-d the > // get inserted and the end of the line. > Only when I select the line and then press C-d it works. > Is there some way to insert // at the start of the line without first > selecting it? I'm not quite sure exactly what you mean, but I don't think so (other than typing the two "/"s yourself, but that's boring). What exactly do you mean by "selecting" and why do you want to avoid this? Somehow or other, you've got to indicate to Emacs _which_ lines(s) you want commented out (even if it's only one line). "Selecting" isn't really Emacs jargon. When you drag the mouse over a buffer, the "mark" is left where you started, and point is put where you finish. The "region" is the bit between point and mark, and many commands operate on the region. There are lots of ways of setting the mark, too. C-<space> is the most basic. So, if you want to comment out lines (like all good programming standards forbid, yet everybody does ;-), make the region the pertinent lines. Then do C-c C-c (`comment-region'). If you later want to undo this, put the region round these lines again, then do C-u C-c C-c. Again, you have to "select" the lines, so I'm not quite sure exactly what you want. But the above might be good enough. -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <mailman.10650.1208777518.18990.help-gnu-emacs@gnu.org>]
* Re: Add functions to C-mode? [not found] ` <mailman.10650.1208777518.18990.help-gnu-emacs@gnu.org> @ 2008-04-21 11:49 ` Richard G Riley 2008-04-21 20:35 ` Alan Mackenzie [not found] ` <mailman.10668.1208809134.18990.help-gnu-emacs@gnu.org> 0 siblings, 2 replies; 17+ messages in thread From: Richard G Riley @ 2008-04-21 11:49 UTC (permalink / raw) To: help-gnu-emacs Alan Mackenzie <acm@muc.de> writes: > Morning, Saneman > > On Mon, Apr 21, 2008 at 09:36:55AM +0200, saneman wrote: >> Alan Mackenzie wrote: > >> >On Sat, Apr 19, 2008 at 01:04:06PM +0200, saneman wrote: >> >>I would like to add/change the comment/uncomment function in the >> >>C-mode for emacs. > >> >>Currently it only works when a piece of text is selected and then /* */ >> >>is inserted. > > [ .... ] > >> But I still have to select the lines that I want to comment out. If the >> cursor is on a line the I would like to comment out and I press C-d the >> // get inserted and the end of the line. > >> Only when I select the line and then press C-d it works. > >> Is there some way to insert // at the start of the line without first >> selecting it? > > I'm not quite sure exactly what you mean, but I don't think so (other > than typing the two "/"s yourself, but that's boring). > > What exactly do you mean by "selecting" and why do you want to avoid I would assume he means selecting the text. As one does for cut and paste. Standard region manipulation. > this? Somehow or other, you've got to indicate to Emacs _which_ lines(s) > you want commented out (even if it's only one line). > > "Selecting" isn't really Emacs jargon. When you drag the mouse over a Neither is "dragging a mouse" :-; > buffer, the "mark" is left where you started, and point is put where you > finish. The "region" is the bit between point and mark, and many > commands operate on the region. There are lots of ways of setting the > mark, too. C-<space> is the most basic. I think it would be fair to say that "selecting the text" is perfectly clear in this instance. > > So, if you want to comment out lines (like all good programming standards > forbid, yet everybody does ;-), make the region the pertinent lines. I must admit to never having heard of this - commenting out is a very common thing to do during development. > Then do C-c C-c (`comment-region'). If you later want to undo this, put > the region round these lines again, then do C-u C-c C-c. In my set up the command is comment-dwim accessed from "M-;". I guess this is part of emacs-22? ^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: Add functions to C-mode? 2008-04-21 11:49 ` Richard G Riley @ 2008-04-21 20:35 ` Alan Mackenzie [not found] ` <mailman.10668.1208809134.18990.help-gnu-emacs@gnu.org> 1 sibling, 0 replies; 17+ messages in thread From: Alan Mackenzie @ 2008-04-21 20:35 UTC (permalink / raw) To: Richard G Riley; +Cc: help-gnu-emacs Evening, Richard! On Mon, Apr 21, 2008 at 01:49:57PM +0200, Richard G Riley wrote: > Alan Mackenzie <acm@muc.de> writes: > > Morning, Saneman > > On Mon, Apr 21, 2008 at 09:36:55AM +0200, saneman wrote: > >> Alan Mackenzie wrote: > >> >>Currently it only works when a piece of text is selected and then > >> >>/* */ is inserted. > > [ .... ] > >> But I still have to select the lines that I want to comment out. If > >> the cursor is on a line the I would like to comment out and I press > >> C-d the // get inserted and the end of the line. > >> Only when I select the line and then press C-d it works. > >> Is there some way to insert // at the start of the line without > >> first selecting it? > > I'm not quite sure exactly what you mean, but I don't think so (other > > than typing the two "/"s yourself, but that's boring). > > What exactly do you mean by "selecting" and why do you want to avoid > > this? > I would assume he means selecting the text. As one does for cut and > paste. Standard region manipulation. No. "Selection" means chosing something from a range of alternatives. What is often called "selection" in editors other than emacs is actually nothing of the kind. It's usually something more like "highlighting" or "marking". The point of my question was to find out why Saneman objects to this "selecting", so as to be able to suggest something better. > > Somehow or other, you've got to indicate to Emacs _which_ lines(s) > > you want commented out (even if it's only one line). > > "Selecting" isn't really Emacs jargon. When you drag the mouse over > > a buffer, the "mark" is left where you started, and point is put > > where you finish. The "region" is the bit between point and mark, > > and many commands operate on the region. There are lots of ways of > > setting the mark, too. C-<space> is the most basic. > I think it would be fair to say that "selecting the text" is perfectly > clear in this instance. Except that it's not Emacs terminology. Also, although it's a nice difference, the region in Emacs is a portion of the buffer, not merely the text within it; it's the blackboard as well as the chalk. So talking about selecting "the text" can be confusing. > > So, if you want to comment out lines (like all good programming > > standards forbid, yet everybody does ;-), make the region the > > pertinent lines. Then do C-c C-c (`comment-region'). If you later > > want to undo this, put the region round these lines again, then do > > C-u C-c C-c. > In my set up the command is comment-dwim accessed from "M-;". I guess > this is part of emacs-22? No, that's a different command. M-; (usually) adds a comment at the end of the current line, C-c C-c comments out the code in the region. -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 17+ messages in thread
[parent not found: <mailman.10668.1208809134.18990.help-gnu-emacs@gnu.org>]
* Re: Add functions to C-mode? [not found] ` <mailman.10668.1208809134.18990.help-gnu-emacs@gnu.org> @ 2008-04-22 4:00 ` Richard G Riley 0 siblings, 0 replies; 17+ messages in thread From: Richard G Riley @ 2008-04-22 4:00 UTC (permalink / raw) To: help-gnu-emacs Alan Mackenzie <acm@muc.de> writes: > Evening, Richard! > > On Mon, Apr 21, 2008 at 01:49:57PM +0200, Richard G Riley wrote: > >> Alan Mackenzie <acm@muc.de> writes: > >> > Morning, Saneman > >> > On Mon, Apr 21, 2008 at 09:36:55AM +0200, saneman wrote: >> >> Alan Mackenzie wrote: > >> >> >>Currently it only works when a piece of text is selected and then >> >> >>/* */ is inserted. > >> > [ .... ] > >> >> But I still have to select the lines that I want to comment out. If >> >> the cursor is on a line the I would like to comment out and I press >> >> C-d the // get inserted and the end of the line. > >> >> Only when I select the line and then press C-d it works. > >> >> Is there some way to insert // at the start of the line without >> >> first selecting it? > >> > I'm not quite sure exactly what you mean, but I don't think so (other >> > than typing the two "/"s yourself, but that's boring). > >> > What exactly do you mean by "selecting" and why do you want to avoid >> > this? > >> I would assume he means selecting the text. As one does for cut and >> paste. Standard region manipulation. > > No. "Selection" means chosing something from a range of alternatives. > What is often called "selection" in editors other than emacs is actually > nothing of the kind. It's usually something more like "highlighting" or > "marking". I think my point was that in the context "selection" was fairly obvious. Possibly I am wrong. > > The point of my question was to find out why Saneman objects to this > "selecting", so as to be able to suggest something better. > >> > Somehow or other, you've got to indicate to Emacs _which_ lines(s) >> > you want commented out (even if it's only one line). > >> > "Selecting" isn't really Emacs jargon. When you drag the mouse over >> > a buffer, the "mark" is left where you started, and point is put >> > where you finish. The "region" is the bit between point and mark, >> > and many commands operate on the region. There are lots of ways of >> > setting the mark, too. C-<space> is the most basic. > >> I think it would be fair to say that "selecting the text" is perfectly >> clear in this instance. > > Except that it's not Emacs terminology. Also, although it's a nice Possibly not. But people who come to a help group are often not fluent in "emacs" or "whatever" speak. I was merely pointing out that in the context it seemed (to me) fairly clear what he meant. > difference, the region in Emacs is a portion of the buffer, not merely > the text within it; it's the blackboard as well as the chalk. So talking > about selecting "the text" can be confusing. Yes - I can kind of accept that if one were to over think it. > >> > So, if you want to comment out lines (like all good programming >> > standards forbid, yet everybody does ;-), make the region the >> > pertinent lines. Then do C-c C-c (`comment-region'). If you later >> > want to undo this, put the region round these lines again, then do >> > C-u C-c C-c. > >> In my set up the command is comment-dwim accessed from "M-;". I guess >> this is part of emacs-22? > > No, that's a different command. M-; (usually) adds a comment at the end > of the current line, C-c C-c comments out the code in the region. Not on my set up. It "does what I want" .. but that could be because of changes I have long forgotten - a common issue with rusty .emacs :-; In other words, if I select some text ( to be devils advocate with the terminology in this instance) it comments out the selected region .. ^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2008-04-22 9:39 UTC | newest] Thread overview: 17+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-04-19 11:04 Add functions to C-mode? saneman 2008-04-19 13:01 ` Ph. Ivaldi 2008-04-19 17:16 ` David Hansen [not found] ` <mailman.10583.1208625909.18990.help-gnu-emacs@gnu.org> 2008-04-19 21:08 ` Jason Rumney 2008-04-20 7:17 ` David Hansen 2008-04-20 12:26 ` Eli Zaretskii 2008-04-20 12:42 ` David Hansen 2008-04-20 13:51 ` Eli Zaretskii 2008-04-22 9:36 ` David Hansen [not found] ` <mailman.10609.1208696003.18990.help-gnu-emacs@gnu.org> 2008-04-20 13:28 ` Richard G Riley 2008-04-22 9:39 ` David Hansen 2008-04-20 12:01 ` Alan Mackenzie [not found] ` <mailman.10605.1208691810.18990.help-gnu-emacs@gnu.org> 2008-04-21 7:36 ` saneman 2008-04-21 10:51 ` Alan Mackenzie [not found] ` <mailman.10650.1208777518.18990.help-gnu-emacs@gnu.org> 2008-04-21 11:49 ` Richard G Riley 2008-04-21 20:35 ` Alan Mackenzie [not found] ` <mailman.10668.1208809134.18990.help-gnu-emacs@gnu.org> 2008-04-22 4:00 ` Richard G Riley
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).