I got an answer about C Comment in Emacs - Linux Kernel Style , which works fine, but
when comments emacs ( comment-dwim) fills the second line * long_function_name_variand last */with spaces (before the comment), and not tabs, as I configured it. How to avoid this?
comment-dwim
* long_function_name_vari
*/
And how easy is it to make a comment using this style?
/* void main() * { * int i; * int b; * printf("format string"); * } */
A custom variable is comment-styledefined in newcomment.el. ...
comment-style
(extra-line t nil t t "One comment for all lines, end on a line by itself")
...
which should deliver the desired IIUC result.
, , , , . , . .
, newcomment.el , .
newcomment.el
(defun my-c-comment-dwim (tabify delete-trailing) (interactive) (let (beg end) (if (region-active-p) (progn (setq beg (region-beginning) end (region-end)) (if (comment-only-p beg end) (uncomment-region beg end) (progn (comment-region beg end) (when (equal comment-style 'extra-line) (save-excursion (goto-char end) (forward-line 2) (setq end (line-end-position)))) (when tabify (tabify beg end)) (when delete-trailing (delete-trailing-whitespace beg end))))) (comment-indent)))) (global-set-key [remap comment-dwim] (lambda () (interactive) (my-c-comment-dwim t t)))
Source: https://habr.com/ru/post/1537215/More articles:Use Python to extract branch lengths from Newick Format - pythonAfter Effects as a backend? - javascriptCall Enum. valueOf (), which gives a warning without warning, despite the fact that T is declared > - javaC Comment in Emacs - Linux Kernel Style - commentsHow to disable events in the Kendo UI Scheduler? I just want to do it read-only - kendo-uiHaskell IO error handling during I / O operation - ioIs there a way to disable a specific event in the kendo ui scheduler? - javascriptHow to call Parse.com API from libGDX java implementation? - javaHow to use REST when using Java? - restWhat is the difference between an alias and an export (and a function!) [BASH]? - bashAll Articles