unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: daniela-spit@gmx.it
To: Christopher Dimech <dimech@gmx.com>
Cc: Help Gnu Emacs <help-gnu-emacs@gnu.org>
Subject: Re: Auto Fill Comments
Date: Tue, 24 Nov 2020 20:42:38 +0100	[thread overview]
Message-ID: <trinity-1ca77ec5-7898-46b2-863f-65893509debb-1606246958925@3c-app-mailcom-bs16> (raw)
In-Reply-To: <trinity-3a306896-e4f9-4747-b475-4220d2926968-1606237554995@3c-app-mailcom-bs16>

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)))) ))
>
>
>



  reply	other threads:[~2020-11-24 19:42 UTC|newest]

Thread overview: 155+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 17:05 Auto Fill Comments Christopher Dimech
2020-11-24 19:42 ` daniela-spit [this message]
2020-11-24 19:52   ` Christopher Dimech
2020-11-24 20:02     ` daniela-spit
2020-11-24 20:53     ` Christopher Dimech
2020-11-25  0:56       ` Christopher Dimech
2020-11-27  4:40   ` Dante Catalfamo
2020-11-27  4:56     ` Christopher Dimech
2020-11-27  5:47       ` Arthur Miller
2020-11-25  7:11 ` Robert Thorpe
2020-11-25  7:59   ` Christopher Dimech
2020-11-26  3:56     ` Christopher Dimech
2020-11-26 15:13       ` daniela-spit
2020-11-26 15:23         ` Christopher Dimech
2020-11-26 16:00           ` tomas
2020-11-26 17:22             ` Christopher Dimech
2020-11-26 17:35               ` daniela-spit
2020-11-26 18:27               ` tomas
2020-11-26 18:44                 ` Christopher Dimech
2020-11-26 19:19                   ` Christopher Dimech
2020-11-26 20:16                   ` tomas
2020-11-26 20:29                     ` Christopher Dimech
2020-11-26 20:44                     ` Christopher Dimech
2020-11-26 21:14                     ` Christopher Dimech
2020-11-26 21:51                   ` Drew Adams
2020-11-27  0:47                     ` Christopher Dimech
2020-11-27  1:57                       ` arthur miller
2020-11-27  2:20                         ` Christopher Dimech
2020-11-27  3:04                           ` arthur miller
2020-11-27  3:46                           ` Jean Louis
2020-11-27  6:27                             ` Arthur Miller
2020-11-27  6:34                               ` Christopher Dimech
2020-11-27  7:02                                 ` Arthur Miller
2020-11-27  7:15                                   ` Christopher Dimech
2020-11-27  7:29                                     ` Arthur Miller
2020-11-27  7:00                               ` Jean Louis
2020-11-27  7:10                                 ` Christopher Dimech
2020-11-27  8:26                                 ` Arthur Miller
2020-11-27 13:26                                   ` Jean Louis
2020-11-27  7:33                         ` Eli Zaretskii
2020-11-27  2:15                       ` Drew Adams
2020-11-27  2:41                         ` Christopher Dimech
2020-11-27  3:21                           ` Drew Adams
2020-11-27  5:47                           ` Jean Louis
2020-11-27  6:06                             ` Christopher Dimech
2020-11-27  6:21                               ` Jean Louis
2020-11-27  6:27                                 ` Christopher Dimech
2020-11-27  6:34                                   ` Jean Louis
2020-11-27  6:35                                   ` Arthur Miller
2020-11-27  3:32                         ` Jean Louis
2020-11-27  5:32                           ` Drew Adams
2020-11-27  6:02                             ` Jean Louis
2020-11-27  7:28                       ` Eli Zaretskii
2020-11-27  7:59                         ` Christopher Dimech
2020-11-27  8:11                           ` Robert Pluim
2020-11-27  9:07                             ` Christopher Dimech
2020-11-27  8:25                           ` Eli Zaretskii
2020-11-27  9:11                             ` Christopher Dimech
2020-11-27  8:51                           ` Arthur Miller
2020-11-27  9:23                             ` Christopher Dimech
2020-11-27 13:44                               ` Jean Louis
2020-11-27 16:02                                 ` tomas
2020-11-27 17:41                                   ` Christopher Dimech
2020-11-27 17:53                                     ` tomas
2020-11-27 18:07                                       ` Christopher Dimech
2020-11-27 18:45                                         ` Christopher Dimech
2020-11-27 21:16                                           ` tomas
2020-11-27 21:32                                             ` Christopher Dimech
2020-11-27 19:03                                         ` Arthur Miller
2020-11-27 19:39                                           ` Christopher Dimech
2020-11-27 21:26                                             ` Arthur Miller
2020-11-27 21:40                                               ` Christopher Dimech
2020-11-27 22:15                                                 ` Michael Heerdegen
2020-11-27 22:38                                                   ` Christopher Dimech
2020-11-28  1:06                                                     ` Jean Louis
2020-11-28  1:24                                                       ` Christopher Dimech
2020-11-27 22:55                                                   ` Christopher Dimech
2020-11-28  1:08                                                     ` Jean Louis
2020-11-28  1:45                                                       ` Christopher Dimech
2020-11-28  2:54                                                         ` Jean Louis
2020-11-28  7:46                                                   ` Eli Zaretskii
2020-11-28 12:05                                                     ` Christopher Dimech
2020-11-28 15:58                                                       ` Andy Moreton
2020-11-28 16:15                                                       ` Eli Zaretskii
2020-11-28 16:29                                                         ` Christopher Dimech
2020-11-29  0:08                                                       ` Arthur Miller
2020-11-29  0:21                                                         ` Christopher Dimech
2020-11-29  0:25                                                           ` Arthur Miller
2020-11-29  0:44                                                             ` Christopher Dimech
2020-11-29  1:15                                                           ` Michael Heerdegen
2020-11-29  2:24                                                             ` Christopher Dimech
2020-11-29  2:56                                                               ` Michael Heerdegen
2020-11-29  3:21                                                                 ` Christopher Dimech
2020-11-29 23:41                                                                   ` Michael Heerdegen
2020-11-30  0:06                                                                     ` Christopher Dimech
2020-11-30  1:06                                                                       ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-11-30  1:49                                                                         ` Christopher Dimech
2020-11-30  2:05                                                                           ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-11-30  8:58                                                                           ` tomas
2020-11-30 10:09                                                                             ` Christopher Dimech
2020-11-30 10:41                                                                               ` tomas
2020-11-30 11:47                                                                                 ` Jean Louis
2020-11-30 12:43                                                                                 ` Christopher Dimech
2020-11-30  2:38                                                                         ` Drew Adams
2020-11-30  3:03                                                                           ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-12-01 18:47                                                                           ` Andreas Eder
2020-11-30  6:45                                                                       ` Jean Louis
2020-11-30 21:19                                                                       ` Michael Heerdegen
2020-11-30 22:14                                                                         ` Christopher Dimech
2020-11-30 22:26                                                                           ` tomas
2020-11-30 22:32                                                                             ` Stefan Monnier
2020-11-30 23:44                                                                               ` Christopher Dimech
2020-12-01  8:45                                                                               ` tomas
2020-11-30 22:45                                                                           ` Drew Adams
2020-11-30 23:22                                                                             ` Christopher Dimech
2020-12-01  8:42                                                                               ` tomas
2020-12-01 15:50                                                                                 ` Christopher Dimech
2020-12-01 16:35                                                                                   ` Jean Louis
2020-12-01 18:14                                                                                     ` Christopher Dimech
2020-12-01 19:33                                                                                       ` Michael Heerdegen
2020-12-01 19:56                                                                                         ` Christopher Dimech
2020-12-01 21:42                                                                                           ` Michael Heerdegen
2020-12-01 22:13                                                                                             ` Christopher Dimech
2020-12-01 22:55                                                                                         ` Christopher Dimech
2020-12-01 23:16                                                                                           ` Michael Heerdegen
2020-12-01 23:27                                                                                             ` Christopher Dimech
2020-12-02  4:49                                                                                         ` Jean Louis
2020-12-01 16:07                                                                                 ` Christopher Dimech
2020-11-30 23:12                                                                           ` Michael Heerdegen
2020-11-30 23:38                                                                             ` Christopher Dimech
2020-11-29  7:52                                                               ` Yuri Khan
2020-11-29 18:43                                                                 ` Christopher Dimech
2020-11-28 12:08                                                     ` Christopher Dimech
2020-11-28  7:33                                               ` Eli Zaretskii
2020-11-28 12:02                                                 ` Christopher Dimech
2020-11-29  0:05                                                   ` Arthur Miller
2020-11-27 19:06                                         ` Drew Adams
2020-11-27 19:43                                           ` Christopher Dimech
2020-11-27 16:25                               ` Arthur Miller
2020-11-27 13:31                             ` Jean Louis
2020-11-27 16:42                               ` Arthur Miller
2020-11-27 17:00                                 ` Jean Louis
2020-11-27 17:54                                   ` Christopher Dimech
2020-11-27 18:40                                     ` Arthur Miller
2020-11-27 18:47                                       ` Christopher Dimech
2020-11-27 18:30                                   ` Arthur Miller
2020-11-27  8:48                       ` tomas
2020-11-27 13:27                         ` Jean Louis
2020-11-27 14:20                         ` Stefan Monnier
2020-11-26 20:45           ` Stefan Monnier
2020-11-26 20:45         ` Stefan Monnier
     [not found] <<trinity-3a306896-e4f9-4747-b475-4220d2926968-1606237554995@3c-app-mailcom-bs16>
     [not found] ` <<87pn419aha.fsf@robertthorpeconsulting.com>
     [not found]   ` <<trinity-60beb4e8-9aad-4720-921c-26bcd854bea8-1606291146852@3c-app-mailcom-bs13>
     [not found]     ` <<trinity-bd917da6-8593-496f-ad5d-e94bd80ab4d1-1606362968280@3c-app-mailcom-bs15>
     [not found]       ` <<trinity-ecec5438-da9c-4746-9cdd-e73d756d9733-1606403627268@3c-app-mailcom-bs15>
     [not found]         ` <<trinity-5525c10b-09da-40b7-a9d8-ad6d12d86a62-1606404187770@3c-app-mailcom-bs15>
     [not found]           ` <<20201126160013.GD28931@tuxteam.de>
     [not found]             ` <<trinity-0fef3278-2e4b-4baa-a18e-44d71359e02c-1606411346268@3c-app-mailcom-bs06>
     [not found]               ` <<20201126182734.GA5175@tuxteam.de>
     [not found]                 ` <<trinity-e374e86a-0c1e-4936-be3d-cceef6d0d436-1606416249978@3c-app-mailcom-bs06>
     [not found]                   ` <<54331aa0-6a9a-4809-9f2d-88deee31558b@default>
     [not found]                     ` <<trinity-878f6b95-e9e7-4431-959d-bbf323277c4c-1606438028794@3c-app-mailcom-bs06>
     [not found]                       ` <<AM0PR06MB65775932B66B36CFDBB1813696F80@AM0PR06MB6577.eurprd06.prod.outlook.com>
     [not found]                         ` <<83o8jjp83z.fsf@gnu.org>
2020-11-27 17:51                           ` Drew Adams
2020-11-27 18:00                             ` Jean Louis
2020-11-27 19:00                               ` Drew Adams
2020-11-28  0:59                                 ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-1ca77ec5-7898-46b2-863f-65893509debb-1606246958925@3c-app-mailcom-bs16 \
    --to=daniela-spit@gmx.it \
    --cc=dimech@gmx.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).