From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: MON KEY Newsgroups: gmane.emacs.devel Subject: Re: Proposal: `buffer-offer-save' be made a permanent-local Date: Thu, 17 Jun 2010 20:13:38 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1276820031 21301 80.91.229.12 (18 Jun 2010 00:13:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 18 Jun 2010 00:13:51 +0000 (UTC) Cc: kevin.d.rodgers@gmail.com, emacs-devel@gnu.org To: Lennart Borgman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 18 02:13:50 2010 connect(): No such file or directory Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OPPDS-0001VM-7y for ged-emacs-devel@m.gmane.org; Fri, 18 Jun 2010 02:13:50 +0200 Original-Received: from localhost ([127.0.0.1]:48523 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OPPDR-0007jK-Hy for ged-emacs-devel@m.gmane.org; Thu, 17 Jun 2010 20:13:49 -0400 Original-Received: from [140.186.70.92] (port=41711 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OPPDJ-0007gi-Mj for emacs-devel@gnu.org; Thu, 17 Jun 2010 20:13:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OPPDI-000722-It for emacs-devel@gnu.org; Thu, 17 Jun 2010 20:13:41 -0400 Original-Received: from mail-yw0-f177.google.com ([209.85.211.177]:41304) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OPPDI-00071a-GY for emacs-devel@gnu.org; Thu, 17 Jun 2010 20:13:40 -0400 Original-Received: by ywh7 with SMTP id 7so586570ywh.26 for ; Thu, 17 Jun 2010 17:13:38 -0700 (PDT) Original-Received: by 10.151.95.31 with SMTP id x31mr277674ybl.2.1276820018773; Thu, 17 Jun 2010 17:13:38 -0700 (PDT) Original-Received: by 10.151.10.5 with HTTP; Thu, 17 Jun 2010 17:13:38 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: B_UUb45SWySaws33zfHCInEL63E X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:126116 Archived-At: On Thu, Jun 17, 2010 at 6:25 PM, Lennart Borgman 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). 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. > 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. Its not at all unlike a web-browser setting a session cookie to hold state (and approximately as unclean). > 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. Someone might just as well ask why not use a delimited continuation or closure based protocol to hold these kinds of state instead if its such a complex situation? Alas, you can't stop a cookie monster :) > 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. > > And this has nothing to do with the change I proposed. > Why not? Couldn't you accomplish a major-moded state change by doing something like this: (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\