Installation woes: requirement orderings and gnus-summary-article-number
Exactly what needs to be loaded before running (require 'gnorb) ?
After experimenting with emacs -Q ; the gnorb from elpa ; and the gnorb from github, I now believe the following things:
-
You must (require 'gnorb) or you can't do (gnorb-tracking-initialize)
-
Before (require 'gnorb), you must (require 'gnus), or you get Lisp error: (void-variable gnus-mime-action-alist)
-
Before (require 'gnorb) you must have bbdb in the load path, or you get Lisp error: (file-error "Cannot open load file" "bbdb"))
-
Before (require 'gnorb), you must (gnus-registry-initialize), or you get Lisp error: (void-variable gnus-mime-action-alist)
I am now able to run (require 'gnorb) in my init file, and to run (gnorb-tracking-initialize) in my .gnus. However, if I call (gnorb-gnus-incoming-do-todo) in a gnus summary buffer, I currently get "Invalid function: gnus-summary-article-number".
If I ask the help system about gnus-summary-article-number, it tells me that:
""" gnus-summary-article-number is an autoloaded Lisp macro in `gnus-sum.el'.
(gnus-summary-article-number)
The article number of the article on the current line. If there isn't an article number here, then we return the current article number. """
...so I'm a bit confused as to why it seems to be an invalid function for gnorb.
Should I be requiring more or different things? Or in a different order?
Should I be requiring more or different things? Or in a different order?
The correct answer to this is, you shouldn't have to worry about it! It means I've set the dependency chain up incorrectly. In the next version, which I expect to publish shortly:
- I've autoloaded gnorb-registry-initialize, so that should be fine
- I've re-arranged the require chains, so that all the libraries are loaded only as you use them, and aren't loaded at all if they're not present. What I hope this means is that, if you don't have BBDB installed at all, Gnorb won't complain unless you try to use one of the autoloaded functions from gnorb-bbdb.el. At least, that's what I hope I've done.
- I have no idea how gnus-summary-article-number could be undefined if you're already in the Gnus summary buffer! My only guess is that it has something to do with my use of gnus-interactive. Can you tell me your Gnus version?
Thanks! I'll have a further play.
My gnus version is 5.13. I did try calling gnus-summary-article-number (using M-:) directly in the summary buffer where I was trying to run the gnorb-gnus-incoming-do-todo. It returned a sensible-looking value.
Thanks again.
Okay, I'll assume that using gnus-interactive is a bad idea, and just do it by hand. Take a look in a day or so when I push that up....
Thanks!
I just tried with commit 321b23b Remove gnus-interactive -- and gnorb-gnus-incoming-do-todo now seems to work. Thanks!
As for requirements -- the only gnorb thing I now need to require is 'gnorb -- so that's great. I have (gnorb-tracking-initialize) in my .gnus file, and this only works if I do (require 'gnus) before calling M-x gnus. So I now have (require 'gnus) in my init file, and all is good.
Thanks again.
I'm glad the gnus-interactive thing is solved, but the issue's not quite done if you still need to require things in a certain order! Can you tell me what goes wrong if you've got gnorb-tracking-initialize in .gnus, but don't (require 'gnus) before starting gnus? You shouldn't have to do that...
I get the following stacktrace.
This is from a config where I require gnorb in my main init, and then do (gnus-registry-initialize) and then (gnorb-tracking-initialize) in my .gnus file. My workaround is to do (require 'gnus) and (gnus-registry-initialize) in my main init.
Debugger entered--Lisp error: (void-variable gnus-mime-action-alist)
(cons (quote ("attach to org heading" . gnorb-gnus-mime-org-attach)) gnus-mime-action-alist)
(setq gnus-mime-action-alist (cons (quote ("attach to org heading" . gnorb-gnus-mime-org-attach)) gnus-mime-action-alist))
(progn (define-key gnus-summary-mime-map "a" (quote gnorb-gnus-article-org-attach)) (define-key gnus-summary-mode-map (kbd "C-c t") (quote gnorb-gnus-incoming-do-todo)) (setq gnus-mime-action-alist (cons (quote ("attach to org heading" . gnorb-gnus-mime-org-attach)) gnus-mime-action-alist)) (setq gnus-mime-button-commands (cons (quote (gnorb-gnus-mime-org-attach "a" "Attach to Org heading")) gnus-mime-button-commands)) (setq gnus-mime-button-map (let ((map (make-sparse-keymap))) (define-key map gnus-mouse-2 (quote gnus-article-push-button)) (define-key map gnus-down-mouse-3 (quote gnus-mime-button-menu)) (let ((--dolist-tail-- gnus-mime-button-commands)) (while --dolist-tail-- (let ((c ...)) (define-key map (cadr c) (car c)) (setq --dolist-tail-- (cdr --dolist-tail--))))) map)))
(closure (t) nil (progn (define-key gnus-summary-mime-map "a" (quote gnorb-gnus-article-org-attach)) (define-key gnus-summary-mode-map (kbd "C-c t") (quote gnorb-gnus-incoming-do-todo)) (setq gnus-mime-action-alist (cons (quote ("attach to org heading" . gnorb-gnus-mime-org-attach)) gnus-mime-action-alist)) (setq gnus-mime-button-commands (cons (quote (gnorb-gnus-mime-org-attach "a" "Attach to Org heading")) gnus-mime-button-commands)) (setq gnus-mime-button-map (let ((map (make-sparse-keymap))) (define-key map gnus-mouse-2 (quote gnus-article-push-button)) (define-key map gnus-down-mouse-3 (quote gnus-mime-button-menu)) (let ((--dolist-tail-- gnus-mime-button-commands)) (while --dolist-tail-- (let (...) (define-key map ... ...) (setq --dolist-tail-- ...)))) map))))()
funcall((closure (t) nil (progn (define-key gnus-summary-mime-map "a" (quote gnorb-gnus-article-org-attach)) (define-key gnus-summary-mode-map (kbd "C-c t") (quote gnorb-gnus-incoming-do-todo)) (setq gnus-mime-action-alist (cons (quote ("attach to org heading" . gnorb-gnus-mime-org-attach)) gnus-mime-action-alist)) (setq gnus-mime-button-commands (cons (quote (gnorb-gnus-mime-org-attach "a" "Attach to Org heading")) gnus-mime-button-commands)) (setq gnus-mime-button-map (let ((map (make-sparse-keymap))) (define-key map gnus-mouse-2 (quote gnus-article-push-button)) (define-key map gnus-down-mouse-3 (quote gnus-mime-button-menu)) (let ((--dolist-tail-- gnus-mime-button-commands)) (while --dolist-tail-- (let (...) (define-key map ... ...) (setq --dolist-tail-- ...)))) map)))))
mapc(funcall ((closure (t) nil (progn (define-key gnus-summary-mime-map "a" (quote gnorb-gnus-article-org-attach)) (define-key gnus-summary-mode-map (kbd "C-c t") (quote gnorb-gnus-incoming-do-todo)) (setq gnus-mime-action-alist (cons (quote ("attach to org heading" . gnorb-gnus-mime-org-attach)) gnus-mime-action-alist)) (setq gnus-mime-button-commands (cons (quote (gnorb-gnus-mime-org-attach "a" "Attach to Org heading")) gnus-mime-button-commands)) (setq gnus-mime-button-map (let ((map (make-sparse-keymap))) (define-key map gnus-mouse-2 (quote gnus-article-push-button)) (define-key map gnus-down-mouse-3 (quote gnus-mime-button-menu)) (let ((--dolist-tail-- gnus-mime-button-commands)) (while --dolist-tail-- (let ... ... ...))) map))))))
do-after-load-evaluation("/home/gds/Documents/code/gnorb/gnorb-gnus.el")
load-with-code-conversion("/home/gds/Documents/code/gnorb/gnorb-gnus.el" "/home/gds/Documents/code/gnorb/gnorb-gnus.el" nil t)
require(gnorb-gnus)
(lambda nil (require (quote nngnorb)) (require (quote gnorb-gnus)) (require (quote gnorb-registry)))()
eval-after-load-helper("/usr/share/emacs/24.4/lisp/gnus/gnus.elc")
run-hook-with-args(eval-after-load-helper "/usr/share/emacs/24.4/lisp/gnus/gnus.elc")
do-after-load-evaluation("/usr/share/emacs/24.4/lisp/gnus/gnus.elc")
autoload-do-load((autoload "gnus" 1029773 t nil) gnus)
command-execute(gnus record)
execute-extended-command(nil "gnus")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
Okay, thanks. If you're using the recommended keybindings taken from the manual, the part that's currently hidden behind (eval-after-load "gnorb-gnus"...) should just be switched to (eval-after-load "gnus ...) instead. All the gnorb-gnus stuff is autoloaded anyway, so that should be sufficient to let everything load at the right time, without any special effort from you.
On 10/25/14 12:53 PM, Gareth Smith wrote:
I get the following stacktrace.
This is from a config where I require gnorb in my main init, and then do (gnus-registry-initialize) and then (gnorb-tracking-initialize) in my .gnus file. My workaround is to do (require 'gnus) and (gnus-registry-initialize) in my main init.
Debugger entered--Lisp error: (void-variable gnus-mime-action-alist) (cons (quote ("attach to org heading" . gnorb-gnus-mime-org-attach)) gnus-mime-action-alist) (setq gnus-mime-action-alist (cons (quote ("attach to org heading" . gnorb-gnus-mime-org-attach)) gnus-mime-action-alist)) (progn (define-key gnus-summary-mime-map "a" (quote gnorb-gnus-article-org-attach)) (define-key gnus-summary-mode-map (kbd "C-c t") (quote gnorb-gnus-incoming-do-todo)) (setq gnus-mime-action-alist (cons (quote ("attach to org heading" . gnorb-gnus-mime-org -attach)) gnus-mime-action-alist)) (setq gnus-mime-button-commands (cons (quote (gnorb-gnus-mime-org-attach "a" "Attach to Org heading")) gnus-mime-button-commands)) (setq gnus-mime-button-map (let ((map (make-sparse-keymap))) (define-key map gnus-mouse-2 (quote gnus-article-push-button)) (define-key map gnus-down-mouse-3 (quote gnus-mime-button-menu)) (let ((--dolist-tail-- gnus-mime-button-commands)) (while --dolist-tail-- (let ((c ...)) (define-key map (cadr c)</span
(car c)) (setq --dolist-tail-- (cdr --dolist-tail--))))) map))) (closure (t) nil (progn (define-key gnus-summary-mime-map "a" (quote gnorb-gnus-article-org-attach)) (define-key gnus-summary-mode-map (kbd "C-c t") (quote gnorb-gnus-incoming-do-todo)) (setq gnus-mime-action-alist (cons (quote ("attach to org heading" . gnorb-gnus-mime-org-attach)) gnus-mime-action-alist)) (setq gnus-mime-button-commands (cons (quote (gnorb-gnus-mime-org-attach "a" "Attach to Org heading")) gnus-mime-button-commands)) (setq gnus-mime-button-map (let ((map (make-sparse-keymap))) (define-key map gnus-mouse-2 (quote gnus-article-push-button)) (define-key map gnus-down-mouse-3 (quote gnus-mime-button-menu)) (let ((--dolist-tail-- gnus-mime-button-commands)) (while --dolist-tail-- (let (...) (define-key map ... ...) (setq --dolist-tail-- ...)))) map))))() funcall((closure (t) nil (progn (define-key gnus-summary-mime-map "a" (quote gnorb-gnus-article-org-attach)) (define-key gnus-summary-mode-map (kbd "C-c t") (quote gnorb-gnus-incoming-do-todo)) (setq gnus-mime-action-alist (cons (quote ("attach to org heading" . gnorb-gnus-mime-org-attach)) gnus-mime-action-alist)) (setq gnus-mime-button-commands (cons (quote (gnorb-gnus-mime-org-attach "a" "Attach to Org heading")) gnus-mime-button-commands)) (setq gnus-mime-button-map (let ((map (make-sparse-keymap))) (define-key map gnus-mouse-2 (quote gnus-article-push-button)) (define-key map gnus-down-mouse-3 (quote gnus-mime-button-menu)) (let ((--dolist-tail-- gnus-mime-button-commands)) (while --dolist-tail-- (let (...) (define-key map ... ...) (setq --dolist-tail-- ...)))) map))))) mapc(funcall ((closure (t) nil (progn (define-key gnus-summary-mime-map "a" (quote gnorb-gnus-article-org-attach)) (define-key gnus-summary-mode-map (kbd "C-c t") (quote gnorb-gnus-incoming-do-todo)) (setq gnus-mime-action-alist (cons (quote ("attach to org heading" . gnorb-gnus-mime-org-attach)) gnus-mime-action-alist)) (setq gnus-mime-button-commands (cons (quote (gnorb-gnus-mime-org-attach "a" "Attach to Org heading")) gnus-mime-button-commands)) (setq gnus-mime-button-map (let ((map (make-sparse-keymap))) (define-key map gnus-mouse-2 (quote gnus-article-push-button)) (define-key map gnus-down-mouse-3 (quote gnus-mime-button-menu)) (let ((--dolist-tail-- gnus-mime-button-commands)) (while --dolist-tail-- (let ... ...</ span> ...))) map)))))) do-after-load-evaluation("/home/gds/Documents/code/gnorb/gnorb-gnus.el") load-with-code-conversion("/home/gds/Documents/code/gnorb/gnorb-gnus.el" "/home/gds/Documents/code/gnorb/gnorb-gnus.el" nil t) require(gnorb-gnus) (lambda nil (require (quote nngnorb)) (require (quote gnorb-gnus)) (require (quote gnorb-registry)))() eval-after-load-helper("/usr/share/emacs/24.4/lisp/gnus/gnus.elc") run-hook-with-args(eval-after-load-helper "/usr/share/emacs/24.4/lisp/gnus/gnus.elc") do-after-load-evaluation("/usr/share/emacs/24.4/lisp/gnus/gnus.elc") autoload-do-load((autoload "gnus" 1029773 t nil) gnus) command-execute(gnus record) execute-extended-command(nil "gnus") call-interactively(execute-extended-command nil nil) command-execute(execute-extended-command)
Reply to this email directly or view it on GitHub.*
Thanks! -- but I'm afraid I now get the following. I've tried commit 321b23b, with the two-line change you suggested elsewhere to fix gnorb-view and also fd91084. I'm running gnus 5.13 with emacs 24.4.1
Debugger entered--Lisp error: (void-variable gnus-summary-mime-map)
(define-key gnus-summary-mime-map "a" (quote gnorb-gnus-article-org-attach))
(progn (define-key gnus-summary-mime-map "a" (quote gnorb-gnus-article-org-attach)) (define-key gnus-summary-mode-map (kbd "C-c t") (quote gnorb-gnus-incoming-do-todo)) (setq gnus-mime-action-alist (cons (quote ("attach to org heading" . gnorb-gnus-mime-org-attach)) gnus-mime-action-alist)) (setq gnus-mime-button-commands (cons (quote (gnorb-gnus-mime-org-attach "a" "Attach to Org heading")) gnus-mime-button-commands)) (setq gnus-mime-button-map (let ((map (make-sparse-keymap))) (define-key map gnus-mouse-2 (quote gnus-article-push-button)) (define-key map gnus-down-mouse-3 (quote gnus-mime-button-menu)) (let ((--dolist-tail-- gnus-mime-button-commands)) (while --dolist-tail-- (let ((c ...)) (define-key map (cadr c) (car c)) (setq --dolist-tail-- (cdr --dolist-tail--))))) map)))
(closure (t) nil (progn (define-key gnus-summary-mime-map "a" (quote gnorb-gnus-article-org-attach)) (define-key gnus-summary-mode-map (kbd "C-c t") (quote gnorb-gnus-incoming-do-todo)) (setq gnus-mime-action-alist (cons (quote ("attach to org heading" . gnorb-gnus-mime-org-attach)) gnus-mime-action-alist)) (setq gnus-mime-button-commands (cons (quote (gnorb-gnus-mime-org-attach "a" "Attach to Org heading")) gnus-mime-button-commands)) (setq gnus-mime-button-map (let ((map (make-sparse-keymap))) (define-key map gnus-mouse-2 (quote gnus-article-push-button)) (define-key map gnus-down-mouse-3 (quote gnus-mime-button-menu)) (let ((--dolist-tail-- gnus-mime-button-commands)) (while --dolist-tail-- (let (...) (define-key map ... ...) (setq --dolist-tail-- ...)))) map))))()
funcall((closure (t) nil (progn (define-key gnus-summary-mime-map "a" (quote gnorb-gnus-article-org-attach)) (define-key gnus-summary-mode-map (kbd "C-c t") (quote gnorb-gnus-incoming-do-todo)) (setq gnus-mime-action-alist (cons (quote ("attach to org heading" . gnorb-gnus-mime-org-attach)) gnus-mime-action-alist)) (setq gnus-mime-button-commands (cons (quote (gnorb-gnus-mime-org-attach "a" "Attach to Org heading")) gnus-mime-button-commands)) (setq gnus-mime-button-map (let ((map (make-sparse-keymap))) (define-key map gnus-mouse-2 (quote gnus-article-push-button)) (define-key map gnus-down-mouse-3 (quote gnus-mime-button-menu)) (let ((--dolist-tail-- gnus-mime-button-commands)) (while --dolist-tail-- (let (...) (define-key map ... ...) (setq --dolist-tail-- ...)))) map)))))
mapc(funcall ((closure (t) nil (progn (define-key gnus-summary-mime-map "a" (quote gnorb-gnus-article-org-attach)) (define-key gnus-summary-mode-map (kbd "C-c t") (quote gnorb-gnus-incoming-do-todo)) (setq gnus-mime-action-alist (cons (quote ("attach to org heading" . gnorb-gnus-mime-org-attach)) gnus-mime-action-alist)) (setq gnus-mime-button-commands (cons (quote (gnorb-gnus-mime-org-attach "a" "Attach to Org heading")) gnus-mime-button-commands)) (setq gnus-mime-button-map (let ((map (make-sparse-keymap))) (define-key map gnus-mouse-2 (quote gnus-article-push-button)) (define-key map gnus-down-mouse-3 (quote gnus-mime-button-menu)) (let ((--dolist-tail-- gnus-mime-button-commands)) (while --dolist-tail-- (let ... ... ...))) map))))))
do-after-load-evaluation("/usr/share/emacs/24.4/lisp/gnus/gnus.elc")
autoload-do-load((autoload "gnus" 1029773 t nil) gnus)
command-execute(gnus record)
execute-extended-command(nil "gnus")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
Ah -- it looks like that keybinding stuff has to run not only after gnus has loaded, but also after the (gnus-registry-initialize). I guess even with (gnus-registry-initialize) in my .gnus file, the gnus library loads first, then eval-after-load, then the rest of .gnus?
I see there's a variable called "gnus-registry-unload-hook", but there doesn't seem to be one for loading. Perhaps the best thing is to put the gnus-related keybindings in .gnus, after the registry has been initialized?