Function: mh-alias-insert-file

mh-alias-insert-file is a byte-compiled function defined in mh-alias.el.gz.

Signature

(mh-alias-insert-file &optional ALIAS)

Documentation

Return filename which should be used to add ALIAS.

The value of the option mh-alias-insert-file(var)/mh-alias-insert-file(fun) is used if non-nil; otherwise the value of the "Aliasfile:" profile component is used. If the alias already exists, try to return the name of the file that contains it.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-alias.el.gz
(defun mh-alias-insert-file (&optional alias)
  "Return filename which should be used to add ALIAS.
The value of the option `mh-alias-insert-file' is used if non-nil;
otherwise the value of the \"Aliasfile:\" profile component is used.
If the alias already exists, try to return the name of the file that
contains it."
  (cond
   ((and mh-alias-insert-file (listp mh-alias-insert-file))
    (if (not (elt mh-alias-insert-file 1))        ; Only one entry, use it
        (car mh-alias-insert-file)
      (if (or (not alias)
              (string-equal alias (mh-alias-ali alias))) ;alias doesn't exist
          (completing-read "Alias file: "
                           (mapcar #'list mh-alias-insert-file) nil t)
        (or (mh-alias-which-file-has-alias alias mh-alias-insert-file)
            (completing-read "Alias file: "
                             (mapcar #'list mh-alias-insert-file) nil t)))))
   ((and mh-alias-insert-file (stringp mh-alias-insert-file))
    mh-alias-insert-file)
   (t
    ;; writable ones returned from (mh-alias-filenames):
    (let ((autolist (delq nil (mapcar (lambda (file)
                                        (if (and (file-writable-p file)
                                                 (not (string-equal
                                                       file "/etc/passwd")))
                                            file))
                                     (mh-alias-filenames t)))))
      (cond
       ((not autolist)
        (error "No writable alias file;
set `mh-alias-insert-file' or the \"Aliasfile:\" profile component"))
       ((not (elt autolist 1))        ; Only one entry, use it
        (car autolist))
       ((or (not alias)
            (string-equal alias (mh-alias-ali alias))) ;alias doesn't exist
        (completing-read "Alias file: " autolist nil t))
       (t
        (or (mh-alias-which-file-has-alias alias autolist)
            (completing-read "Alias file: " autolist nil t))))))))