From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Davis Herring" Newsgroups: gmane.emacs.devel Subject: Re: with a fresh emacs "(buffer-local-value fundamental-mode (current-buffer))" error. Date: Thu, 16 Apr 2009 14:49:58 -0700 (PDT) Message-ID: <34173.128.165.123.18.1239918598.squirrel@webmail.lanl.gov> References: <50950.128.165.123.18.1239229924.squirrel@webmail.lanl.gov> <33049.128.165.123.18.1239290817.squirrel@webmail.lanl.gov> <33849.128.165.123.18.1239316978.squirrel@webmail.lanl.gov> Reply-To: herring@lanl.gov NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1239918629 29993 80.91.229.12 (16 Apr 2009 21:50:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 16 Apr 2009 21:50:29 +0000 (UTC) Cc: emacs-devel@gnu.org To: "MON KEY" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 16 23:51:48 2009 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.50) id 1LuZUh-0002FQ-09 for ged-emacs-devel@m.gmane.org; Thu, 16 Apr 2009 23:51:40 +0200 Original-Received: from localhost ([127.0.0.1]:56829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LuZTI-0001fS-3Z for ged-emacs-devel@m.gmane.org; Thu, 16 Apr 2009 17:50:12 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LuZTC-0001eF-SW for emacs-devel@gnu.org; Thu, 16 Apr 2009 17:50:06 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LuZT8-0001dK-I7 for emacs-devel@gnu.org; Thu, 16 Apr 2009 17:50:06 -0400 Original-Received: from [199.232.76.173] (port=51430 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LuZT8-0001dH-FS for emacs-devel@gnu.org; Thu, 16 Apr 2009 17:50:02 -0400 Original-Received: from proofpoint1.lanl.gov ([204.121.3.25]:49072) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LuZT7-0000yt-Lb for emacs-devel@gnu.org; Thu, 16 Apr 2009 17:50:02 -0400 Original-Received: from mailrelay1.lanl.gov (mailrelay1.lanl.gov [128.165.4.101]) by proofpoint1.lanl.gov (8.14.3/8.14.3) with ESMTP id n3GLnwP0001731; Thu, 16 Apr 2009 15:49:58 -0600 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by mailrelay1.lanl.gov (Postfix) with ESMTP id A3657150422; Thu, 16 Apr 2009 15:49:58 -0600 (MDT) X-NIE-2-Virus-Scanner: amavisd-new at mailrelay1.lanl.gov Original-Received: from webmail1.lanl.gov (webmail1.lanl.gov [128.165.4.106]) by mailrelay1.lanl.gov (Postfix) with ESMTP id 7A8F515041A; Thu, 16 Apr 2009 15:49:58 -0600 (MDT) Original-Received: by webmail1.lanl.gov (Postfix, from userid 48) id 7758D1518033; Thu, 16 Apr 2009 15:49:58 -0600 (MDT) Original-Received: from 128.165.123.18 (SquirrelMail authenticated user 196434) by webmail.lanl.gov with HTTP; Thu, 16 Apr 2009 14:49:58 -0700 (PDT) In-Reply-To: User-Agent: SquirrelMail/1.4.8-5.3.lanl2 X-Priority: 3 (Normal) Importance: Normal X-Proofpoint-Virus-Version: vendor=fsecure engine=1.12.7400:2.4.4, 1.2.40, 4.0.166 definitions=2009-04-16_10:2009-04-15, 2009-04-16, 2009-04-16 signatures=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:110315 Archived-At: > Thank you. Your right. What knocks my socks off is it generally works > without trouble... For variables whose values are always t or nil, evaluating them is idempotent. > Maybe i'm paranoid but ({.... do stuff with SOME ARGS ...})) > includes nested lets/lets*, catch/throws, save-excursions, > with-temp-buffer, etc. > wrapping that in a progn wrapped in a let* seems to ensure that the > return to the conditional > (longlines-mode {nil/t}) gets executed as the last form. The do-stuff will either return a value, in which case let* will continue evaluating things in order (without a progn), or it will exit non-locally (via an error or quit or throw), in which case the rest of your progn (and the rest of the let*, if any) will get skipped. If you are concerned about restoring the state after some code runs, even in the case where it exits abnormally, use `unwind-protect'. (Note that bindings, or temporary values, created by let[*] are always undone without the need for `unwind-protect'.) > Obviously, but when shuffling the text between real<->temp buffers > weird things seem to happen when I *don't* disable lLLM before leaving > current-buffer > [..] > Also, LLM doesn't *really* change text FWIU... only EOL representation no? That would be because LLM does change the buffer text -- it replaces certain spaces with newlines when a file is loaded, and does the reverse when it is saved. It would not be hard to use part of longlines-mode to do either of those transformations on the text you want to work with -- but do it outside any user buffers. > I'll give it a gander but swapping a hook variable (one more poorly > specified than the > elisp variable I'm dancing around) doesn't strike me as quite the right > thing. Calling `longlines-mode' as a function does much more work than that! >> (bound-and-true-p 'longlines-mode) > > Thank You. This seems much cleaner and prob. exactly what is needed. (My apologies, as I said in another email, for the spurious ' I included here.) > Then fundamental-mode shouldn't masquerade as one behind the > major-mode elt in buffer-local-variable's alist pair. It's not -- the _symbol_ `fundamental-mode' is the (buffer-local) _value_ of the _variable_ `major-mode' in certain buffers. Only the cars of the elements (or the whole elements if they are symbols) returned by `buffer-local-variables' are variables: the cdrs can be symbols, or numbers, or buffers, or... > Doesn't this generally imply an assumption that one know which mode > one is testing for? You only need know whether the mode you're interested in is a major or a minor mode, which is usually trivial to find out. > ??? Can't they reside outside of a dir-locals.el bound to a 'class'. > >> They are irrelevant here. > Is this based on your assumption that dir-locals are _just_ data on disk? You're right about the classes; I hadn't kept up with that mechanism. But it doesn't change the fact that they merely become buffer-local variables in the end; the directory-locals mechanism is just a way of specifying variables for more than one file at a time. > In which context? The contexts at hand are still (in my case) at the > outer layers. What I meant by "this context" was the issues you were having with `buffer-local-value'. So long as you leave each `let' that binds a possibly-buffer-local variable (which is nearly anything for which there is a `defvar') in the same buffer as you entered it, you'll not have this problem. > [...] I'd be happy to share the details but I > doubt you'd benefit from pointing out all the deficiencies in my code > (I'm sure the inverse isn't the case) :) You're welcome to ask me in particular, but it might also be useful to, say, post it to the EmacsWiki; I imagine several people there (including me) might be willing to help out. Davis -- This product is sold by volume, not by mass. If it appears too dense or too sparse, it is because mass-energy conversion has occurred during shipping.