unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* write-region, auto-compression-mode, file endings
@ 2024-09-09 16:53 Christopher Howard
  2024-09-09 17:42 ` Eli Zaretskii
  2024-09-10  1:51 ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 5+ messages in thread
From: Christopher Howard @ 2024-09-09 16:53 UTC (permalink / raw)
  To: Help Gnu Emacs Mailing List

Hi, in some code for a scripting project I use `write-region' calls to (over)write data into files, from a temp buffer. This works fine, except that for reasons I won't go into, the file names involved have unusual file ending like "..Z", which causes auto-complete-mode to kick in, which is not good in my case.

I'm wonder what is a minimal code change I should make to ensure this doesn't happen, regardless of whether auto-complete-mode is set or not. Ideally (for this code) I don't want anything special happening regardless of what the file ending is.

-- 
📛 Christopher Howard
🚀 gemini://gem.librehacker.com
🌐 http://gem.librehacker.com

בראשית ברא אלהים את השמים ואת הארץ



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: write-region, auto-compression-mode, file endings
  2024-09-09 16:53 write-region, auto-compression-mode, file endings Christopher Howard
@ 2024-09-09 17:42 ` Eli Zaretskii
  2024-09-09 19:55   ` Christopher Howard
  2024-09-10  1:51 ` Stefan Monnier via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2024-09-09 17:42 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Christopher Howard <christopher@librehacker.com>
> Date: Mon, 09 Sep 2024 08:53:20 -0800
> 
> Hi, in some code for a scripting project I use `write-region' calls to (over)write data into files, from a temp buffer. This works fine, except that for reasons I won't go into, the file names involved have unusual file ending like "..Z", which causes auto-complete-mode to kick in, which is not good in my case.
> 
> I'm wonder what is a minimal code change I should make to ensure this doesn't happen, regardless of whether auto-complete-mode is set or not. Ideally (for this code) I don't want anything special happening regardless of what the file ending is.

You could disable auto-compression-mode around the call to
write-region.

Or you could remove jka-compr-handler from file-name-handler-alist,
while write-region runs.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: write-region, auto-compression-mode, file endings
  2024-09-09 17:42 ` Eli Zaretskii
@ 2024-09-09 19:55   ` Christopher Howard
  2024-09-10 11:34     ` Eli Zaretskii
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Howard @ 2024-09-09 19:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

> You could disable auto-compression-mode around the call to
> write-region.
>

This seems like the most simple idea.

One point of clarification: is auto-compression-mode something buffer-local in some sense? The docstring indicates that it is a global-minor-mode but mentioned checking to see if "the minor mode is enabled in the current buffer".

I'm curious also if there is some elegant macro for temporarily disabling a minor mode, and then reenabling it — or not — according to previous settings.

-- 
Christopher Howard



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: write-region, auto-compression-mode, file endings
  2024-09-09 16:53 write-region, auto-compression-mode, file endings Christopher Howard
  2024-09-09 17:42 ` Eli Zaretskii
@ 2024-09-10  1:51 ` Stefan Monnier via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 5+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2024-09-10  1:51 UTC (permalink / raw)
  To: help-gnu-emacs

> Hi, in some code for a scripting project I use `write-region' calls to
> (over)write data into files, from a temp buffer. This works fine, except
> that for reasons I won't go into, the file names involved have unusual file
> ending like "..Z", which causes auto-complete-mode to kick in, which is not
> good in my case.

You can prepend `/:` to the absolute file name, so as to circumvent any
file-name-handler.


        Stefan




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: write-region, auto-compression-mode, file endings
  2024-09-09 19:55   ` Christopher Howard
@ 2024-09-10 11:34     ` Eli Zaretskii
  0 siblings, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2024-09-10 11:34 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Christopher Howard <christopher@librehacker.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Mon, 09 Sep 2024 11:55:46 -0800
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > You could disable auto-compression-mode around the call to
> > write-region.
> >
> 
> This seems like the most simple idea.
> 
> One point of clarification: is auto-compression-mode something buffer-local in some sense? The docstring indicates that it is a global-minor-mode but mentioned checking to see if "the minor mode is enabled in the current buffer".

It's a global mode.  The text you cite is auto-generated.

> I'm curious also if there is some elegant macro for temporarily disabling a minor mode, and then reenabling it — or not — according to previous settings.

Not that I know of.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-09-10 11:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-09 16:53 write-region, auto-compression-mode, file endings Christopher Howard
2024-09-09 17:42 ` Eli Zaretskii
2024-09-09 19:55   ` Christopher Howard
2024-09-10 11:34     ` Eli Zaretskii
2024-09-10  1:51 ` Stefan Monnier via Users list for the GNU Emacs text editor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).