ergoemacs / ergoemacs-mode

ergoemacs-mode
ergoemacs.github.io/
GNU General Public License v3.0
293 stars 35 forks source link

backtrace when displaying a mail with an attachment in gnus #294

Closed brabalan closed 10 years ago

brabalan commented 10 years ago

When viewing a mail with an attachment using gnus, I get the following backtrace (bytecode removed):

  expand-file-name(nil)
  (setq dir (expand-file-name (file-name-directory file)))
  (progn (setq dir (expand-file-name (file-name-directory file))) (setq ret (gethash dir ergoemacs-is-user-defined-hash)) (eq ret (quote no)))
  (cond (ergoemacs-ignore-advice nil) ((eq ergoemacs-is-user-defined-map-change-p (quote no)) nil) (ergoemacs-is-user-defined-map-change-p t) ((progn (setq file (if (ignore-errors (functionp function)) (or (gethash function ergoemacs-is-user-defined-hash) (find-lisp-object-file-name function (symbol-function function))) (or load-file-name (buffer-file-name)))) (not file)) nil) ((eq file t) t) ((eq file (quote no)) nil) ((progn (setq ret (gethash file ergoemacs-is-user-defined-hash)) (eq ret (quote no))) nil) (ret t) ((progn (setq dir (expand-file-name (file-name-directory file))) (setq ret (gethash dir ergoemacs-is-user-defined-hash)) (eq ret (quote no))) nil) (ret t) (t (setq ret (catch (quote found-dir) (dolist (cur-dir ergoemacs-is-user-defined-emacs-lisp-dirs) (when (string-match (concat "\\`" ...) dir) (throw (quote found-dir) nil))) t)) (when (and ret (string-match-p ergoemacs-is-not-user-defined-dir dir)) (setq ret nil)) (when (and (not ret) (string-match-p ergoemacs-is-user-defined-dir dir)) (setq ret t)) (if ret (progn (when dir (puthash dir t ergoemacs-is-user-defined-hash)) (when file (puthash file t ergoemacs-is-user-defined-hash)) (when function (puthash function t ergoemacs-is-user-defined-hash))) (when dir (puthash dir (quote no) ergoemacs-is-user-defined-hash)) (when file (puthash file (quote no) ergoemacs-is-user-defined-hash)) (when function (puthash function (quote no) ergoemacs-is-user-defined-hash))) ret))
  (let (file ret dir) (cond (ergoemacs-ignore-advice nil) ((eq ergoemacs-is-user-defined-map-change-p (quote no)) nil) (ergoemacs-is-user-defined-map-change-p t) ((progn (setq file (if (ignore-errors (functionp function)) (or (gethash function ergoemacs-is-user-defined-hash) (find-lisp-object-file-name function ...)) (or load-file-name (buffer-file-name)))) (not file)) nil) ((eq file t) t) ((eq file (quote no)) nil) ((progn (setq ret (gethash file ergoemacs-is-user-defined-hash)) (eq ret (quote no))) nil) (ret t) ((progn (setq dir (expand-file-name (file-name-directory file))) (setq ret (gethash dir ergoemacs-is-user-defined-hash)) (eq ret (quote no))) nil) (ret t) (t (setq ret (catch (quote found-dir) (dolist (cur-dir ergoemacs-is-user-defined-emacs-lisp-dirs) (when (string-match ... dir) (throw ... nil))) t)) (when (and ret (string-match-p ergoemacs-is-not-user-defined-dir dir)) (setq ret nil)) (when (and (not ret) (string-match-p ergoemacs-is-user-defined-dir dir)) (setq ret t)) (if ret (progn (when dir (puthash dir t ergoemacs-is-user-defined-hash)) (when file (puthash file t ergoemacs-is-user-defined-hash)) (when function (puthash function t ergoemacs-is-user-defined-hash))) (when dir (puthash dir (quote no) ergoemacs-is-user-defined-hash)) (when file (puthash file (quote no) ergoemacs-is-user-defined-hash)) (when function (puthash function (quote no) ergoemacs-is-user-defined-hash))) ret)))
  ergoemacs-is-user-defined-map-change-p()
  add-hook(font-lock-mode-hook #[0 "..." [remove-overlays nil diff-mode fine] 5 "\n\n(fn)"] nil local)
  diff-mode()
  #[nil "..." [mode auto-mode-alist font-lock-mode major-mode delq rassq doc-view-mode-maybe copy-sequence set-auto-mode fundamental-mode fboundp font-lock-ensure font-lock-fontify-buffer] 4]()
  mm-display-inline-fontify((#<buffer  *mm*-823658> ("text/x-diff") nil nil ("inline" (filename . "0001-ox-beamer.el-Match-latex-backend-in-generation-of-au.patch")) nil nil nil) diff-mode)
  mm-display-patch-inline((#<buffer  *mm*-823658> ("text/x-diff") nil nil ("inline" (filename . "0001-ox-beamer.el-Match-latex-backend-in-generation-of-au.patch")) nil nil nil))
  mm-display-inline((#<buffer  *mm*-823658> ("text/x-diff") nil nil ("inline" (filename . "0001-ox-beamer.el-Match-latex-backend-in-generation-of-au.patch")) nil nil nil))
  byte-code("..." [ignored type gnus-summary-buffer buffer gnus-inhibit-images handle string-match throw nil buffer-live-p get-buffer "\\`image/" mm-inline-override-p 4 "inline" mm-attachment-override-p mm-automatic-display-p mm-inlinable-p mm-inlined-p mm-automatic-external-display-p t split-string "/" "text" rassq "message" insert-char 10 2 0 1 gnus-unbuttonized-mime-type-p gnus-insert-mime-button (set-buffer gnus-summary-buffer) ((error)) derived-mode-p gnus-article-mode mm-display-part mm-display-inline gnus-article-insert-newline "\n" -1 put-text-property gnus-undeletable gnus-treat-article "application/pgp-signature" not-attachment display text gnus-article-mime-handle-alist ...] 6)
  gnus-mime-display-single((#<buffer  *mm*-823658> ("text/x-diff") nil nil ("inline" (filename . "0001-ox-beamer.el-Match-latex-backend-in-generation-of-au.patch")) nil nil nil))
  gnus-mime-display-part((#<buffer  *mm*-823658> ("text/x-diff") nil nil ("inline" (filename . "0001-ox-beamer.el-Match-latex-backend-in-generation-of-au.patch")) nil nil nil))
  mapcar(gnus-mime-display-part ((#<buffer  *mm*-892722> ("text/plain" (charset . "utf-8")) quoted-printable (lambda nil (let ((inhibit-read-only t)) (delete-region #<marker (moves after insertion) at 7116 in *Article lists.orgmode*> #<marker at 7789 in *Article lists.orgmode*>))) ("inline") nil nil nil) (#<buffer  *mm*-823658> ("text/x-diff") nil nil ("inline" (filename . "0001-ox-beamer.el-Match-latex-backend-in-generation-of-au.patch")) nil nil nil) (#<buffer  *mm*-937876> ("text/plain") nil nil ("inline") nil nil nil)))
  gnus-mime-display-mixed(((#<buffer  *mm*-892722> ("text/plain" (charset . "utf-8")) quoted-printable (lambda nil (let ((inhibit-read-only t)) (delete-region #<marker (moves after insertion) at 7116 in *Article lists.orgmode*> #<marker at 7789 in *Article lists.orgmode*>))) ("inline") nil nil nil) (#<buffer  *mm*-823658> ("text/x-diff") nil nil ("inline" (filename . "0001-ox-beamer.el-Match-latex-backend-in-generation-of-au.patch")) nil nil nil) (#<buffer  *mm*-937876> ("text/plain") nil nil ("inline") nil nil nil)))
  gnus-mime-display-part((#("multipart/mixed" 0 15 (boundary "=-=-=" buffer #<buffer  *mm*> from "aaronecay@gmail.com" start nil)) (#<buffer  *mm*-892722> ("text/plain" (charset . "utf-8")) quoted-printable (lambda nil (let ((inhibit-read-only t)) (delete-region #<marker (moves after insertion) at 7116 in *Article lists.orgmode*> #<marker at 7789 in *Article lists.orgmode*>))) ("inline") nil nil nil) (#<buffer  *mm*-823658> ("text/x-diff") nil nil ("inline" (filename . "0001-ox-beamer.el-Match-latex-backend-in-generation-of-au.patch")) nil nil nil) (#<buffer  *mm*-937876> ("text/plain") nil nil ("inline") nil nil nil)))
  gnus-display-mime()
  gnus-article-prepare-display()
  gnus-article-prepare(10776 nil)
  gnus-summary-display-article(10776)
  gnus-summary-next-article(nil)
  call-interactively(gnus-summary-next-article nil nil)

The problematic call is here https://github.com/ergoemacs/ergoemacs-mode/blob/master/ergoemacs-advices.el#L166

At this point, file is the string "0001-ox-beamer.el-Match-latex-backend-in-generation-of-au.patch" (the name of the attachment) coming from the call to buffer-file-name on https://github.com/ergoemacs/ergoemacs-mode/blob/master/ergoemacs-advices.el#L152

As the call (file-name-directory file) returns nil, the subsequent call to expand-file-name fails.

I'm using the current version of ergoemacs and the git version of gnus.

mattfidler commented 10 years ago

I think this should fix it...

brabalan commented 10 years ago

I still see the bug. I left a comment in the commit where I guess it should be changed (assuming the control flow is supposed to reach that point).

mattfidler commented 10 years ago

Let me know.

brabalan commented 10 years ago

Yes, it's working. Thanks a lot!