From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: jai-bholeki@gmx.com Newsgroups: gmane.emacs.help Subject: Re: problems with auto-fill-mode Date: Sat, 30 Jan 2021 17:54:29 +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="2232"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Help Gnu Emacs To: jai-bholeki@gmx.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 30 17:55:53 2021 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 1l5tXN-0000Tb-AL for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 30 Jan 2021 17:55:53 +0100 Original-Received: from localhost ([::1]:47622 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5tXM-0001kY-Bd for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 30 Jan 2021 11:55:52 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5tWC-0001jV-Kc for help-gnu-emacs@gnu.org; Sat, 30 Jan 2021 11:54:40 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:40767) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5tW6-000090-5Z for help-gnu-emacs@gnu.org; Sat, 30 Jan 2021 11:54:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1612025669; bh=7XEZ1j2bMcKKcFf1u531+aFS/3+0D6tfbyQV4ixMLqA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=ZFJLQpwApTq/grX4PQQWGrHJTV3QMzBTimqw8agnP0E3HFSRmZ9LzDjewq4M5c+zp 0Hv17fItWEqw/4AdCM75Plcc3UVECMkr5rq1WLrqNzE8aiQ3SwTrAd4TChG4pq4gnS nBVbnlJaoSSyqmkJ7AHx5KuPWmnKdweVZNV651FE= 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); Sat, 30 Jan 2021 17:54:29 +0100 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:HxDlTEHFcl/H/2cLzERSUhV+T8wXLDJB+BbpeWgDdzlsLks/yFnbCpV0KGHFe8GwFQ+Je vIdqKCyy1yWLPbUXewwO6KuwoWu8FGVN110TSi+ohIE0vpdfa1nDyPVywzlX35oReYpdGbCkd2N5 /cGFFFOOrGpfHMJlt2Wqe2PbYIm4Obbt2rXe9lUiNRaXVqHr4rd3hVjhhhzTzobaTylUleDjMK2R FPiPq0rBrp2e3IRMH5F/a9wT8SqZwLrGmXkMk/a4lCjSHnAyDgmcSx+8H4SZbm6sOK7BSuM+ArY+ dk= X-UI-Out-Filterresults: notjunk:1;V03:K0:kCEfqOEbo5k=:+bgeywi62Q1cac378ag8sO 23Ohs0aOw4twRrKwGNm2yKvPpUr9NRmxT7Ng9MeoyNtxBAZlbIsJN9jkxLy7+egji/LasPejm 7f0xZ3/Cxd1V/NMrPzcU0ve8mC8gMbvgjl9FOfJCP/gc6XVELDlbTXlxERAVVUzPV3KeCjj9m SW/Wc/6Ua3xXNppxD2xu3qDc00NLbblIeZX0nog5sgXowtpwM2UHn2WFJ03qU8OHYYzxH9LYr u8U4hkGWBZOMWY2nEXFvXfCNrAze8WGp1xboet06jdDeLI1vv0+6Kr94kv3CYSDnJ0v9MynN6 uf1SBb1u3+i+3byjD9edu6Dv7d+8SW2NJ3FTHbuQYfaRtg15RbjdiJi1WSNyX9D3m8RbyyDts IkCkMfEGnBlNSj2U84KczNQPMFvQz0sf78Uxz+dEJhnlZaxOS7s22EHxGGIUMPb2ZUdE73XGU aO6a3zn+17Ffzjc1yjwaQUuMKMSm16gpnmA5ZzeEQj9djqcXhb3krSRojO3CNVgIU+xej1fiM y2X64cH5BYR6ELGqCrjDrOGW6Y8oe8cu895aB1GjkPlBlSiV4yNHpHfTUtPCIe5dfPjU0E7WY /cMQEWyhBNico= Received-SPF: pass client-ip=212.227.15.15; envelope-from=jai-bholeki@gmx.com; helo=mout.gmx.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=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:127453 Archived-At: Does it matter which expression to call first. (setq fill-column 72) (auto-fill-mode) or (auto-fill-mode) (setq fill-column 72) > Sent: Sunday, January 31, 2021 at 4:36 AM > From: jai-bholeki@gmx.com > To: "Help Gnu Emacs" > Subject: problems with auto-fill-mode > > I am having a lot of problems on how to set up auto-fill-mode. > > I want to cycle auto-fill of comments, then disable them using > the keybinding "C-c q". > > Have written the following code. > > (defun break-comments () > "Break lines when they exceed a specific character length." > (setq-local comment-auto-fill-only-comments t)) > > (defun fill-break-comments () > "Break lines when they exceed a specific character length." > (setq fill-column 72) > (setq-local comment-auto-fill-only-comments t) > (auto-fill-mode 0) ) > > (defvar dfv-break-comments-state nil) > > ;; Cycles line breaking tool > (defun cycle-break-comments () > "Break comments in programming languages." > (interactive) > > (pcase dfv-break-comments-state > ;; > (1 (setq-local comment-auto-fill-only-comments nil) > (auto-fill-mode 0) > (setq dfv-break-comments-state 0) > (message "%s" "Disable: Break comments")) > ;; > (_ (setq fill-column 72) > (if (not nil dfv-break-comments-state) > (add-hook 'prog-mode-hook #'break-comments) > (progn > (add-hook 'sh-mode-hook #'break-comments) > (add-hook 'fortran-mode-hook #'break-comments) > (add-hook 'emacs-lisp-mode-hook #'break-comments) > (add-hook 'c-mode-hook #'break-comments) > (add-hook 'c++-mode-hook #'break-comments) > (add-hook 'awk-mode-hook #'break-comments) > (add-hook 'R-mode-hook #'break-comments) > (add-hook 'octave-mode-hook #'break-comments) > ;; > (add-hook 'texinfo-mode-hook #'break-comments) > (add-hook 'text-mode-hook #'break-comments)) > (auto-fill-mode)) > ;; > (setq dfv-break-comments-state 1) > (message "%s" "Break comments using prog-mode-hook")) ) > > ;; Break comments using auto-fill > (global-set-key (kbd "C-c q") #'cycle-break-comments) ) > > > > > > >