Questions tagged [comment]
is for distinguishing comment lines from code. Emacs uses the same key bindings for manipulating comments in different modes. Emacs handles all the different ways of inserting comments for each of the major modes. Use additional tags to indicate language-specific modes for questions about comments.
145
questions
0
votes
0
answers
33
views
Different styles of comments in emacs mode
I'm working on the integrating Proof General(PG) into a proof assistant, but I have difficulty in configuration of comments. I have different settings for single-line comments and multi-line comments ...
0
votes
1
answer
86
views
Comment or uncomment a single line in Emacs
I'd like to have an emacs-lisp function that comments or uncomments the line the cursor is on.
At the very least, it needs to work in latex-mode and emacs-lisp-mode, as well as in org-mode inside ...
1
vote
1
answer
38
views
How to apply different whitespace settings for different buffer portions?
Does the minor mode whitespace library provide any way to apply different settings to different portions of the same buffer? For example, I might like to highlight `TAB characters in a comment block, ...
2
votes
1
answer
185
views
How to comment from the start of the line in makefile-mode?
If one highlights a tab-indented line in makefile-mode and runs a comment function (eg. comment-dwim, comment-line, comment-region, etc.), the comment symbol (#) is inserted after the initial tab, ...
0
votes
1
answer
29
views
Define new comment style with string literals rather than characters
I am trying to define another comment style, similar to what we can do with modify-syntax-entry:
(modify-syntax-entry ?/ ". 124b")
(modify-syntax-entry ?* ". 23")
(modify-syntax-...
1
vote
2
answers
74
views
Using different line length for comment blocks
I am setting the fill column (80) to specify the maximum width of a line before it should be automatically wrapped or broken into multiple lines.
Although this setting is useful for ensuring ...
1
vote
1
answer
80
views
How can a region matched by "string-match" be commented out with "comment-region"?
I have this code:
(when (string-match "^[ ]*\\\\usepackage{url}" (buffer-string))
(comment-region (match-beginning 0) (match-end 0)))
I tested it on these lines:
%% LaTeX file test
The ...
2
votes
0
answers
39
views
What is (setq comment-style 'aligned) supposed to do?
First let me show a few things that work correctly. I am doing everything shown below using emacs -q foo.txt in a text buffer.
I make these settings first:
(setq comment-start "<<")
(...
2
votes
1
answer
48
views
Why the number of spaces inserted by M-; is less than the number of spaces in comment-start and comment-padding?
I am using emacs -q and editing a text buffer foo.txt.
I have added the following settings:
(setq comment-start ">::")
(setq comment-padding ":::<")
Now if I select a region ...
0
votes
2
answers
219
views
How can I disable some code without commenting it out or removing it?
When I need to disable code without removing it, I comment it out. I find this clumsy, especially when the code is a function definition or some other kind of cohesive whole, such as:
(global-set-key &...
1
vote
2
answers
61
views
How to Organize Comments into a Grid on Emacs?
I see this done a lot. Don't know what it's called. Don't know how to do it.
See how the comments are all lined up?
int myNum = 5; // Integer (whole number)
float myFloatNum = 5.99f; /...
0
votes
1
answer
60
views
How to make comment-dwim comment from cursor position if its middle of the line?
I am using comment-dwim-line to comment out multiple lines. For this, I automatically move cursor always to the beginning of a line. I just want to use this behavior if the cursor is at beginning of a ...
0
votes
1
answer
33
views
Colouring different parts of a comment
I want to change the colour of substrings inside comments in a buffer. So that text enclosed by braces are coloured differently.
For the following bash comment, I want the text enclosed bf {} to be ...
3
votes
1
answer
62
views
Can you mark the end of 'compilation' in an eLisp source file?
In all of my source files, in whatever language, I use some trick or other to end compilation and then add a documentation trailer in perldoc format from which I can generate a man page. I always keep ...
0
votes
1
answer
50
views
Using general comment character used in programming languages
I am using highlight-regexp with a regexp pattern that includes the elisp comment characters ;;. How can I extend the pattern so that it adequately handle the general comment character for each ...