[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master c0f7396 1/2: Add an optional parameter to kill-all-local-vari

From: Lars Ingebrigtsen
Subject: Re: master c0f7396 1/2: Add an optional parameter to kill-all-local-variables
Date: Wed, 06 Oct 2021 14:47:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

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)


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.


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

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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]