From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pankaj Jangid Newsgroups: gmane.emacs.help Subject: Re: Cycle Auto-Fill Date: Sat, 05 Dec 2020 19:29:51 +0530 Organization: Code Is Great Foundation Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39262"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) Cc: Help Gnu Emacs To: Christopher Dimech Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 05 15:00:55 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 1klY7K-000A7O-OB for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 05 Dec 2020 15:00:54 +0100 Original-Received: from localhost ([::1]:53496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1klY7J-0003Jb-OR for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 05 Dec 2020 09:00:53 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47694) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1klY6V-0003JF-Q5 for help-gnu-emacs@gnu.org; Sat, 05 Dec 2020 09:00:03 -0500 Original-Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:37411) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1klY6Q-0004B7-VZ for help-gnu-emacs@gnu.org; Sat, 05 Dec 2020 09:00:01 -0500 Original-Received: by mail-pf1-x432.google.com with SMTP id b10so5817198pfo.4 for ; Sat, 05 Dec 2020 05:59:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeisgreat-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:organization:references:mail-followup-to:date :in-reply-to:message-id:user-agent:mime-version; bh=KJA7RI6v0NnKRIvky3rtcQwtBK9PKAMUZaEWxp2ipQ0=; b=DQV/qKawQgkicL9oWMfrKPri3AiS0rVX7l7K4rwDduAUQn6vOYuVYSjwUQ7x/OPN9N m8ByYuNHUS/pJOA6lCJPdLw/OXc1WKPiSUkOPRDgPdVhQmsvIrxkmONcgDVAL2ksMoFc zh2PWGXpQTO/vSFmVFXDunZDNnGBRiEYWhSCq0fglNgNsebhxfcLvZFM9AfjDq/bAkhF FRv4KYBhOoX54lrC/CWbZlVMkwfx49F93ajEmSXsEiMuYMSZ5wpTUOtKHK6ui3jO/80r bjFd7iGtzG+Bn3WiqDNru4WHpXKRNIYbCDiHbLACRHTi+JWXDG3yz+nqRMPSKwPR6PfF YzeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:organization:references :mail-followup-to:date:in-reply-to:message-id:user-agent :mime-version; bh=KJA7RI6v0NnKRIvky3rtcQwtBK9PKAMUZaEWxp2ipQ0=; b=DyJTsSDSoO8amPGTum6pygrP7R5HZRJskwO7w0st/bSevbnVilZbKgsdn6/lINpZrW 00VI/8L2V7W5GxW0I334n8f0LKD7fDyVEIzOkM4myfZRZS/zYzZvW1qq2/zfadkwVNbU 7Z/EQcbZ54Ak25mfoU2LpZEeS/RcN9WRNDMLO6xoKeEK25TjYlmhbUQ1p3K4F6HKxPg/ pokUX5DbJQ+dGpFelb5y8dbkwbjtCH1Hyf7/pYSHuQNtUul1we0U7nrl6qgwfJFiTboO jMEoRpbczE7GE/c8XDMojk/ZHr6nMgPpp1Uvq0bhZcIAbP3ZSFP7vzzwdn69Vx3Tsf8c cz4A== X-Gm-Message-State: AOAM530qEZF7VulLAtkpk9fc2XFBf0KyR0wJSt2R0N9iJVyotIIwAWi3 4Ec/u8keZlWQ58v8MIErNWebapi0X6fbvQ== X-Google-Smtp-Source: ABdhPJx9lhood3C3eXhGNAUFmJUCk18C3ecZ5AIOcFL2odESM9DfYyCPlXHsFiv1EjO6QGwphOddRA== X-Received: by 2002:a63:d005:: with SMTP id z5mr11844005pgf.296.1607176796442; Sat, 05 Dec 2020 05:59:56 -0800 (PST) Original-Received: from mb2.local ([2405:201:5c06:70bc:34af:2222:ac1b:ebe8]) by smtp.gmail.com with ESMTPSA id j69sm8575245pfd.37.2020.12.05.05.59.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Dec 2020 05:59:55 -0800 (PST) Mail-Followup-To: Christopher Dimech , Help Gnu Emacs In-Reply-To: (Christopher Dimech's message of "Sat, 5 Dec 2020 14:25:06 +0100") Received-SPF: none client-ip=2607:f8b0:4864:20::432; envelope-from=pankaj@codeisgreat.com; helo=mail-pf1-x432.google.com 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, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=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:126024 Archived-At: Christopher Dimech writes: > (defun gungadin-auto-fill-cycle () > "Cycles Auto Fill. Automatically breaks lines that get beyond > variable fill-column." > (interactive) - (unless (get 'gungadin-auto-fill-cycle 'state) - (put 'gungadin-auto-fill-cycle 'state 1)) > > (setq n (get 'gungadin-auto-fill-cycle 'state)) > - (when (= n 1) + (when (or (not n) (= n 1)) > (message "Auto Fill Comments Only") > (set (make-local-variable 'comment-auto-fill-only-comments) t) > (auto-fill-mode 1) > (put 'gungadin-auto-fill-cycle 'state 2)) > (when (= n 2) > (message "Auto Fill Buffer") > (set (make-local-variable 'comment-auto-fill-only-comments) nil) > (put 'gungadin-auto-fill-cycle 'state 3)) > (when (= n 3) > (message "Disable Auto Fill") > (auto-fill-mode 0) > (put 'gungadin-auto-fill-cycle 'state 1)) ) > > (global-set-key (kbd "H-a") #'gungadin-auto-fill-cycle) Will this work? Removed one (get) call and a conditional test. Added one conditional test.