[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Auto Fill Comments
From: |
Robert Thorpe |
Subject: |
Re: Auto Fill Comments |
Date: |
Wed, 25 Nov 2020 07:11:45 +0000 |
Christopher Dimech <dimech@gmx.com> writes:
> Would this be good enough to Auto Fill Comments in c language.
> What can I use for Auto Fill Comments for other languages, e.g.
> fortran, elisp, c++, texinfo, bash, awk, org, R.
>
> ;; Apply Auto Fill to comments but not code in programming language modes.
> (add-hook 'c-mode-common-hook
> (lambda ()
> (auto-fill-mode 1)
> (set
> (make-local-variable 'fill-nobreak-predicate)
> (lambda ()
> (not (eq (get-text-property (point) 'face)
> 'font-lock-comment-face)))) ))
Notice that "M-q" performs paragraph filling for comments in C and other
languages. It is not *auto* filling certainly, but it's very useful.
I've found that to be the best myself. That's because of commenting out
code. The problem is if you comment out code then modify it when it's a
comment. If you set Emacs to auto-fill comments, then it will auto-fill
those code comments as though they're text. That's wrong when you want
to uncomment the block and make it back into code, it removes the
indentation.
BR,
Robert Thorpe
Re: Auto Fill Comments,
Robert Thorpe <=
- Re: Auto Fill Comments, Christopher Dimech, 2020/11/25
- Re: Auto Fill Comments, Christopher Dimech, 2020/11/25
- Re: Auto Fill Comments, daniela-spit, 2020/11/26
- Re: Auto Fill Comments, Christopher Dimech, 2020/11/26
- Re: Auto Fill Comments, tomas, 2020/11/26
- Re: Auto Fill Comments, Christopher Dimech, 2020/11/26
- Re: Auto Fill Comments, daniela-spit, 2020/11/26
- Re: Auto Fill Comments, tomas, 2020/11/26
- Re: Auto Fill Comments, Christopher Dimech, 2020/11/26
- Re: Auto Fill Comments, Christopher Dimech, 2020/11/26