emacs-devel
[Top][All Lists]
Advanced

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

Re: Proposal: `buffer-offer-save' be made a permanent-local


From: Lennart Borgman
Subject: Re: Proposal: `buffer-offer-save' be made a permanent-local
Date: Fri, 18 Jun 2010 02:33:58 +0200

On Fri, Jun 18, 2010 at 2:13 AM, MON KEY <address@hidden> wrote:
> On Thu, Jun 17, 2010 at 6:25 PM, Lennart Borgman
> <address@hidden> wrote:
>>
>> Is not this just a misuse of a feature? You can misuse any feature.
>>
>
> NO! If the elisp API exposes permanent-local it isn't a misuse it is
> to be expected that people will use it (whether you or I agree with
> such use or not).


For an OS I would agree. But this is a developing environment. There
are lot of things in Emacs you can use but you should not use unless
you know what you are doing.

So there is nothing special with permanent-local in this regard.


> The `misuse' of permanent-local is the ad hoc elevation of only _some_
> symbols to permanent local status.
>
> Let all symbols be permanent permanent local by default or stop adding
> them arbitrarily to satisfy a kludge.


It would not work. You would just add another non-backward complexity.

It is beyond me why you are suggesting something like that.


>> And this has nothing to do with the change I proposed.
>
> It most certainly does.
>
> Kevin's query illustrates that where persisting state in a buffer is
> merely a matter of putting some permanent property on the buffer this
> is trivially accomplished.


Sorry, I can see nothing here that has anything to do with my proposal.


>> Instead, as I said before (a bit less explicit) it rather has to do
>> with complexity.
>
> Nonsense, the complexity is an outcome of a series of simplistic
> solution being thrown at the problem.


You seem to be sure of that. Why? To me it just looks like you are
overlooking the complexity of the question.

Sure there are cases like where your answer what be sensible. But that
does not mean it is it here.


>> Your major mode is simply not expected to to this kind of things.
>
> This is exactly my point. They will do it.  And your proposal is to
> have this behaviour explicitly blessed.


Then just don't use libraries from authors that do not know what they are doing.


>> And this has nothing to do with the change I proposed.
>>
> Why not?


There is nothing in the change I propose that makes the behavior or
possibility of other developers different.

If you think differently it suggest to me you have misunderstood the situation.


> Couldn't you accomplish a major-moded state change by doing
> something like this:


Yes. So what. What are you trying to prove?


> (put 'dead-weight-unless-you-look-for-me 'permanent-local t)
>
> (with-current-buffer (current-buffer)
>  (set (make-local-variable 'dead-weight-unless-you-look-for-me) t))
>
> ;; (unintern 'dead-weight-unless-you-look-for-me)
> (setplist 'dead-weight-unless-you-look-for-me
>          `(,(get-buffer (current-buffer))
>            (:buffer-offer-save t)))
>
> (with-current-buffer (get-buffer (other-buffer))
>  (buffer-local-value
>   (intern-soft "dead-weight-unless-you-look-for-me")
>   (current-buffer)))
> ;; => void over there
>
> (buffer-local-value
>  (intern-soft "dead-weight-unless-you-look-for-me")
>  (current-buffer))
> ;; => t over here
>
> (get
>  (intern-soft "dead-weight-unless-you-look-for-me")
>  (get-buffer (current-buffer)))
> ;; => (:buffer-offer-save t)
>
> (get (intern-soft "dead-weight-unless-you-look-for-me")
>     (get-buffer (current-buffer)))
> ;=> (:buffer-offer-save t)
>
> (plist-get
>  (get (intern-soft "dead-weight-unless-you-look-for-me")
>  (get-buffer (current-buffer)))
>             :buffer-offer-save)
> ;=> (:buffer-offer-save t)
>
> (fundamental-mode)
>
> (plist-get
>  (get (intern-soft "dead-weight-unless-you-look-for-me")
>      (get-buffer (current-buffer)))
>  :buffer-offer-save)
> ; => t
>
> (emacs-lisp-mode)
>
> (plist-get
>  (get (intern-soft "dead-weight-unless-you-look-for-me")
>      (get-buffer (current-buffer)))
>  :buffer-offer-save)
> ;=> t
>
> (fundamental-mode)
>
> (plist-get
>  (get (intern-soft "dead-weight-unless-you-look-for-me")
>      (get-buffer (current-buffer)))
>  :buffer-offer-save)
> ;=> t
>
> (with-current-buffer (get-buffer (other-buffer))
>  (buffer-local-value
>   (intern-soft "dead-weight-unless-you-look-for-me")
>   (current-buffer)))
> ;=> still void.
>
> --
> /s_P\
>



reply via email to

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