all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#9090: 24.0.50; void-variable jka-compr-verbose
@ 2011-07-15 14:38 lee
  2011-07-15 17:04 ` Glenn Morris
  0 siblings, 1 reply; 13+ messages in thread
From: lee @ 2011-07-15 14:38 UTC (permalink / raw)
  To: 9090

This bug report will be sent to the Bug-GNU-Emacs mailing list
and the GNU bug tracker at debbugs.gnu.org.  Please check that
the From: line contains a valid email address.  After a delay of up
to one day, you should receive an acknowledgement at that address.

Please write in English if possible, as the Emacs maintainers
usually do not have translators for other languages.

Please describe exactly what actions triggered the bug, and
the precise symptoms of the bug.  If you can, give a recipe
starting from `emacs -Q':



When starting emacs, I'm getting a warning "Warning: defvar ignored
because jka-compr-verbose is let-bound".  This leads to errors when
dealing with compressed files and gives backtraces like:

,----
| Debugger entered--Lisp error: (void-variable jka-compr-verbose)
|   jka-compr-insert-file-contents("/home/lee/tmp/emacs-backtrace.txt.gz" t nil nil nil)
|   apply(jka-compr-insert-file-contents ("/home/lee/tmp/emacs-backtrace.txt.gz" t nil nil nil))
|   jka-compr-handler(insert-file-contents "/home/lee/tmp/emacs-backtrace.txt.gz" t nil nil nil)
|   insert-file-contents("~/tmp/emacs-backtrace.txt.gz" t)
|   byte-code([...] [inhibit-read-only filename t insert-file-contents] 3)
|   find-file-noselect-1(#<buffer emacs-backtrace.txt.gz> "~/tmp/emacs-backtrace.txt.gz" nil nil "~/tmp/emacs-backtrace.txt.gz" (76027656 2430))
|   find-file-noselect("~/tmp/emacs-backtrace.txt.gz" nil nil t)
|   find-file("~/tmp/emacs-backtrace.txt.gz" t)
|   call-interactively(find-file nil nil)
`----

As a work-around, I've put (setq jka-compr-verbose t) into my ~/.emacs.



If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
For information about debugging Emacs, please read the file
/usr/local/share/emacs/24.0.50/etc/DEBUG.


In GNU Emacs 24.0.50.1 (x86_64-unknown-linux-gnu, X toolkit)
 of 2011-07-15 on yun
configured using `configure  '--with-x-toolkit=lucid''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: de_DE.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Summary

Minor modes in effect:
  show-paren-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  size-indication-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x b RET ESC x g n u s RET RET C-x b e m TAB i TAB 
RET ESC O A ESC O D ESC O D ESC O D ESC O D ESC O D 
ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC 
O D ESC O D ESC O D ESC O D ESC O D ESC O D ESC O D 
C-@ ESC [ 4 ~ ESC w C-x b RET ESC O A ESC O A ESC [ 
7 ^ ESC y g C-g M SPC ESC < C-s C-y C-s C-s C-s C-s 
C-s C-g c o m p r e s C-s C-s C-s C-g C-g C-g ESC x 
b u g TAB DEL DEL DEL DEL DEL DEL DEL DEL DEL DEL DEL 
DEL DEL DEL r e p o TAB r TAB RET

Recent messages:
Generating summary...done
Mark set
Couldn't fetch article <87y6mmc79m.fsf@kzsu.stanford.edu>
Buffer is read-only: #<buffer *Summary mail.lists.bug-gnu-emacs*>
bunzip2ing 822.bz2...done
Parsing BBDB... (frobnicating...done)
Quit
Mark set
Quit [2 times]
Making completion list...

Load-path shadows:
None found.

Features:
(shadow flyspell ispell emacsbug help-mode view multi-isearch mule-util
sort ansi-color gnus-cite gnus-async gnus-bcklg qp gnus-ml nndraft nnmh
nndoc nnmaildir parse-time rot13 disp-table netrc gnutls network-stream
auth-source eieio assoc starttls tls nnfolder bbdb-gnus bbdb-snarf
mail-extr bbdb-com cl nnml gnus-agent gnus-srvr gnus-score score-mode
nnvirtual gnus-msg nntp gnus-cache rx gnus-diary gnus-art mm-uu mml2015
epg-config mm-view mml-smime smime password-cache dig mailcap nndiary
nnir gnus-sum gnus-group gnus-undo nnmail mail-source nnoo gnus-start
gnus-spec gnus-int gnus-range message sendmail rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045
ietf-drums mailabbrev gmm-utils mailheader gnus-win gnus gnus-ems
nnheader gnus-util mail-utils mm-util mail-prsvr wid-edit jka-compr info
sh-script executable vc-bzr make-mode org-wl org-w3m org-vm org-rmail
org-mhe org-mew org-irc org-jsinfo org-infojs org-html org-exp ob-exp
org-exp-blocks org-agenda org-info org-gnus org-docview org-bibtex
org-bbdb cal-china lunar solar cal-dst cal-bahai cal-islam cal-hebrew
holidays hol-loaddefs appt diary-lib diary-loaddefs remember
org-remember org-datetree org byte-opt warnings bytecomp byte-compile
cconv macroexp advice help-fns advice-preload ob-emacs-lisp ob-tangle
ob-ref ob-lob ob-table org-footnote org-src ob-comint comint ob-keys ob
ob-eval org-complete pcomplete org-list org-faces org-compat
org-entities org-macs noutline outline easy-mmode cal-menu easymenu
calendar cal-loaddefs ring erc-goodies erc erc-backend erc-compat
format-spec thingatpt pp bbdb-autoloads bbdb regexp-opt timezone
saveplace time-date paren cus-start cus-load desktop boxquote rect
tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar
dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting system-font-setting
font-render-setting x-toolkit x multi-tty emacs)





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

* bug#9090: 24.0.50; void-variable jka-compr-verbose
  2011-07-15 14:38 bug#9090: 24.0.50; void-variable jka-compr-verbose lee
@ 2011-07-15 17:04 ` Glenn Morris
  2011-07-15 18:11   ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Glenn Morris @ 2011-07-15 17:04 UTC (permalink / raw)
  To: 9090-done

Version: 24.1

lee wrote:

> When starting emacs, I'm getting a warning "Warning: defvar ignored
> because jka-compr-verbose is let-bound".

Fixed.

Recipe:

emacs -Q -l info

(info-insert-file-contents "/usr/share/info/emacs.gz")
M-x find-file RET /usr/share/info/emacs.gz RET





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

* bug#9090: 24.0.50; void-variable jka-compr-verbose
  2011-07-15 17:04 ` Glenn Morris
@ 2011-07-15 18:11   ` Lars Magne Ingebrigtsen
  2011-07-15 18:20     ` Glenn Morris
  2011-07-18 14:03     ` defvar inside let-binding (was: bug#9090: 24.0.50; void-variable jka-compr-verbose) Stefan Monnier
  0 siblings, 2 replies; 13+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-15 18:11 UTC (permalink / raw)
  To: 9090

Glenn Morris <rgm@gnu.org> writes:

>> When starting emacs, I'm getting a warning "Warning: defvar ignored
>> because jka-compr-verbose is let-bound".
>
> Fixed.

Sorry; my fault.  The binding/later-loading thing is pretty annoying in
general, though.

Has changing the way `defvar' works in the presence of let-bindings been
discussed? 

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





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

* bug#9090: 24.0.50; void-variable jka-compr-verbose
  2011-07-15 18:11   ` Lars Magne Ingebrigtsen
@ 2011-07-15 18:20     ` Glenn Morris
  2011-07-18 14:03     ` defvar inside let-binding (was: bug#9090: 24.0.50; void-variable jka-compr-verbose) Stefan Monnier
  1 sibling, 0 replies; 13+ messages in thread
From: Glenn Morris @ 2011-07-15 18:20 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: 9090

Lars Magne Ingebrigtsen wrote:

> The binding/later-loading thing is pretty annoying in general, though.

A general solution would be nice, yes. I guess if it were easy to do,
though, the code would do that rather than just emit a warning.

> Has changing the way `defvar' works in the presence of let-bindings been
> discussed? 

Can't remember.





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

* defvar inside let-binding (was: bug#9090: 24.0.50; void-variable jka-compr-verbose)
  2011-07-15 18:11   ` Lars Magne Ingebrigtsen
  2011-07-15 18:20     ` Glenn Morris
@ 2011-07-18 14:03     ` Stefan Monnier
  2011-07-18 14:20       ` defvar inside let-binding Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2011-07-18 14:03 UTC (permalink / raw)
  To: emacs-devel

>>> When starting emacs, I'm getting a warning "Warning: defvar ignored
>>> because jka-compr-verbose is let-bound".
>> Fixed.
> Sorry; my fault.  The binding/later-loading thing is pretty annoying in
> general, though.

Yes.

> Has changing the way `defvar' works in the presence of let-bindings been
> discussed? 

No.  Personally I can't see how to make it work, because by the time we
get to defvar it's kind of too late.  Maybe we could try to change the
let-binding so that the "saved void state" (which will be restored at
the end of the outer let) gets changed as if the var had been defvarred
before the let-binding.  But it sounds terribly hackish.

Of course, another problem is that in the case of defcustom we don't
even detect the problem.


        Stefan



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

* Re: defvar inside let-binding
  2011-07-18 14:03     ` defvar inside let-binding (was: bug#9090: 24.0.50; void-variable jka-compr-verbose) Stefan Monnier
@ 2011-07-18 14:20       ` Lars Magne Ingebrigtsen
  2011-07-18 16:18         ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-18 14:20 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> Has changing the way `defvar' works in the presence of let-bindings been
>> discussed? 
>
> No.  Personally I can't see how to make it work, because by the time we
> get to defvar it's kind of too late.  Maybe we could try to change the
> let-binding so that the "saved void state" (which will be restored at
> the end of the outer let) gets changed as if the var had been defvarred
> before the let-binding.  But it sounds terribly hackish.

That was exactly what I was thinking should happen.  :-)

I mean, if you say

(let ((foo-var nil))
  (foo-function))

and `foo-function' is autoloaded -- I can't think of a single use case
where you'd want `foo-var' to be unbound afterwards.

That `foo-function' is autoloaded or a real function is something that
should (in my opinion) have no effect on what you'd end up with after
calling it.

Leaving `foo-var' unbound is what is the hack, I think.  We should
strive to end up with the same result after calling `foo-function', no
matter whether it's autoloaded or not.

> Of course, another problem is that in the case of defcustom we don't
> even detect the problem.

I'm not sure I follow you there...

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




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

* Re: defvar inside let-binding
  2011-07-18 14:20       ` defvar inside let-binding Lars Magne Ingebrigtsen
@ 2011-07-18 16:18         ` Stefan Monnier
  2011-07-19 16:14           ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2011-07-18 16:18 UTC (permalink / raw)
  To: emacs-devel

>> Of course, another problem is that in the case of defcustom we don't
>> even detect the problem.
> I'm not sure I follow you there...

defcustom works differently from defvar and doesn't use defvar
(e.g. because it may not even define a real variable: the "var" may
simply only be available through accessor/setter functions) and since
the current code that detects a "defvar within let" is written in C code
in Fdefvar, it doesn't apply to defcustom.


        Stefan



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

* Re: defvar inside let-binding
  2011-07-18 16:18         ` Stefan Monnier
@ 2011-07-19 16:14           ` Lars Magne Ingebrigtsen
  2011-08-01 21:20             ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-07-19 16:14 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> defcustom works differently from defvar and doesn't use defvar
> (e.g. because it may not even define a real variable: the "var" may
> simply only be available through accessor/setter functions) and since
> the current code that detects a "defvar within let" is written in C code
> in Fdefvar, it doesn't apply to defcustom.

Right.

But does

(let ((foo nil))
  (foo-function))

leave `foo' unbound if `foo' is a defcustom?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




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

* Re: defvar inside let-binding
  2011-07-19 16:14           ` Lars Magne Ingebrigtsen
@ 2011-08-01 21:20             ` Stefan Monnier
  2011-08-02 13:42               ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2011-08-01 21:20 UTC (permalink / raw)
  To: emacs-devel

> But does

> (let ((foo nil))
>   (foo-function))

> leave `foo' unbound if `foo' is a defcustom?

Yes, just like with defvar.  The difference is that defvar detects the
problem and outputs a warning.


        Stefan



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

* Re: defvar inside let-binding
  2011-08-01 21:20             ` Stefan Monnier
@ 2011-08-02 13:42               ` Lars Magne Ingebrigtsen
  2011-08-02 19:22                 ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-08-02 13:42 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Yes, just like with defvar.  The difference is that defvar detects the
> problem and outputs a warning.

Ah, ok.  So if we decide to change the way let-bindings affect defvar
when we load files, then we have to basically implement the same
detection for defcustom.

Which we probably should do anyway.  :-)

It's this code, right?

      if (NILP (tem))
	Fset_default (sym, eval_sub (Fcar (tail)));
      else
	{ /* Check if there is really a global binding rather than just a let
	     binding that shadows the global unboundness of the var.  */
	  volatile struct specbinding *pdl = specpdl_ptr;
	  while (--pdl >= specpdl)
	    {
	      if (EQ (pdl->symbol, sym) && !pdl->func
		  && EQ (pdl->old_value, Qunbound))
		{
		  message_with_string ("Warning: defvar ignored because %s is let-bound",
				       SYMBOL_NAME (sym), 1);
		  break;
		}
	    }
	}

Since `defcustom' seems to be purely Emacs Lisp, and I don't think this
data is available on the Emacs Lisp level (am I wrong?), perhaps just
creating a C-level function `symbol-let-bound-p' (or something) would
allow us to issue the warning, as a first step?
        
-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




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

* Re: defvar inside let-binding
  2011-08-02 13:42               ` Lars Magne Ingebrigtsen
@ 2011-08-02 19:22                 ` Stefan Monnier
  2011-08-02 19:56                   ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2011-08-02 19:22 UTC (permalink / raw)
  To: emacs-devel

> Since `defcustom' seems to be purely Emacs Lisp, and I don't think this
> data is available on the Emacs Lisp level (am I wrong?), perhaps just
> creating a C-level function `symbol-let-bound-p' (or something) would
> allow us to issue the warning, as a first step?
        
Yes.  Tho the "next" step you suggested (to cause defvar to change the
outer let-binding) will require another such function and will make
symbol-let-bound-p unneeded.


        Stefan



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

* Re: defvar inside let-binding
  2011-08-02 19:22                 ` Stefan Monnier
@ 2011-08-02 19:56                   ` Lars Magne Ingebrigtsen
  2011-08-02 20:47                     ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-08-02 19:56 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Yes.  Tho the "next" step you suggested (to cause defvar to change the
> outer let-binding) will require another such function and will make
> symbol-let-bound-p unneeded.

Let's see...

  ;; Use defvar to set the docstring as well as the special-variable-p flag.
  ;; FIXME: We should reproduce more of `defvar's behavior, such as the warning
  ;; when the var is currently let-bound.
  (if (not (default-boundp symbol))
      ;; Don't use defvar to avoid setting a default-value when undesired.
      (when doc (put symbol 'variable-documentation doc))
    (eval `(defvar ,symbol nil ,@(when doc (list doc)))))

So what I would do here now would be to add

(when (symbol-let-bound-p symbol)
  (message "Warning: let-bound etc"))

now, and in Emacs 24.2, I'd change that to

(when (symbol-let-bound-p symbol)
  (change-outer-let-binding symbol default))

Or something along those lines?  

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



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

* Re: defvar inside let-binding
  2011-08-02 19:56                   ` Lars Magne Ingebrigtsen
@ 2011-08-02 20:47                     ` Stefan Monnier
  0 siblings, 0 replies; 13+ messages in thread
From: Stefan Monnier @ 2011-08-02 20:47 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: emacs-devel

>> Yes.  Tho the "next" step you suggested (to cause defvar to change the
>> outer let-binding) will require another such function and will make
>> symbol-let-bound-p unneeded.

> Let's see...

>   ;; Use defvar to set the docstring as well as the special-variable-p flag.
>   ;; FIXME: We should reproduce more of `defvar's behavior, such as the warning
>   ;; when the var is currently let-bound.
>   (if (not (default-boundp symbol))
>       ;; Don't use defvar to avoid setting a default-value when undesired.
>       (when doc (put symbol 'variable-documentation doc))
>     (eval `(defvar ,symbol nil ,@(when doc (list doc)))))

> So what I would do here now would be to add

> (when (symbol-let-bound-p symbol)
>   (message "Warning: let-bound etc"))

> now, and in Emacs 24.2, I'd change that to

> (when (symbol-let-bound-p symbol)
>   (change-outer-let-binding symbol default))

> Or something along those lines?  

Yes, although the above code is run after the var has been set,
i.e. too late.


        Stefan



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

end of thread, other threads:[~2011-08-02 20:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-15 14:38 bug#9090: 24.0.50; void-variable jka-compr-verbose lee
2011-07-15 17:04 ` Glenn Morris
2011-07-15 18:11   ` Lars Magne Ingebrigtsen
2011-07-15 18:20     ` Glenn Morris
2011-07-18 14:03     ` defvar inside let-binding (was: bug#9090: 24.0.50; void-variable jka-compr-verbose) Stefan Monnier
2011-07-18 14:20       ` defvar inside let-binding Lars Magne Ingebrigtsen
2011-07-18 16:18         ` Stefan Monnier
2011-07-19 16:14           ` Lars Magne Ingebrigtsen
2011-08-01 21:20             ` Stefan Monnier
2011-08-02 13:42               ` Lars Magne Ingebrigtsen
2011-08-02 19:22                 ` Stefan Monnier
2011-08-02 19:56                   ` Lars Magne Ingebrigtsen
2011-08-02 20:47                     ` Stefan Monnier

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.