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: Thu, 26 Nov 2020 04:56:08 +0100 Message-ID: References: <87pn419aha.fsf@robertthorpeconsulting.com> 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="19143"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Christopher Dimech Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 26 04:58:34 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 1ki8QU-0004tB-2O for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 26 Nov 2020 04:58:34 +0100 Original-Received: from localhost ([::1]:36886 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ki8QS-0008IV-Rh for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 25 Nov 2020 22:58:33 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57246) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ki8OD-0008IM-2i for help-gnu-emacs@gnu.org; Wed, 25 Nov 2020 22:56:13 -0500 Original-Received: from mout.gmx.net ([212.227.17.21]:45351) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ki8OA-0006EQ-Ca for help-gnu-emacs@gnu.org; Wed, 25 Nov 2020 22:56:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1606362968; bh=qNAEsD6wGsvl+Aw481/50ZNnTVolMUDLiMaSv50+7ms=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=PSSM+hBa5uPloXvPBn85hdNgBLXVYzKSgyirrUaYDPqNw3MZ8tTZtD5T2KD/2p9N4 c32eKhEM+QA5xQZRJqIb0+GoN+aPVq3HAxm89Hj130cE8au1rAAp2I+kdeK+5aSGEJ OPFMQcPeRUfOmjuyNHIjwcLLdc5QA1z2jLzK8cLQ= 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-bs15.server.lan [172.19.170.183]) (via HTTP); Thu, 26 Nov 2020 04:56:08 +0100 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:38FGIlXhDNqaTOr02RL3I0NYI5weXQU7y7Qqm0y+i70hjtbhE9RXJ50oc7TQYy0/l0sz0 aeSBq5kjvxPFDOENjFnHBVd+NIZjfErhOs2OF+wwaWzDuYfu1x/xN+BWPJmoVNRv/YlJSoJ2L+a9 X2rnkypYtrgAHjPpo3JnZZd0wclCn44pbWQbEyowExrKBN2rpNMDQUqOa+ZLXd8HXkyTLNuOit+5 +UgeWbPLqlFCOBAGny+YgENjnTwW1QDdEHTFUUDRQsMxUAqZwppE2iaO4eCCbM6H01kit3ER3Eyh C8= X-UI-Out-Filterresults: notjunk:1;V03:K0:gRjqJT5pd7U=:XrfH6S/aITcImim9pkibva UlDMcBnxIVfJimmniSvYMKCuylyolqoVmF/GH04g/XdcfDRGx8m66Rcd1iEDG1TIP1QhKUH7Q 9BE6cyfwakqKc87dx7GpwL1VCEgipybWxE+LUpRE+Mr0VQIo1thw4qeKHN1XlHtIu+Ue0ziy4 jLmKQl1k0bJky24NyR2Gik84RWYBXKXNJDepO9i7sWyapx4DZ6slyX3cQIcOL5RD18sss5a/5 Xy/maPpz9uLJNjt5V4txvGCcze9U+P9Tdb3ZdBrw2LTTfiE2WCOYs0YOv3hFaQopa8ZIENsxQ 4N9U0/3jkisbyqNlUAbgp/OHohH8784vltsh+43sdZCZzZcdrWQGy8httayBoqWfulRfsTdja 3hT2L55N1cJX6SrdKOnTh4yOUC9nhEk7ntbqMeV/sab9siV9iCSUXURtj7oN9lvvwv4snXGPm qIF+Odq7ZBeslwTOqgrzs9yiE96KtozWAjmIxJRqJmUrpIxSBGAaKLYaY3hSkdeTgZ1CodxpS 8/qwrzeQN3CYKXV8xtUC6E+R9ntpXSkmhLn04HVx6ii9l0mEac8s1UdEmJN2vhaHnatxAXwlL d1ebl2h2+FXmU= Received-SPF: pass client-ip=212.227.17.21; 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:125560 Archived-At: I am still stuck with trying to do autofill by cycling through a key bindi= ng. 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" > To: "Robert Thorpe" > 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 ca= n save me > using the key binding. I usually keep code quite compact, but will chec= k out > what you discussed. > > > > Sent: Wednesday, November 25, 2020 at 8:11 AM > > From: "Robert Thorpe" > > To: "Christopher Dimech" > > Cc: help-gnu-emacs@gnu.org > > Subject: Re: Auto Fill Comments > > > > Christopher Dimech 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 oth= er > > 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 o= ut > > 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-fi= ll > > those code comments as though they're text. That's wrong when you wan= t > > to uncomment the block and make it back into code, it removes the > > indentation. > > > > BR, > > Robert Thorpe > > > > > > > >