From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.help Subject: Re: Auto Fill Comments Date: Fri, 27 Nov 2020 05:56:54 +0100 Message-ID: References: <42c4e309-9a38-23bf-2091-86ed76097c21@lambda.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31734"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Dante Catalfamo Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 27 05:58:54 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kiVqQ-0008Al-Bx for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 27 Nov 2020 05:58:54 +0100 Original-Received: from localhost ([::1]:60254 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kiVqP-0001cr-4V for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 26 Nov 2020 23:58:53 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49608) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kiVob-0001cY-Sf for help-gnu-emacs@gnu.org; Thu, 26 Nov 2020 23:57:01 -0500 Original-Received: from mout.gmx.net ([212.227.15.19]:50967) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kiVoZ-0006mH-SV for help-gnu-emacs@gnu.org; Thu, 26 Nov 2020 23:57:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1606453014; bh=zolq/Fyn/5kI4xQ83NrjrHesqlju5jN+rQCDjiaUOno=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=M56fXs8gkG1dXDMgbDoj8XM7/BuhTaQF4T3o+fEvl2tXQ8FebdyX92OZ79louNGkq z7RVwGE2v+xT2jZk84KJdDwDo2bWFqLk14GUTfC41PPcYmrWuNas4L7wdMBXF+lRBH ivJ+QViIvS79C0zcMG6KFEvR9xnpxzdRMaIZNQlU= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs02.server.lan [172.19.170.129]) (via HTTP); Fri, 27 Nov 2020 05:56:54 +0100 Importance: normal Sensitivity: Normal In-Reply-To: <42c4e309-9a38-23bf-2091-86ed76097c21@lambda.cx> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:i4D5X/nReChnQ6Bns9hSOr+MaUHWldz5kWrlYubnU6SrZKHBms6zwl/2YxN1JCp796xKD TAt6eigavlP9FNjXv+ivoXgzFqmgLGVdcKH2+qHr8Cfc9x4M6leFhjuB0Nddfl3Dn3mgHWsSZCPh a7fmbBk4yB5M0XAgvPHsIpSyiHQHP9U51tRYUituuqGE+uHUsIkQQRVkWCefT18aiPGF9S13nBx1 UCCe9L/lu4rFMHRBnLxBRe3hI2tyZM1dV/p4ETBgugokVcSFrDOuBzGx5jE+/9hK4+/ivCzVcjaG e4= X-UI-Out-Filterresults: notjunk:1;V03:K0:gAMfTOmlCZE=:xDKd2D2pFDDSqPGzsnZDTA zVXUrsSHV2wW4r4NCppExA4EnBP7EViZR8l2ic7/RI7c2wcRWc3Tta2UgM3jZhJKFB3Ebuznw qsQTZDLoYcxWlGogx4Qh6KoZuk6uXhORHiJXsfQJsvEPOf6XUu+s+JpuWAQ227lwzxo42lUbG dcaxi72hRWbJnualqr79raHssyBwbiLQP3XmcCdsTINlxUcjVeAHPSCnJMJRlZTVaAKo3ZqaQ 1Epfalw9/9bBo7UQDSBqGwIPZt/Q4jyQL7ragrn7g/wg1A01tTXfGvr23tKymVlqYaorsB1kw VyAkjShDKDkhWCcRffOdDMynOO10moindyGkPA8p5kzD66XEqh7Xgx/c25iF33iOThbBuWI4J mYTSJNkxVW9TkrYx7lPHQ48TYco2ZbKOlIQ51FYPqUcU4x6OgnL1eH8n/IXWfc0LZ4MbwVRzW hoaVk2KV1kZtZy0+B/qwj5D+CI2nfKDgDy8kpW0jXls5r/3NbO4cMOw8XB0LigVUBfajUqhjy 3LuDFxxIC22En1GY+ssLy71Y1SFim2d9wyf7mOrbvFEjviJZvQmhn6EnXbcelSmyRjJbX5nqN Jm4yZh2Icrwqw= Received-SPF: pass client-ip=212.227.15.19; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:125617 Archived-At: 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" > 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" > >> To: "Help Gnu Emacs" > >> 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 m= odes. > >> (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)))) )) > >> > >> > >> > > > >