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: Wed, 25 Nov 2020 01:56:45 +0100 Message-ID: References: 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="27813"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help Gnu Emacs To: Christopher Dimech Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 25 01:58:40 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 1khj8o-000792-0c for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 25 Nov 2020 01:58:38 +0100 Original-Received: from localhost ([::1]:46274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1khj8m-00080C-O7 for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 24 Nov 2020 19:58:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1khj74-000805-3Z for help-gnu-emacs@gnu.org; Tue, 24 Nov 2020 19:56:50 -0500 Original-Received: from mout.gmx.net ([212.227.17.22]:34871) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1khj72-0007YJ-16 for help-gnu-emacs@gnu.org; Tue, 24 Nov 2020 19:56:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1606265805; bh=t4BaCQlWZCC3DtbS65BbxrkTnIj6tV2zvI+Kj6tk/cs=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=aIZHttHDfE2mXasAfl5QlUXEP5+YeIkNx51OFbYF+Zr82OfSRXqDNf/WPL77aSp0Z diw3q20trB/Izc+gUkt76OCjorv+DnW1pAJiXNeXcgUytvPKEuiv+gFkYqib3zTIU5 AMIbRMibjy7rh7N+cTwpQBeHlwwolTOYC9IUE7S0= 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-bs16.server.lan [172.19.170.184]) (via HTTP); Wed, 25 Nov 2020 01:56:45 +0100 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:v4f+t79iMMZYwQS1akz2vJpdYwd3APaCf7iVPARr/oQslrTzIowGTL4jucNR8OvBwYaQe 7JFYMZ0GxLsdaG6e+2IUKzkisHnTSaVpTwAvg5jDHG14vWl4oR6dO0R+pEdiNIy7buisK2ca1nb4 P74liZdBD3TZxi6sRe2uOQyhnZ0Dl31I+NJdNDodPNluBxi/1EvpqnAm/6ION7y/FJ0bn7VNpGEt GPEDQHG1CHcpZwOGM4WbuDkV14gakoAuAK+l++ay+b7wR2lIKm0XLJGK/mHYINf9q98f6esBdvrv BA= X-UI-Out-Filterresults: notjunk:1;V03:K0:ZjixQRr7oVE=:5yC4+fonSJ6VyrSWkq9XGC QRgSyU8AVYqVfiuFxCtssDvbqyvDrwcpa5cT/t8NiSmie73d5yuNdOkJOtFQXhXhmkoj7OkS9 yqvRQoB0ObCFUxCTkcSOX1gjgg/wPcZ+LgOABfX9DoM9OhkTGAJnwVauIueOdKsLcBI4XSSQk 1j8MtIgJe/b2o2HYZbDP9Lq2bZO0xYn1YJksOWNTENNuHlEI+jXBShIIN4l2XHz/b+8WkecDT 4LK1ma2rC4xytnHmG3g0ETZDv2hWSAzGq/PE1jM3SjxPhMOZ6GHwIyGLChvlyQ2o2UKCI8iCE cDfFs4yxJDXOxePoi0N8oh8X6lItaHqCSiOqrdwH+ab14umJWoKbgjjJ1YUpReVDYJaRPOchj GuAYoMV8gZL6ZPYmED0ALmD/SLB7agYbdPvIQ1eTYS6D0nBMZKfyBk2w4Vaon7IEb63aU4/P5 XvNlTF4boJ0Gxzv0kTswNqAGyw4McZuYZuF1/PNnbQ05Sii9YmMEe0UwV5lw1zYmeqHGnpDSn ZYG0fHSmxyTlvaIh5gqTmYsehPAuCbnyqfIVh9J1h/3qpO6DzBDY+/XXLsBGb5LHQ6pZcQh5l SqUwNbESwxaJM= Received-SPF: pass client-ip=212.227.17.22; envelope-from=dimech@gmx.com; helo=mout.gmx.net X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:125545 Archived-At: The biggest problem is how to call autofill parameters as the three list options change. > Sent: Tuesday, November 24, 2020 at 9:53 PM > From: "Christopher Dimech" > To: "Christopher Dimech" > Cc: "Help Gnu Emacs" > Subject: Re: Auto Fill Comments > > Have started doing something, but am quite stuck now. Somehow I need to > fill the list for the three options: (1) autofill comments; (2) autofill > buffer; and (3) disable autofill. > > (setq autofill-list > '( )) > > (defun break-line-cycle (@n) > (interactive "p") > ;; Sets property 'state', an integer. Possible values are any index > ;; to autofill-list. > (let ($fill-selector $cnd-before $cnd-after) > (setq $cnd-before > (if (get 'break-line-cycle 'state) > (get 'break-line-cycle 'state) > 0) ) > (setq $cnd-after > (% (+ $cnd-before (length font-list) @n) (length autofill-list)= )) > (setq $fill-selector (nth $cnd-after autofill-list)) > (put 'break-line-cycle 'state $cnd-after))) > > > Sent: Tuesday, November 24, 2020 at 8:52 PM > > From: "Christopher Dimech" > > To: daniela-spit@gmx.it > > Cc: "Help Gnu Emacs" > > Subject: Re: Auto Fill Comments > > > > Looks quite nice. I could try to cycle through three states: > > (1) auto fill comments; (2) auto fill buffer; and (3) disable > > auto fill. > > > > Anybody done this before? > > > > Regards > > Christopher > > > > > > > > > Sent: Tuesday, November 24, 2020 at 8:42 PM > > > From: daniela-spit@gmx.it > > > To: "Christopher Dimech" > > > Cc: "Help Gnu Emacs" > > > Subject: Re: Auto Fill Comments > > > > > > 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 languag= e 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)))) )) > > > > > > > > > > > > > > > > > > > --------------------- > Christopher Dimech > General Administrator - Naiad Informatics - GNU Project (Geocomputation) > - Geophysical Simulation > - Geological Subsurface Mapping > - Disaster Preparedness and Mitigation > - Natural Resource Exploration and Production > - Free Software Advocacy >