unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master c0f7396 1/2: Add an optional parameter to kill-all-local-variables
       [not found] ` <20211006105527.4DA8320DFE@vcs0.savannah.gnu.org>
@ 2021-10-06 12:33   ` Stefan Monnier
  2021-10-06 12:47     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2021-10-06 12:33 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

> +If given the new optional KILL-PERMANENT argument, also kill permanent
> +local variables.

Yet `buffer-file-name` won't be.  I guess it's a good thing, but how can
the programmer know which vars will be "killed" and which won't?


        Stefan




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

* Re: master c0f7396 1/2: Add an optional parameter to kill-all-local-variables
  2021-10-06 12:33   ` master c0f7396 1/2: Add an optional parameter to kill-all-local-variables Stefan Monnier
@ 2021-10-06 12:47     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2021-10-06 12:47 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Yet `buffer-file-name` won't be.  I guess it's a good thing, but how can
> the programmer know which vars will be "killed" and which won't?

Oh, I thought it did.  I didn't read the code, just the comments, which
I now see are pretty confusing:

/* Reset buffer B's local variables info.
   Don't use this on a buffer that has already been in use;
   it does not treat permanent locals consistently.
   Instead, use Fkill_all_local_variables.

   If PERMANENT_TOO, reset permanent buffer-local variables.
   If not, preserve those.  */

static void
reset_buffer_local_variables (struct buffer *b, bool permanent_too)

and:

DEFUN ("kill-all-local-variables", Fkill_all_local_variables,
       Skill_all_local_variables, 0, 1, 0,
       doc: /* Switch to Fundamental mode by killing current buffer's local vari
[...]

  run_hook (Qchange_major_mode_hook);

  /* Actually eliminate all local bindings of this buffer.  */

  reset_buffer_local_variables (current_buffer, !NILP (kill_permanent));

  /* Force mode-line redisplay.  Useful here because all major mode
     commands call this function.  */
  bset_update_mode_line (current_buffer);

  return Qnil;
}

Which seems pretty recursive.  I mean the

   Instead, use Fkill_all_local_variables.

comment.

Anyway...  I guess we don't have any function that resets these other
extremely-really-very-permanently buffer-local variables (in struct
buffer)?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



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

end of thread, other threads:[~2021-10-06 12:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20211006105525.30889.73523@vcs0.savannah.gnu.org>
     [not found] ` <20211006105527.4DA8320DFE@vcs0.savannah.gnu.org>
2021-10-06 12:33   ` master c0f7396 1/2: Add an optional parameter to kill-all-local-variables Stefan Monnier
2021-10-06 12:47     ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).