bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24959: 26.0.50; cancel-timer: void-variable timer


From: Oleg Sivokon
Subject: bug#24959: 26.0.50; cancel-timer: void-variable timer
Date: Thu, 17 Nov 2016 21:19:05 +0200

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]