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: problems with auto-fill-mode Date: Sat, 30 Jan 2021 17:36:44 +0100 Message-ID: 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="5394"; mail-complaints-to="usenet@ciao.gmane.io" To: Help Gnu Emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 30 17:37:48 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 1l5tFs-0001KI-DN for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 30 Jan 2021 17:37:48 +0100 Original-Received: from localhost ([::1]:35984 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5tFr-0003VZ-Ft for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 30 Jan 2021 11:37:47 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5tEu-0003TV-Qz for help-gnu-emacs@gnu.org; Sat, 30 Jan 2021 11:36:48 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:45083) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5tEs-0000Ld-Ry for help-gnu-emacs@gnu.org; Sat, 30 Jan 2021 11:36:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1612024604; bh=XgImiy28rjpP113EGmpzArmZ5lkHV3PyHJw0UqNfG0M=; h=X-UI-Sender-Class:From:To:Subject:Date; b=lQhByzL0krri6eLJIQeS2Y6wd+67i7MpiVBiJbUQvZ1A080aUCZiwus7eSp2HDaF5 3rjOEYBguC1/ZUWRl0johuTnOK/ZC3o3AtV9RXikOmKCkS4lX8RR699RUCgxv0XJUe yyYyQyuYOKVVPhTfARVTr3/FQMuywPrGD8jJpHdQ= 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:36:44 +0100 Importance: normal Sensitivity: Normal X-Priority: 3 X-Provags-ID: V03:K1:OAaf7Dc5inW2RanSrNcQFOu/1BmxAs0eavzDOadmfKQ5FYx5QXwI64EJ76KA/zLJ6QwL8 SBTtviQ0JntvzZHu9O2Wi7RuU0tOJuh00tjdmfO7vY+fV8mV+xOGw4Lm+Zps3ONx6iUqcsFctcLg e7U92v2R17bXRZblKfKcuUrAriQDzdNCM7TXxk8pWK1ABeAj9OU9ejQBGUI4ogJuvdwfjnhXarfR pShj3jXiqMS+JhULpJ8Y0eJCNDB1W3KEpQGScmLeGIXG48HUmiEdFHUuufRaeLvNg8itpTCAd5vr SM= X-UI-Out-Filterresults: notjunk:1;V03:K0:qGav5pWu/70=:F/qGiSO8Xt7GoU2Y1fE5Dh GFXzmefy4Ct9JyBtioXVovNRklkPTEixJLbsikWA51fJtzJVnXvyKrxbHBpZNpdfDS2SL1AXa DnLnuAstQIZrlN9dEO/tXcdrLKB7cuSehjJxW6LId0u6i36bK3XcLRuFPBQAOQlQPKwUmXTFl QE1yW/DMPbi89gD+XO5HXYzCTILgfu3MC5wwuwkA6Ufu8a9ayAM5GStGV6n7u3dz1Hkaru7VV EKCkOyrWCUyI/EqD2zoAkLg85UJCvImPZC7xZ3X6dEE1/8obRC/RZJ4NwLs9Mmly88hMdrbLs /5R3bZ5wxEy0DynXhtDY56rICUGt2XQ/JkeTbgvutLvTwD/GlLCq9bRm8gzVx9G4Do0OHuaqQ 2RWk+rbApS7Ht72nvybUCZMwWUcdnJnsQDyvdcAV/NHwI8eaxuZYQkrT9+8hgGZz2/Jih/75v 1LfwTptWD3wSOVG4gN4CniR9tq/3xRzE5QIFdgUaMSSak+S0oLs28zZWeF5ZcSOm+fyrUvN/3 Av8M+BLkCVX0jHDwOlhQe4XpOqqpIMmu8oeM353720I1Beg49coBgsu7ebrwkZZ2dEPQ6/7R5 sT9LCMgZk/OhY= Received-SPF: pass client-ip=212.227.15.18; 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:127451 Archived-At: 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) )