[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Auto Fill Comments
From: |
Christopher Dimech |
Subject: |
Re: Auto Fill Comments |
Date: |
Fri, 27 Nov 2020 05:56:54 +0100 |
Because I thought that I can have a keybinding that cycles
auto-fill. It could be long and hard to do that for every
major mode.
There are times when I need to also have the code use auto-fill,
but not always. A keybinding cycle could be a solution for every
major mode.
> Sent: Friday, November 27, 2020 at 5:40 AM
> From: "Dante Catalfamo" <dante@lambda.cx>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Auto Fill Comments
>
> Is there any reason you don't add a hook to prog-mode instead? Are there
> some languages that don't have well defined comments?
>
> On 11/24/20 2:42 PM, daniela-spit@gmx.it wrote:
> > This is what I use. I find no good reason to use c-mode-common-hook.
> >
> > (defun break-comment ()
> > (setq-local comment-auto-fill-only-comments t)
> > (auto-fill-mode 1))
> >
> > (add-hook 'sh-mode-hook #'break-comment)
> > (add-hook 'fortran-mode-hook #'break-comment)
> > (add-hook 'emacs-lisp-mode-hook #'break-comment)
> > (add-hook 'texinfo-mode-hook #'break-comment)
> >
> > (add-hook 'c-mode-hook #'break-comment)
> > (add-hook 'c++-mode-hook #'break-comment)
> > (add-hook 'awk-mode-hook #'break-comment)
> > (add-hook 'R-mode-hook #'break-comment)
> > (add-hook 'octave-mode-hook #'break-comment)
> > (add-hook 'text-mode-hook #'break-comment)
> >
> >
> >> Sent: Tuesday, November 24, 2020 at 6:05 PM
> >> From: "Christopher Dimech" <dimech@gmx.com>
> >> To: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> >> Subject: Auto Fill Comments
> >>
> >> 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)))) ))
> >>
> >>
> >>
> >
>
>
Re: Auto Fill Comments, Robert Thorpe, 2020/11/25
- 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