#474 Error if mh-x-face-file is nil

mh-e-8.6
closed-fixed
None
5
2014-10-03
2014-04-28
Mike Kupfer
No

The docstring for mh-x-face-file says that you can set it to nil to disable the creation of an X-Face header in outgoing mail. But if you actually do that, you get an error. The debugger says

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
file-exists-p(nil)
mh-insert-x-face()
mh-compose-and-send-mail("draft-1" "" nil nil "" "" "" nil nil #<window-configuration>)
mh-send-sub("" "" "" #<window-configuration>)
mh-send("" "" "")
call-interactively(mh-send)
ad-Orig-mh-smail()
mh-smail()
call-interactively(mh-smail record nil)
command-execute(mh-smail record)
execute-extended-command(nil "mh-smail")
call-interactively(execute-extended-command nil nil)

Originally observed in MH-E 8.3.1, and confirmed (by looking at the source) that the same issue exists in MH-E 8.5. Emacs 24.3 (and maybe 23.4; I can't remember what Ubuntu 12.04 ships).

The fix looks simple enough:

(defun mh-insert-x-face ()
"Append X-Face, Face or X-Image-URL field to header.
If the field already exists, this function does nothing."
(when (and mh-x-face-file <--- ensure mh-x-face-file is non-nil
(file-exists-p mh-x-face-file)
(file-readable-p mh-x-face-file))

Or would it be better to check using (stringp mh-x-face-file)?

Discussion

  • Mike Kupfer

    Mike Kupfer - 2014-07-04
    • status: unread --> open
     
  • Bill Wohler

    Bill Wohler - 2014-07-21

    I'd lean towards stringp, since that is what file-exists-p expects.

     
  • Mike Kupfer

    Mike Kupfer - 2014-07-26

    okay, stringp it is.

     
  • Bill Wohler

    Bill Wohler - 2014-07-30
    • summary: error if mh-x-face-file is nil --> Error if mh-x-face-file is nil
     
  • Mike Kupfer

    Mike Kupfer - 2014-10-03
    • status: open --> closed-fixed
    • Milestone: Unassigned --> mh-e-8.6
     
  • Mike Kupfer

    Mike Kupfer - 2014-10-03

    Fixed by

    revno: 117456
    revision-id: m.kupfer@acm.org-20140927192519-rcu1qeq7hk9cuy7z
    parent: eliz@gnu.org-20140823082246-q5syxynomcvpti4k
    committer: Mike Kupfer <m.kupfer@acm.org>
    branch nick: emacs-24
    timestamp: Sat 2014-09-27 12:25:19 -0700
    message:
      * mh-comp.el (mh-insert-x-face): Ensure that mh-x-face-file is a
      string before trying to use it (closes SF #474).
      (mh-bare-components): New function to create a temporary initial
      components file; replaces mh-find-components.
      (mh-edit-again, mh-send-sub): Use mh-bare-components instead of
      mh-find-components (partially closes SF #468).
    modified:
      lisp/mh-e/ChangeLog            changelog-20091113204419-o5vbwnq5f7feedwu-2547
      lisp/mh-e/mh-comp.el           mhcomp.el-20091113204419-o5vbwnq5f7feedwu-2532
    

    Committed to emacs-24 on Savannah by

    revno: 117455.1.67
    revision-id: wohler@newt.com-20140930045210-s0tlhnkojoxbswdf
    parent: eliz@gnu.org-20140929191028-lti2lybtzzrnjppc
    committer: Bill Wohler <wohler@newt.com>
    branch nick: emacs-24
    timestamp: Mon 2014-09-29 21:52:10 -0700
    message:
      Release MH-E version 8.6.
    
      * NEWS, MH-E-NEWS: Update for MH-E release 8.6.
    
      * mh-e.el (Version, mh-version): Update for release 8.6.
    
      * mh-comp.el (mh-insert-x-face): Ensure that mh-x-face-file is a
      string before trying to use it (closes SF #474).
      (mh-bare-components): New function to create a temporary initial
      components file; replaces mh-find-components. Improve the temp folder
      and file names as per a suggestion from Bill Wohler. Also address
      XEmacs compatibility issues: use mm-make-temp-file instead of
      make-temp-file, and only pass one argument to delete-directory.
      (mh-edit-again, mh-send-sub): Use mh-bare-components instead of
      mh-find-components (partially closes SF #468).
    modified:
      etc/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1485
      etc/MH-E-NEWS                  mhenews-20091113204419-o5vbwnq5f7feedwu-1489
      etc/NEWS                       news-20100311060928-aoit31wvzf25yr1z-1
      lisp/mh-e/ChangeLog            changelog-20091113204419-o5vbwnq5f7feedwu-2547
      lisp/mh-e/mh-comp.el           mhcomp.el-20091113204419-o5vbwnq5f7feedwu-2532
      lisp/mh-e/mh-e.el              mhe.el-20091113204419-o5vbwnq5f7feedwu-2534
    
     

Log in to post a comment.