From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Emanuel Berg via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: how to force auto-save of buffers not visiting files, right now? Date: Sun, 20 Mar 2022 09:08:49 +0100 Message-ID: <87czihqc4u.fsf@zoho.eu> References: <019b7e509c29caa462ff1c30079ce9bfb8cdc668.camel@adminart.net> <87zglq200a.fsf@web.de> <8fffdb6b532a1fc1805229acfcf9510c3afe18ec.camel@adminart.net> <87wngsmdwp.fsf@web.de> <9f32ac59eb1bc186b015c0b6c5b94822e70d4135.camel@adminart.net> <87y2164u5p.fsf@web.de> <9c3935a33573d50e595f37103434db5e29c21063.camel@adminart.net> <87ilsa61tn.fsf@web.de> <37e890d9c251b30d0caf83aa590bca1ad92ec5d4.camel@adminart.net> <8735jd5v9s.fsf@web.de> <6bf426a46e6ec3804d77cf66d6591928c0f38a3f.camel@adminart.net> Reply-To: Emanuel Berg Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16540"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Cancel-Lock: sha1:MmLBwTQUTqLxERwMiI43rcQ8wZk= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Mar 21 17:10:07 2022 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 1nWKbf-00041n-5G for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 21 Mar 2022 17:10:07 +0100 Original-Received: from localhost ([::1]:46064 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nWKbd-0007iU-Ge for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 21 Mar 2022 12:10:05 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:60498) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVqcW-00072P-Qn for help-gnu-emacs@gnu.org; Sun, 20 Mar 2022 04:09:00 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]:39812) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVqcV-0001A5-9h for help-gnu-emacs@gnu.org; Sun, 20 Mar 2022 04:09:00 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1nVqcT-0000ao-12 for help-gnu-emacs@gnu.org; Sun, 20 Mar 2022 09:08:57 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=geh-help-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 21 Mar 2022 12:05:38 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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:136708 Archived-At: hw wrote: > (defun my-perltidy-replace (_) > "This function replaces the contents of the current buffer with > the output of perltidy, and makes a backup of the current buffer. > > Before and after modifications to contents of buffers are being > made, all buffers that need to be auto-saved are being > auto-saved. > > The major-mode of the buffer containing the backup is set to > 'cperl-mode'." Emacs thinks the second line should not have indentation ... the first line is not a complete sentence .... and probably "replaces" should be imperative "replace"! > (linum-mode -1) This is the only one needed. > (auto-save-mode nil) Yuk, not needed ... BTW final args that could be nil (nil is in the function range) could always be optional and default to nil, right? Here tho it is ugly by all means but also unnecessary since it _is_ an optional argument, so all good. > (linum-mode 1) Not as ugly! But as equally unnecessary still pretty ugl- I mean unnecessary. > (defun my-transient-copy (_) > "This function makes a copy of the current buffer to a new > buffer. The new buffer does not visit a file. Its name is based > on the name of the current buffer. > > The 'auto-save-mode' is enabled for the new buffer, and all > buffers that need to be auto-saved are being auto-saved right > away, once before the copy is created and once after." Emacs thinks Second line should not have indentation First line is not a complete sentence Probably "makes" should be imperative "make" > (interactive "P") Interesting, does that work and what does it do?! > (do-auto-save) > (let ((transient_buffer (generate-new-buffer-name (concat "transient-copy-of-" (buffer-name))))) > (copy-to-buffer transient_buffer (point-min) (point-max)) Here is another example - when the last two args a and b and (<= (point-min) a b (point-max)) then both formal parameters can be made optional if we had argument a defaulting to (point-min) and argument b defaulting to (point-max), right? > (with-current-buffer transient_buffer (auto-save-mode > nil)) Same. -- underground experts united https://dataswamp.org/~incal