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.

Filter by
Sorted by
Tagged with
13 votes
2 answers
2k views

Function to delete all comments from a buffer, without moving them to kill ring

I need to be able to remove all comments from a buffer from elisp code. For now, I am using: (goto-char (point-min)) (comment-kill (count-lines (point-min) (point-max))) However, comment-kill is an ...
T. Verron's user avatar
  • 4,243
12 votes
3 answers
1k views

How can I detect if the current character is a comment character for that major mode?

I am working on this little function that pulls up the next line to the current line. I want to add a functionality so that if the current line is a line comment and the next line is also a line ...
Kaushal Modi's user avatar
  • 25.3k
9 votes
1 answer
452 views

How comment out a variable line in a local variable list

In a python file I have # Local Variables: # python-shell-interpreter: "python3" # python-shell-virtualenv-path: "~/.virtualenvs/datascience" # leo-python-args-to-send: "-f fqanalysis.txt" # End: ...
halloleo's user avatar
  • 1,291
6 votes
1 answer
694 views

How to implement comments outline in ESS similar to that of Rstudio?

Shifting from Rstudio to ESS took some time with me because of the steep learning curve of a versatile Emacs editor, but is was a worthwhile experience. What I am still missing in ESS is that outline ...
doctorate's user avatar
  • 1,799
1 vote
1 answer
71 views

Using a sub-expression for `highlight-regexp`

I have made a face to highlight elisp comments starting with ;; [ using hi-lock. My intention is to only colour the expression [text] using SUBEXP. (highlight-regexp "^;; \\[.+\\].+$" 'face-...
Dilna's user avatar
  • 1,183
20 votes
1 answer
4k views

How to automatically create neat C comment blocks while typing?

Some code editors such as eclipse automatically form neat blocks when you start typing a multi-line comment: Is there some package or another way to do this in emacs too? Edit: To clarify: I do not ...
Geier's user avatar
  • 692
19 votes
2 answers
2k views

How to detect if the point is within a comment area?

How to detect if the point is within a comment area?
Name's user avatar
  • 7,719
7 votes
4 answers
742 views

How do I disable ffap (find file at point) when the first two non-space characters in a line are '//'?

In Verilog/C/C++, comments can begin with //. Here's an example comment, //This is a comment I like to use the find-file-at-point feature. If my cursor is on the file name in `include "some_file.v"....
Kaushal Modi's user avatar
  • 25.3k
5 votes
0 answers
424 views

How to setup comment-start and comment-start-skip?

Haskell has line comments starting with -- and multiline comments of the form {- ... -}. I'd like to make auto-fill-mode work for both of those. Currently line comments are auto-filled correctly: -- ...
Gracjan Polak's user avatar
3 votes
1 answer
277 views

How to prettify symbols inside comments?

I'm using prettify-symbol mode together with Pragmata Pro.el. Ligatures work perfectly fine in the source code but for some reason with comments they don't. I think I'm missing something since it's ...
FieryCod's user avatar
  • 167
2 votes
1 answer
70 views

Are comment style flags insufficient to separate SQL comments?

I am trying to understand why SQL mode accepts -* as a comment block start. In sql.el, I read: (defvar sql-mode-syntax-table (let ((table (make-syntax-table))) ;; C-style comments /**/ ... ...
Michel de Ruiter's user avatar
2 votes
0 answers
125 views

org-fill-paragraph leaves a comma at end of C style comment

In a src block when there is a C style comment /* ... */ doing an org-fill-paragraph would always put a comma just before the last star, like this: /* Some comment ,*/ Is there a way to stop it from ...
SFbay007's user avatar
  • 554
1 vote
1 answer
315 views

setting comment face in major mode on multi-line word-delimited comments

I am working on a major mode for an input file format I am interested in and want to set multi-line comments with the delimiters skip and noskip like skip larb noskip or skip GRID TYPE ...
Kris Kuhlman's user avatar
1 vote
1 answer
103 views

Complex comment-start (and end) sequence

As far as I understand there is syntax flags only for comment delimiters made up of two characters but if I have comment delimiters of length greater than two characters is it possible to change ...
vonaka's user avatar
  • 171
1 vote
0 answers
122 views

Doxygen style for c-doc-comment-style? [duplicate]

The option c-doc-comment-style supports javadoc, autodoc and gtkdoc. Is there a way to get doxygen support? (\returns, \note, \brief... etc)
ideasman42's user avatar
  • 8,406
1 vote
0 answers
67 views

Why does sql-mode think -* starts a block comment?

While typing in a SQL mode buffer, I noticed that -* starts a block comment. Why? It happens whenever I type an asterisk/star character (ASCII 42) directly after a simple dash/hyphen/minus character (...
Michel de Ruiter's user avatar
1 vote
1 answer
84 views

After setting syntax-propertize-function, comment is not being fontified with comment face

I'm trying to build a major mode for xwiki, where I'm defining {{{ verbatim }}} as a comment. So far, I've done (eval-when-compile (defconst xwiki-syntax-propertize-rules (syntax-...
ackerleytng's user avatar
0 votes
1 answer
312 views

How to align "end of line comments" in sh-mode?

I moved to column 60 of the first line and evaluated set-comment-column. Then I moved to the second column and called indent-for-comment, but it indents the comment randomly but not at column 60. How ...
ceving's user avatar
  • 1,308