help-gnu-emacs
[Top][All Lists]
Advanced

[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: Thu, 26 Nov 2020 16:23:07 +0100

I am getting somewhat confused because I have also seen
people using set-fill-column and setq-default.

Is doing fill-column and set-fill-column the same thing?


(add-hook 'text-mode-hook
   '(lambda()
       (turn-on-auto-fill)
       (set-fill-column 72) ))

(setq-default fill-column 72)



> Sent: Thursday, November 26, 2020 at 4:13 PM
> From: daniela-spit@gmx.it
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: Auto Fill Comments
>
> We currently have just a hook to text-mode
>
> (add-hook 'text-mode-hook
>    '(lambda()
>        (turn-on-auto-fill)
>        (set-fill-column 80) ))
>
> > Sent: Thursday, November 26, 2020 at 4:56 AM
> > From: "Christopher Dimech" <dimech@gmx.com>
> > To: "Christopher Dimech" <dimech@gmx.com>
> > Cc: help-gnu-emacs@gnu.org
> > Subject: Re: Auto Fill Comments
> >
> >
> > I am still stuck with trying to do autofill by cycling through a key 
> > binding.
> > In summary I want to cycle between
> >
> > 1. Auto Fill only comments
> > 2. Auto Fill entire buffer
> > 3. Disable Auto Fill
> >
> > What command can be used to set the three commands?
> >
> > > Sent: Wednesday, November 25, 2020 at 8:59 AM
> > > From: "Christopher Dimech" <dimech@gmx.com>
> > > To: "Robert Thorpe" <rt@robertthorpeconsulting.com>
> > > Cc: help-gnu-emacs@gnu.org
> > > Subject: Re: Auto Fill Comments
> > >
> > > M-q was what I have been doing.  Want to try out auto fill, see if it can 
> > > save me
> > > using the key binding.  I usually keep code quite compact, but will check 
> > > out
> > > what you discussed.
> > >
> > >
> > > > Sent: Wednesday, November 25, 2020 at 8:11 AM
> > > > From: "Robert Thorpe" <rt@robertthorpeconsulting.com>
> > > > To: "Christopher Dimech" <dimech@gmx.com>
> > > > Cc: help-gnu-emacs@gnu.org
> > > > Subject: Re: Auto Fill Comments
> > > >
> > > > 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
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]