Timeline for Is there a function in emacs that centers an input text and fills the line with the comment symbol as one would use it for headings in a file?
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 25, 2018 at 17:07 | comment | added | Maxim Kim | I didn't try to make it perfect ;). Your solution most probably has an issue with odd number of characters and c-style comments | |
| Jul 25, 2018 at 14:29 | comment | added | stevosn | I see.. I used your function and tweaked it a bit.. there was a different result for an even or odd number of characters in the line ;-) | |
| Jul 25, 2018 at 13:53 | comment | added | Maxim Kim | it is better to use temporary binding with let form instead of setq here. And for comment-region usage -- you didn't provide correct parameters | |
| Jul 25, 2018 at 13:37 | comment | added | stevosn | Thanks! I was also working on it but struggling with learning the basics of lisp...I tried to set the comment style to align and the call comment-region, but I guess the lisp syntax is wrong..? (defun comment-for-heading (arg) "Comment selected region and move it to center surounded by comment symbols." (setq comment-style 'aligned) (comment-region ((/ fill-column 2) arg)) (setq comment-style 'indent) ) | |
| Jul 25, 2018 at 12:52 | history | edited | Maxim Kim | CC BY-SA 4.0 | provide the actual solution |
| Jul 25, 2018 at 12:47 | history | edited | Maxim Kim | CC BY-SA 4.0 | provide the actual solution |
| Jul 25, 2018 at 12:06 | history | answered | Maxim Kim | CC BY-SA 4.0 |