unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24959: 26.0.50; cancel-timer: void-variable timer
@ 2016-11-17  9:48 Oleg Sivokon
  2016-11-17 17:08 ` Eli Zaretskii
  2016-11-17 17:11 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 13+ messages in thread
From: Oleg Sivokon @ 2016-11-17  9:48 UTC (permalink / raw)
  To: 24959


Hello,
I've built Emacs from master, commit 0588164.  Intermittently, I'm
facing this error:

Debugger entered--Lisp error: (void-variable timer)
  (cancel-timer timer)
  (condition-case err (if (let* ((--cl-var-- buffs) (buf nil) (--cl-flag-- t) --cl-var--) (while (and (consp --cl-var--) (progn (setq buf (car --cl-var--)) (setq --cl-flag-- (not ...)))) (setq --cl-var-- (cdr --cl-var--))) --cl-var--) nil (let* ((--cl-var-- buffs) (buf nil) (container nil) (contents nil)) (while (consp --cl-var--) (setq buf (car --cl-var--)) (setq container (save-current-buffer (set-buffer buf) container)) (setq contents (save-current-buffer (set-buffer buf) (buffer-substring (point-min) (point-max)))) (kill-buffer buf) (save-current-buffer (set-buffer output) (insert (format "\n\n===== %s =====\n\n" container)) (insert contents)) (setq --cl-var-- (cdr --cl-var--))) nil) (cancel-timer timer)) (error (let* ((--cl-var-- buffs) (buf nil)) (while (consp --cl-var--) (setq buf (
 car --cl-var--)) (if (buffer-live-p buf) (progn (kill-buffer buf))) (setq --cl-var-- (cdr --cl-var--))) nil) (cancel-timer timer)))
  (lambda (output buffs) (condition-case err (if (let* ((--cl-var-- buffs) (buf nil) (--cl-flag-- t) --cl-var--) (while (and (consp --cl-var--) (progn (setq buf ...) (setq --cl-flag-- ...))) (setq --cl-var-- (cdr --cl-var--))) --cl-var--) nil (let* ((--cl-var-- buffs) (buf nil) (container nil) (contents nil)) (while (consp --cl-var--) (setq buf (car --cl-var--)) (setq container (save-current-buffer (set-buffer buf) container)) (setq contents (save-current-buffer (set-buffer buf) (buffer-substring ... ...))) (kill-buffer buf) (save-current-buffer (set-buffer output) (insert (format "\n\n===== %s =====\n\n" container)) (insert contents)) (setq --cl-var-- (cdr --cl-var--))) nil) (cancel-timer timer)) (error (let* ((--cl-var-- buffs) (buf nil)) (while (consp --cl-var--) (setq buf (car --cl-var
 --)) (if (buffer-live-p buf) (progn (kill-buffer buf))) (setq --cl-var-- (cdr --cl-var--))) nil) (cancel-timer timer))))(#<killed buffer> (#<killed buffer>))
  apply((lambda (output buffs) (condition-case err (if (let* ((--cl-var-- buffs) (buf nil) (--cl-flag-- t) --cl-var--) (while (and (consp --cl-var--) (progn (setq buf ...) (setq --cl-flag-- ...))) (setq --cl-var-- (cdr --cl-var--))) --cl-var--) nil (let* ((--cl-var-- buffs) (buf nil) (container nil) (contents nil)) (while (consp --cl-var--) (setq buf (car --cl-var--)) (setq container (save-current-buffer (set-buffer buf) container)) (setq contents (save-current-buffer (set-buffer buf) (buffer-substring ... ...))) (kill-buffer buf) (save-current-buffer (set-buffer output) (insert (format "\n\n===== %s =====\n\n" container)) (insert contents)) (setq --cl-var-- (cdr --cl-var--))) nil) (cancel-timer timer)) (error (let* ((--cl-var-- buffs) (buf nil)) (while (consp --cl-var--) (setq buf (car --
 cl-var--)) (if (buffer-live-p buf) (progn (kill-buffer buf))) (setq --cl-var-- (cdr --cl-var--))) nil) (cancel-timer timer)))) (#<killed buffer> (#<killed buffer>)))
  timer-event-handler([t 22573 31397 826685 1 (lambda (output buffs) (condition-case err (if (let* ((--cl-var-- buffs) (buf nil) (--cl-flag-- t) --cl-var--) (while (and (consp --cl-var--) (progn ... ...)) (setq --cl-var-- (cdr --cl-var--))) --cl-var--) nil (let* ((--cl-var-- buffs) (buf nil) (container nil) (contents nil)) (while (consp --cl-var--) (setq buf (car --cl-var--)) (setq container (save-current-buffer ... container)) (setq contents (save-current-buffer ... ...)) (kill-buffer buf) (save-current-buffer (set-buffer output) (insert ...) (insert contents)) (setq --cl-var-- (cdr --cl-var--))) nil) (cancel-timer timer)) (error (let* ((--cl-var-- buffs) (buf nil)) (while (consp --cl-var--) (setq buf (car --cl-var--)) (if (buffer-live-p buf) (progn ...)) (setq --cl-var-- (cdr --cl-var--)
 )) nil) (cancel-timer timer)))) (#<killed buffer> (#<killed buffer>)) nil 773000])
  read-event(nil t 2)
  sit-for(2)
  execute-extended-command(nil "toggle-debug-on-error" "toggle-debug-on-er")
  funcall-interactively(execute-extended-command nil "toggle-debug-on-error" "toggle-debug-on-er")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

Unfortunately, I don't know how to find the source, but I'm afraid that
there may be a problem with Lisp interpreter (there is no way `timer' is
unbound in `cancel-timer' because it's its argument).

This problem doesn't exist in Emacs 24.5.1


In GNU Emacs 26.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)
 of 2016-11-12 built on localhost.localdomain
Repository revision: 058816441840b5229b4437ff486a243e05fc5c93
Windowing system distributor 'Fedora Project', version 11.0.11803000
System Description:	Fedora release 23 (Twenty Three)

Recent messages:
mouse-2, RET: find function's definition
uncompressing simple.el.gz...done
Mark saved where search started
uncompressing subr.el.gz...done
Mark saved where search started
mouse-2, RET: find function's definition [2 times]
Quit
mouse-2, RET: find function's definition
uncompressing timer.el.gz...done
Making completion list...

Configured using:
 'configure --with-xwidgets'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS
NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XWIDGETS

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  diff-auto-refine-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  override-global-mode: t
  vimish-fold-global-mode: t
  vimish-fold-mode: t
  ido-everywhere: t
  recentf-mode: t
  shell-dirtrack-mode: t
  global-auto-complete-mode: t
  auto-complete-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  global-hl-line-mode: t
  erc-list-mode: t
  erc-menu-mode: t
  erc-autojoin-mode: t
  erc-ring-mode: t
  erc-networks-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-match-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-move-to-prompt-mode: t
  erc-readonly-mode: t
  display-time-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-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
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
~/.emacs.d/emacs-slack/slack-buffer hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-buffer
~/.emacs.d/emacs-slack/slack-room hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-room
~/.emacs.d/emacs-slack/slack hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack
~/.emacs.d/emacs-slack/slack-websocket hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-websocket
~/.emacs.d/emacs-slack/slack-channel hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-channel
~/.emacs.d/emacs-slack/slack-user hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-user
~/.emacs.d/emacs-slack/slack-util hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-util
~/.emacs.d/emacs-slack/slack-message-sender hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-message-sender
~/.emacs.d/emacs-slack/slack-message-notification hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-message-notification
~/.emacs.d/emacs-slack/slack-request hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-request
~/.emacs.d/emacs-slack/slack-message-formatter hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-message-formatter
~/.emacs.d/emacs-slack/slack-message-editor hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-message-editor
~/.emacs.d/emacs-slack/slack-user-message hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-user-message
~/.emacs.d/emacs-slack/slack-pkg hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-pkg
~/.emacs.d/emacs-slack/slack-bot-message hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-bot-message
~/.emacs.d/emacs-slack/slack-group hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-group
~/.emacs.d/emacs-slack/slack-reply hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-reply
~/.emacs.d/emacs-slack/slack-message-reaction hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-message-reaction
~/.emacs.d/emacs-slack/slack-im hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-im
~/.emacs.d/emacs-slack/slack-reaction hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-reaction
~/.emacs.d/emacs-slack/slack-message hides /home/olegs/.emacs.d/elpa/slack-20151213.2050/slack-message
/home/olegs/.emacs.d/elpa/seq-20151121.1017/seq hides /usr/local/share/emacs/26.0.50/lisp/emacs-lisp/seq

Features:
(shadow sort mail-extr emacsbug cap-words superword subword cus-start
cus-load quail toml-mode company-go company-template company go-oracle
org-rmail org-mhe org-irc org-info org-gnus org-docview doc-view
image-mode org-bibtex bibtex org-bbdb org-w3m ssh-key epa-file linum
vc-git bookmark misearch multi-isearch debug pulse jka-compr hideshow
eieio-opt speedbar sb-image ezimage dframe conf-mode flycheck
magit-blame magit-stash magit-bisect magit-remote magit-commit
magit-sequence magit magit-apply magit-wip magit-log magit-diff
smerge-mode diff-mode magit-core magit-process magit-mode magit-git crm
magit-section magit-utils git-commit help-fns radix-tree log-edit
pcvs-util add-log with-editor tramp-sh docker docker-containers
docker-images magit-popup async-bytecomp async tabulated-list-ext
docker-process slime-fancy slime-trace-dialog slime-fontifying-fu
slime-package-fu slime-references slime-compiler-notes-tree
slime-scratch slime-presentations bridge slime-mdot-fu
slime-enclosing-context slime-fuzzy slime-fancy-trace
slime-fancy-inspector slime-c-p-c slime-editing-commands slime-autodoc
slime-repl elp slime-parse slime gud apropos arc-mode archive-mode
hyperspec browse-url slime-autoloads vlf-setup vlf vlf-base vlf-tune
use-package diminish bind-key slack slack-bot-message slack-user-message
slack-message-reaction slack-message-editor slack-message-sender
slack-websocket slack-reply websocket bindat slack-message-notification
alert log4e rx notifications dbus xml gntp slack-message-formatter
slack-im slack-user slack-channel slack-group slack-room slack-message
slack-reaction slack-buffer lui tracking shorten paren flyspell ispell
slack-util slack-request request oauth2 warnings url-http url-auth
url-gw nsm plstore tesla-mode tesla-tests tesla-docker tesla-cli
tesla-vcenter tesla-log tesla-jenkins json map docker-tramp tramp-cache
tramp tramp-compat tramp-loaddefs trampver advice term disp-table ehelp
go-implements go-mode url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap find-file ffap etags
xref project wombat-theme vimish-fold f dash s ucs-normalize
google-c-style org-mime sx ido pgg pgg-parse pgg-def dired-x recentf
tree-widget ox-latex ox-icalendar ox-html ox-ascii ox-publish ox
org-element help-at-pt ob-gnuplot ob-C cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs cl ob-calc
calc-store calc-trail calc-ext calc calc-loaddefs calc-macs ob-sh shell
ob-sqlite ob-python ob-sql ob-latex auto-complete-config auto-complete
popup eieio-compat undo-tree diff hl-line erc-list erc-menu erc-join
erc-ring erc-networks erc-pcomplete erc-track erc-match erc-button
erc-fill erc-stamp erc-netsplit erc-goodies erc erc-backend erc-compat
thingatpt pp smtpmail sendmail nnir gnus-sum gnus-group gnus-undo
gnus-start gnus-cloud nnimap nnmail mail-source tls gnutls utf7 netrc
parse-time gnus-spec gnus-int gnus-range message puny rfc822 mml mml-sec
epa derived epg mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader gnus-win gnus wid-edit nnoo nnheader
subr-x gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils flymake-gjshint flymake compile js-comint dired
dired-loaddefs finder-inf go-mode-autoloads edmacro kmacro imenu info
package epg-config url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache url-vars server time
org org-macro org-footnote org-pcomplete pcomplete org-list org-faces
org-entities noutline outline easy-mmode org-version ob-emacs-lisp ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-src ob-keys ob-comint comint
ansi-color ring ob-core ob-eval org-compat org-macs org-loaddefs
format-spec find-func seq byte-opt gv bytecomp byte-compile cl-extra
help-mode cconv cl-loaddefs pcase cl-lib cal-menu easymenu calendar
cal-loaddefs time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese charscript case-table epa-hook
jka-cmpr-hook help simple abbrev obarray minibuffer cl-preloaded nadvice
loaddefs button faces cus-face macroexp files text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote dbusbind inotify dynamic-setting
system-font-setting font-render-setting xwidget-internal move-toolbar
gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 840391 105352)
 (symbols 48 64391 45)
 (miscs 40 1550 1854)
 (strings 32 168185 12204)
 (string-bytes 1 5134563)
 (vectors 16 84347)
 (vector-slots 8 1266746 40676)
 (floats 8 861 732)
 (intervals 56 16340 4601)
 (buffers 976 43)
 (heap 1024 84167 2862))





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

* bug#24959: 26.0.50; cancel-timer: void-variable timer
  2016-11-17  9:48 bug#24959: 26.0.50; cancel-timer: void-variable timer Oleg Sivokon
@ 2016-11-17 17:08 ` Eli Zaretskii
  2016-11-17 17:11 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 13+ messages in thread
From: Eli Zaretskii @ 2016-11-17 17:08 UTC (permalink / raw)
  To: Oleg Sivokon; +Cc: 24959

> From: Oleg Sivokon <oleg.sivokon@elastifile.com>
> Date: Thu, 17 Nov 2016 11:48:11 +0200
> 
> Unfortunately, I don't know how to find the source

Grep your ~/.emacs and locally installed packaged for this snippet:

  (insert (format "\n\n===== %s =====\n\n" container))

and you will likely find the culprit

> but I'm afraid that
> there may be a problem with Lisp interpreter (there is no way `timer' is
> unbound in `cancel-timer' because it's its argument).

I think it is unbound in the form that call cancel-timer.





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

* bug#24959: 26.0.50; cancel-timer: void-variable timer
  2016-11-17  9:48 bug#24959: 26.0.50; cancel-timer: void-variable timer Oleg Sivokon
  2016-11-17 17:08 ` Eli Zaretskii
@ 2016-11-17 17:11 ` Lars Ingebrigtsen
  2016-11-17 17:55   ` Oleg Sivokon
  1 sibling, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2016-11-17 17:11 UTC (permalink / raw)
  To: Oleg Sivokon; +Cc: 24959

Oleg Sivokon <oleg.sivokon@elastifile.com> writes:

> Debugger entered--Lisp error: (void-variable timer)
>   (cancel-timer timer)
>   (condition-case err (if (let* ((--cl-var-- buffs) (buf nil) (--cl-flag-- t) --cl-var--) (while (and (consp --cl-var--) (progn (setq buf (car --cl-var--)) (setq --cl-flag-- (not ...)))) (setq --cl-var-- (cdr --cl-var--))) --cl-var--) nil (let* ((--cl-var-- buffs) (buf nil) (container nil) (contents nil)) (while (consp --cl-var--) (setq buf (car --cl-var--)) (setq container (save-current-buffer (set-buffer buf) container)) (setq contents (save-current-buffer (set-buffer buf) (buffer-substring (point-min) (point-max)))) (kill-buffer buf) (save-current-buffer (set-buffer output) (insert (format "\n\n===== %s =====\n\n" container)) (insert contents)) (setq --cl-var-- (cdr --cl-var--))) nil) (cancel-timer timer)) (error (let* ((--cl-var-- buffs) (buf nil)) (while (consp --cl-var--) (setq buf
 

I've grepped around the Emacs sources a bit, and I'm unable to find a
string like "===== %s =====" or "setq container" anywhere in Emacs.

Could this be from a local package you've installed?  

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





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

* bug#24959: 26.0.50; cancel-timer: void-variable timer
  2016-11-17 17:11 ` Lars Ingebrigtsen
@ 2016-11-17 17:55   ` Oleg Sivokon
  2016-11-17 17:56     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Oleg Sivokon @ 2016-11-17 17:55 UTC (permalink / raw)
  To: Lars Ingebrigtsen, eliz; +Cc: 24959

Eli, Lars,

I know what the timer handler is. I'm not sure how to interpret the
backtrace then: did it or did it not enter the cancel-timer function?
I thought it did, and this is why I filed this ticket.

More background (this applies if the backtrace says that cancel-timer
was not entered):
The code in the handler relies on the code that sets up the timer to
create a special variable "timer". This variable is created by calling
setq (but no defvar). setq used to make variable special, if it wasn't
already let-bound. Now it seems like this behavior has changed. Does
this make sense?

On Thu, Nov 17, 2016 at 7:11 PM, Lars Ingebrigtsen <larsi@gnus.org> wrote:
> Oleg Sivokon <oleg.sivokon@elastifile.com> writes:
>
>> Debugger entered--Lisp error: (void-variable timer)
>>   (cancel-timer timer)
>>   (condition-case err (if (let* ((--cl-var-- buffs) (buf nil) (--cl-flag-- t) --cl-var--) (while (and (consp --cl-var--) (progn (setq buf (car --cl-var--)) (setq --cl-flag-- (not ...)))) (setq --cl-var-- (cdr --cl-var--))) --cl-var--) nil (let* ((--cl-var-- buffs) (buf nil) (container nil) (contents nil)) (while (consp --cl-var--) (setq buf (car --cl-var--)) (setq container (save-current-buffer (set-buffer buf) container)) (setq contents (save-current-buffer (set-buffer buf) (buffer-substring (point-min) (point-max)))) (kill-buffer buf) (save-current-buffer (set-buffer output) (insert (format "\n\n===== %s =====\n\n" container)) (insert contents)) (setq --cl-var-- (cdr --cl-var--))) nil) (cancel-timer timer)) (error (let* ((--cl-var-- buffs) (buf nil)) (while (consp --cl-var--) (setq buf
>
> I've grepped around the Emacs sources a bit, and I'm unable to find a
> string like "===== %s =====" or "setq container" anywhere in Emacs.
>
> Could this be from a local package you've installed?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no





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

* bug#24959: 26.0.50; cancel-timer: void-variable timer
  2016-11-17 17:55   ` Oleg Sivokon
@ 2016-11-17 17:56     ` Lars Ingebrigtsen
  2016-11-17 18:00       ` Oleg Sivokon
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2016-11-17 17:56 UTC (permalink / raw)
  To: Oleg Sivokon; +Cc: 24959

Oleg Sivokon <oleg.sivokon@elastifile.com> writes:

> The code in the handler relies on the code that sets up the timer to
> create a special variable "timer". This variable is created by calling
> setq (but no defvar). setq used to make variable special, if it wasn't
> already let-bound. Now it seems like this behavior has changed. Does
> this make sense?

You need to find the code that created the timer.  If you find it and
post it here, we may be able to tell what's wrong with it.

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





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

* bug#24959: 26.0.50; cancel-timer: void-variable timer
  2016-11-17 17:56     ` Lars Ingebrigtsen
@ 2016-11-17 18:00       ` Oleg Sivokon
  2016-11-17 18:03         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Oleg Sivokon @ 2016-11-17 18:00 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 24959

Lars,

Simplified version looks like this:

(setq timer (run-at-time 1 1 (lambda () (cancel-timer timer)))

The version that does work looks like this:

(let ((timer [nil]))
  (aset timer 0 (run-at-time 1 1 (lambda (timer) (cancel-timer (aref
timer 0))) timer))

On Thu, Nov 17, 2016 at 7:56 PM, Lars Ingebrigtsen <larsi@gnus.org> wrote:
> Oleg Sivokon <oleg.sivokon@elastifile.com> writes:
>
>> The code in the handler relies on the code that sets up the timer to
>> create a special variable "timer". This variable is created by calling
>> setq (but no defvar). setq used to make variable special, if it wasn't
>> already let-bound. Now it seems like this behavior has changed. Does
>> this make sense?
>
> You need to find the code that created the timer.  If you find it and
> post it here, we may be able to tell what's wrong with it.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no





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

* bug#24959: 26.0.50; cancel-timer: void-variable timer
  2016-11-17 18:00       ` Oleg Sivokon
@ 2016-11-17 18:03         ` Lars Ingebrigtsen
  2016-11-17 18:06           ` Oleg Sivokon
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2016-11-17 18:03 UTC (permalink / raw)
  To: Oleg Sivokon; +Cc: 24959

Oleg Sivokon <oleg.sivokon@elastifile.com> writes:

> Lars,
>
> Simplified version looks like this:
>
> (setq timer (run-at-time 1 1 (lambda () (cancel-timer timer)))
>
> The version that does work looks like this:
>
> (let ((timer [nil]))
>   (aset timer 0 (run-at-time 1 1 (lambda (timer) (cancel-timer (aref
> timer 0))) timer))

This will only work if you're using lexical binding -- otherwise that
`timer' in the lambda will be unbound when the lambda is called.

Is there a -*- lexical-binding: t -*- on the first line of the file in
question?

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





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

* bug#24959: 26.0.50; cancel-timer: void-variable timer
  2016-11-17 18:03         ` Lars Ingebrigtsen
@ 2016-11-17 18:06           ` Oleg Sivokon
  2016-11-17 18:09             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Oleg Sivokon @ 2016-11-17 18:06 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 24959

Lars,

No, I don't use lexical bindings in this code. But, my point is that
the behavior of setq used to be to make variable special (i.e.
universaly accessible, like global, except it can be let-bound
temporarily), which it doesn't seem to do anymore. Is this change
intentional? I still didn't go over the entire changelog, but on the
surface of it, I didn't see this mentioned.

On Thu, Nov 17, 2016 at 8:03 PM, Lars Ingebrigtsen <larsi@gnus.org> wrote:
> Oleg Sivokon <oleg.sivokon@elastifile.com> writes:
>
>> Lars,
>>
>> Simplified version looks like this:
>>
>> (setq timer (run-at-time 1 1 (lambda () (cancel-timer timer)))
>>
>> The version that does work looks like this:
>>
>> (let ((timer [nil]))
>>   (aset timer 0 (run-at-time 1 1 (lambda (timer) (cancel-timer (aref
>> timer 0))) timer))
>
> This will only work if you're using lexical binding -- otherwise that
> `timer' in the lambda will be unbound when the lambda is called.
>
> Is there a -*- lexical-binding: t -*- on the first line of the file in
> question?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no





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

* bug#24959: 26.0.50; cancel-timer: void-variable timer
  2016-11-17 18:06           ` Oleg Sivokon
@ 2016-11-17 18:09             ` Lars Ingebrigtsen
  2016-11-17 19:14               ` Oleg Sivokon
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2016-11-17 18:09 UTC (permalink / raw)
  To: Oleg Sivokon; +Cc: 24959

Oleg Sivokon <oleg.sivokon@elastifile.com> writes:

> No, I don't use lexical bindings in this code. But, my point is that
> the behavior of setq used to be to make variable special (i.e.
> universaly accessible, like global, except it can be let-bound
> temporarily), which it doesn't seem to do anymore.

It does for me.

[...]

>>> (setq timer (run-at-time 1 1 (lambda () (cancel-timer timer)))

You've forgotten an end parentheses there.  If I add one and eval the
form, it works fine for me.

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





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

* bug#24959: 26.0.50; cancel-timer: void-variable timer
  2016-11-17 18:09             ` Lars Ingebrigtsen
@ 2016-11-17 19:14               ` Oleg Sivokon
  2016-11-17 19:19                 ` Oleg Sivokon
  0 siblings, 1 reply; 13+ messages in thread
From: Oleg Sivokon @ 2016-11-17 19:14 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 24959

Lars,
I'll need to experiement with this then. My hunch is that when this
happens inside condition-case, the things don't work exactly the same.
I'll try to come up with a minimal example for the problem.

On Thu, Nov 17, 2016 at 8:09 PM, Lars Ingebrigtsen <larsi@gnus.org> wrote:
> Oleg Sivokon <oleg.sivokon@elastifile.com> writes:
>
>> No, I don't use lexical bindings in this code. But, my point is that
>> the behavior of setq used to be to make variable special (i.e.
>> universaly accessible, like global, except it can be let-bound
>> temporarily), which it doesn't seem to do anymore.
>
> It does for me.
>
> [...]
>
>>>> (setq timer (run-at-time 1 1 (lambda () (cancel-timer timer)))
>
> You've forgotten an end parentheses there.  If I add one and eval the
> form, it works fine for me.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no





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

* bug#24959: 26.0.50; cancel-timer: void-variable timer
  2016-11-17 19:14               ` Oleg Sivokon
@ 2016-11-17 19:19                 ` Oleg Sivokon
  2016-11-17 19:22                   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 13+ messages in thread
From: Oleg Sivokon @ 2016-11-17 19:19 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 24959

But, before I find one, here's the original code that caused the problem:

(defun tesla-do-containers (command &optional need-refresh output)
  (let (temp-buffs timer)
    (unwind-protect
        (cl-loop for container being the hash-value of tesla-makred-containers
                 for buf = (get-buffer-create
(generate-new-buffer-name "*tesla-temp*"))
                 do (with-current-buffer buf
                      (set (make-local-variable 'container)
                           (format "%s:%s"
                                   (docker-container-loader container)
                                   (docker-container-names container))))
                 (funcall command container buf)
                 (push buf temp-buffs))
      (when output
        (setq timer
              (run-at-time
               1 1
               (lambda (output buffs)
                 (condition-case err
                     (unless
                         (cl-loop for buf in buffs
                                  thereis (get-buffer-process buf))
                       (cl-loop for buf in buffs
                                for container = (with-current-buffer
buf container)
                                for contents =
                                (with-current-buffer buf
                                  (buffer-substring (point-min) (point-max))) do
                                  (kill-buffer buf)
                                  (with-current-buffer output
                                    (insert (format "\n\n===== %s
=====\n\n" container))
                                    (insert contents)))
                       (cancel-timer timer))
                   (error
                    (cl-loop for buf in buffs
                             when (buffer-live-p buf) do
                             (kill-buffer buf))
                    (cancel-timer timer))))
               output temp-buffs)))
      (when need-refresh
(tesla-list-containers)))))

On Thu, Nov 17, 2016 at 9:14 PM, Oleg Sivokon
<oleg.sivokon@elastifile.com> wrote:
> Lars,
> I'll need to experiement with this then. My hunch is that when this
> happens inside condition-case, the things don't work exactly the same.
> I'll try to come up with a minimal example for the problem.
>
> On Thu, Nov 17, 2016 at 8:09 PM, Lars Ingebrigtsen <larsi@gnus.org> wrote:
>> Oleg Sivokon <oleg.sivokon@elastifile.com> writes:
>>
>>> No, I don't use lexical bindings in this code. But, my point is that
>>> the behavior of setq used to be to make variable special (i.e.
>>> universaly accessible, like global, except it can be let-bound
>>> temporarily), which it doesn't seem to do anymore.
>>
>> It does for me.
>>
>> [...]
>>
>>>>> (setq timer (run-at-time 1 1 (lambda () (cancel-timer timer)))
>>
>> You've forgotten an end parentheses there.  If I add one and eval the
>> form, it works fine for me.
>>
>> --
>> (domestic pets only, the antidote for overdose, milk.)
>>    bloggy blog: http://lars.ingebrigtsen.no





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

* bug#24959: 26.0.50; cancel-timer: void-variable timer
  2016-11-17 19:19                 ` Oleg Sivokon
@ 2016-11-17 19:22                   ` Lars Ingebrigtsen
  2016-11-17 19:24                     ` Oleg Sivokon
  0 siblings, 1 reply; 13+ messages in thread
From: Lars Ingebrigtsen @ 2016-11-17 19:22 UTC (permalink / raw)
  To: Oleg Sivokon; +Cc: 24959

Oleg Sivokon <oleg.sivokon@elastifile.com> writes:

> (defun tesla-do-containers (command &optional need-refresh output)
>   (let (temp-buffs timer)

[...]

>         (setq timer
>               (run-at-time
>                1 1
>                (lambda (output buffs)

[...]

>                        (cancel-timer timer))

This can't work.  You're setting a locally bound variable, and then
you're running the lambda in a different context afterwards.

Start using lexical bindings, and it'll work.

In any case, this doesn't look like an Emacs bug, and I'm closing this
bug report.

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





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

* bug#24959: 26.0.50; cancel-timer: void-variable timer
  2016-11-17 19:22                   ` Lars Ingebrigtsen
@ 2016-11-17 19:24                     ` Oleg Sivokon
  0 siblings, 0 replies; 13+ messages in thread
From: Oleg Sivokon @ 2016-11-17 19:24 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 24959

Oh, I missed it was declared locally, my bad.
Sure, I wonder how did it work earlier.
Thanks for responses!

On Thu, Nov 17, 2016 at 9:22 PM, Lars Ingebrigtsen <larsi@gnus.org> wrote:
> Oleg Sivokon <oleg.sivokon@elastifile.com> writes:
>
>> (defun tesla-do-containers (command &optional need-refresh output)
>>   (let (temp-buffs timer)
>
> [...]
>
>>         (setq timer
>>               (run-at-time
>>                1 1
>>                (lambda (output buffs)
>
> [...]
>
>>                        (cancel-timer timer))
>
> This can't work.  You're setting a locally bound variable, and then
> you're running the lambda in a different context afterwards.
>
> Start using lexical bindings, and it'll work.
>
> In any case, this doesn't look like an Emacs bug, and I'm closing this
> bug report.
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2016-11-17 19:24 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-17  9:48 bug#24959: 26.0.50; cancel-timer: void-variable timer Oleg Sivokon
2016-11-17 17:08 ` Eli Zaretskii
2016-11-17 17:11 ` Lars Ingebrigtsen
2016-11-17 17:55   ` Oleg Sivokon
2016-11-17 17:56     ` Lars Ingebrigtsen
2016-11-17 18:00       ` Oleg Sivokon
2016-11-17 18:03         ` Lars Ingebrigtsen
2016-11-17 18:06           ` Oleg Sivokon
2016-11-17 18:09             ` Lars Ingebrigtsen
2016-11-17 19:14               ` Oleg Sivokon
2016-11-17 19:19                 ` Oleg Sivokon
2016-11-17 19:22                   ` Lars Ingebrigtsen
2016-11-17 19:24                     ` Oleg Sivokon

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).