Subject: M-x speedbar-get-focus fails due to a non-symbol argument to run-hooks

From: Ivan Shmakov <[email-masked]>
Date: Mon, 21 Apr 2014 18:15:14 +0000

Package:  emacs

	As of cff4b64e835d [1], M-x speedbar-get-focus RET (as called
	from, say, erc-speedbar-browser) fails with a backtrace like:

Debugger entered--Lisp error: (wrong-type-argument symbolp #[nil … [speedbar-update-flag t speedbar-timer-fn] 1])
  run-hooks(#[nil … [speedbar-update-flag t speedbar-timer-fn] 1])
  dframe-get-focus(speedbar-frame speedbar-frame-mode #[nil … [speedbar-update-flag t speedbar-timer-fn] 1])
  speedbar-get-focus()
  call-interactively(speedbar-get-focus record nil)
  command-execute(speedbar-get-focus record)
  execute-extended-command(nil "speedbar-get-focus")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

	The likely cause is that the change made last August as part of
	02d1dcff167d [2] was in fact incomplete.  Specifically, while
	dframe-get-focus was changed to allow only a hook argument (that
	is: a hook variable, as accepted by run-hooks):

index 21b5085..6696707 100644
--- a/lisp/dframe.el
+++ b/lisp/dframe.el
@@ -616,7 +622,7 @@ (defun dframe-get-focus (frame-var activator &optional hook)
     )
   (other-frame 0)
   ;; If updates are off, then refresh the frame (they want it now...)
-  (run-hooks 'hook))
+  (run-hooks hook))

 (defun dframe-close-frame ()

	At least one of its callers – speedbar-get-focus – was /not/
	updated accordingly (as of [1]):

  1061	(defun speedbar-get-focus ()
…
  1067	  (dframe-get-focus 'speedbar-frame 'speedbar-frame-mode
  1068			    (lambda () (let ((speedbar-update-flag t))
  1069					 (speedbar-timer-fn)))))

	I guess employing in speedbar-get-focus something like the
	‘conv-hook’ wrapper currently used in dframe-frame-mode will
	resolve the issue.

[1] http://git.savannah.gnu.org/cgit/emacs.git/commit/lisp/vc/ediff-diff.el?h=trunk&id=cff4b64e835d8a198ada0dcf32e69ab03642ae60
[2] http://git.savannah.gnu.org/cgit/emacs.git/commit/lisp/vc/ediff-diff.el?h=trunk&id=02d1dcff167d8ed868df68abd7a46706f8ab5f11

-- 
FSF associate member #7257