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: with a fresh emacs "(buffer-local-value fundamental-mode (current-buffer))" error. Date: Wed, 8 Apr 2009 17:58:36 -0400 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1239228426 28022 80.91.229.12 (8 Apr 2009 22:07:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 Apr 2009 22:07:06 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 09 00:08:21 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 1LrfwB-00047v-EV for ged-emacs-devel@m.gmane.org; Thu, 09 Apr 2009 00:08:03 +0200 Original-Received: from localhost ([127.0.0.1]:50365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lrfun-0001mH-7W for ged-emacs-devel@m.gmane.org; Wed, 08 Apr 2009 18:06:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lrfn5-0001CY-JO for emacs-devel@gnu.org; Wed, 08 Apr 2009 17:58:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lrfn4-0001Bh-IG for emacs-devel@gnu.org; Wed, 08 Apr 2009 17:58:39 -0400 Original-Received: from [199.232.76.173] (port=51942 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lrfn4-0001BQ-Ac for emacs-devel@gnu.org; Wed, 08 Apr 2009 17:58:38 -0400 Original-Received: from yw-out-1718.google.com ([74.125.46.152]:51635) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lrfn3-0004ws-Ti for emacs-devel@gnu.org; Wed, 08 Apr 2009 17:58:38 -0400 Original-Received: by yw-out-1718.google.com with SMTP id 9so271588ywk.66 for ; Wed, 08 Apr 2009 14:58:36 -0700 (PDT) Original-Received: by 10.151.156.6 with SMTP id i6mr3242504ybo.138.1239227916457; Wed, 08 Apr 2009 14:58:36 -0700 (PDT) X-Google-Sender-Auth: 44fdf9b9be464411 X-detected-operating-system: by monty-python.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:110153 Archived-At: Is this a bug, or am I missing something? `buffer-local-value' docstring says: "Return the value of variable in buffer. If variable does not have a buffer-local binding in buffer, the value is the ***default binding*** of the variable." [asterisks mine] Is this the default binding of buffers local variable or the default binding of the Global Variable? --------------- With a fresh emacs "(buffer-local-value longlines-mode (current-buffer))" With a fresh Emacs, if a mode hasn't been called interactively e.g. M-x fundamental-mode then evaluating: (buffer-local-value fundamental-mode (current-buffer)) throws an error, even though evaluating: mode-name => "Fundamental" and: major-mode => fundamental-mode This behavior happens with minor and major modes. For example (still in a fresh emacs): (buffer-local-value longlines-mode (current-buffer)) ----------------- Debugger entered--Lisp error: (void-variable longlines-mode) (buffer-local-value longlines-mode (current-buffer)) (and (buffer-local-value longlines-mode (current-buffer))) eval((and (buffer-local-value longlines-mode (current-buffer)))) eval-expression((and (buffer-local-value longlines-mode (current-buffer))) nil) call-interactively(eval-expression nil nil) ----------------- However, after interactively M-x longlines-mode and/or (longlines-mode) (plist-member buffer-file-format 'longlines) = > (longlines) buffer-file-format => longlines (local-variable-p 'longlines-mode) => t _BUT_ (plist-member buffer-file-format (buffer-local-variables)) => nil Now if: M-x fundamental-mode and/or (fundamental-mode) Now evaluating: major-mode => fundamental-mode (plist-member major-mode (buffer-local-variables)) => fundamental-mode mode-name => "Fundamental" (insert (format "%s" (buffer-local-variables))) => ( {...} (mode-name . Fundamental) (major-mode . fundamental-mode) (buffer-file-format longlines) {...} ) ;{...Ellided...} _BUT_ (local-variable-p 'fundamental-mode) => nil _AND_ (buffer-local-value fundamental-mode (current-buffer)) Still gives an error: ----- Debugger entered--Lisp error: (void-variable fundamental-mode) (buffer-local-value fundamental-mode (current-buffer)) eval((buffer-local-value fundamental-mode (current-buffer))) eval-last-sexp-1(nil) eval-last-sexp(nil) call-interactively(eval-last-sexp nil nil) ----- Whereas with longlines-mode having been set per above evaluating: (buffer-local-value longlines-mode (current-buffer)) No longer drops me into the debugger? Evaluated on two different emacsen: GNU Emacs 23.0.91.1 (i386-mingw-nt5.1.2600) of 2009-02-26 on SOFT-MJASON GNU Emacs 23.0.92.1 (i386-mingw-nt5.1.2600) of 2009-03-31 on LENNART-69DE564 (patched)