unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* with a fresh emacs "(buffer-local-value fundamental-mode  (current-buffer))" error.
@ 2009-04-08 21:58 MON KEY
  2009-04-08 22:15 ` Jason Rumney
  2009-04-08 22:32 ` Davis Herring
  0 siblings, 2 replies; 13+ messages in thread
From: MON KEY @ 2009-04-08 21:58 UTC (permalink / raw)
  To: emacs-devel

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)




^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-04-16 21:49 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-08 21:58 with a fresh emacs "(buffer-local-value fundamental-mode (current-buffer))" error MON KEY
2009-04-08 22:15 ` Jason Rumney
2009-04-09  2:22   ` MON KEY
2009-04-09  5:12     ` Kevin Rodgers
2009-04-08 22:32 ` Davis Herring
     [not found]   ` <d2afcfda0904081931n1f0d48fbo1253c6af08cd4bbc@mail.gmail.com>
2009-04-09 15:26     ` Davis Herring
     [not found]       ` <d2afcfda0904091341j6b1194a1ifb522b99535139f9@mail.gmail.com>
2009-04-09 22:42         ` Davis Herring
2009-04-10  3:12           ` MON KEY
2009-04-16 21:49             ` Davis Herring
2009-04-10 16:53           ` MON KEY
2009-04-10 17:38             ` Chong Yidong
2009-04-10 22:10               ` Stefan Monnier
2009-04-16 21:29                 ` Davis Herring

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).