Function: feedmail-queue-subject-slug-maker

feedmail-queue-subject-slug-maker is a byte-compiled function defined in feedmail.el.gz.

Signature

(feedmail-queue-subject-slug-maker &optional QUEUE-DIRECTORY)

Documentation

Create a name for storing the message in the queue.

Optional argument QUEUE-DIRECTORY specifies into which directory the file will be placed. The name is based on the Subject: header (if there is one). If there is no subject, feedmail-queue-default-file-slug is consulted. Special characters are mapped to mostly alphanumerics for safety.

Source Code

;; Defined in /usr/src/emacs/lisp/mail/feedmail.el.gz
(defun feedmail-queue-subject-slug-maker (&optional queue-directory)
  "Create a name for storing the message in the queue.
Optional argument QUEUE-DIRECTORY specifies into which directory the
file will be placed.  The name is based on the Subject: header (if
there is one).  If there is no subject,
`feedmail-queue-default-file-slug' is consulted.  Special characters are
mapped to mostly alphanumerics for safety."
  (feedmail-say-debug ">in-> feedmail-queue-subject-slug-maker %s" queue-directory)
  (let ((eoh-marker) (case-fold-search t) (subject "") (s-point))
    (setq eoh-marker (feedmail-find-eoh))
    (goto-char (point-min))
    ;; get raw subject value (first line, anyhow)
    (if (re-search-forward "^Subject:" eoh-marker t)
	(progn (setq s-point (point))
	       (end-of-line)
	       (setq subject (buffer-substring-no-properties s-point (point)))))
    (setq subject (feedmail-tidy-up-slug subject))
    (if (zerop (length subject))
	(setq subject
	      (cond
	       ((stringp feedmail-queue-default-file-slug) feedmail-queue-default-file-slug)
	       ((fboundp feedmail-queue-default-file-slug)
		(save-excursion (funcall feedmail-queue-default-file-slug)))
	       ((eq feedmail-queue-default-file-slug 'ask)
		(file-name-nondirectory
		 (read-file-name "FQM: Message filename slug? "
				 (file-name-as-directory queue-directory) subject nil subject)))
	       (t "no subject"))
	      ))
    ;; one more time, with feeling
    (feedmail-tidy-up-slug subject)
    ))