emacs: Improve interactive use documentation

This improves the function documentation for many interactive
commands, either by improving their documentation string where the
improvement also makes sense for programmatic use or by adding a
'notmuch-doc property where it doesn't.

For nearly all commands that support a prefix argument, this adds a
'notmuch-prefix-doc property to document their prefixed behavior This
omits prefix documentation for a few commands where I thought the
prefixed behavior was too obscure (or too complex to fit in one line).
This commit is contained in:
Austin Clements 2013-10-05 23:22:47 -04:00 committed by David Bremner
parent fad4f21cb7
commit c1221dd65a
3 changed files with 35 additions and 5 deletions

View file

@ -313,8 +313,9 @@ the From: header is already filled in by notmuch."
(ido-completing-read "Send mail From: " notmuch-identities (ido-completing-read "Send mail From: " notmuch-identities
nil nil nil 'notmuch-mua-sender-history (car notmuch-identities))))) nil nil nil 'notmuch-mua-sender-history (car notmuch-identities)))))
(put 'notmuch-mua-new-mail 'notmuch-prefix-doc "... and prompt for sender")
(defun notmuch-mua-new-mail (&optional prompt-for-sender) (defun notmuch-mua-new-mail (&optional prompt-for-sender)
"Invoke the notmuch mail composition window. "Compose new mail.
If PROMPT-FOR-SENDER is non-nil, the user will be prompted for If PROMPT-FOR-SENDER is non-nil, the user will be prompted for
the From: address first." the From: address first."

View file

@ -1488,6 +1488,8 @@ current thread."
"Are the headers of the current message visible?" "Are the headers of the current message visible?"
(notmuch-show-get-prop :headers-visible)) (notmuch-show-get-prop :headers-visible))
(put 'notmuch-show-mark-read 'notmuch-prefix-doc
"Mark the current message as unread.")
(defun notmuch-show-mark-read (&optional unread) (defun notmuch-show-mark-read (&optional unread)
"Mark the current message as read. "Mark the current message as read.
@ -1609,16 +1611,20 @@ any effects from previous calls to
;; Move to the previous message. ;; Move to the previous message.
(notmuch-show-previous-message))))) (notmuch-show-previous-message)))))
(put 'notmuch-show-reply 'notmuch-prefix-doc "... and prompt for sender")
(defun notmuch-show-reply (&optional prompt-for-sender) (defun notmuch-show-reply (&optional prompt-for-sender)
"Reply to the sender and all recipients of the current message." "Reply to the sender and all recipients of the current message."
(interactive "P") (interactive "P")
(notmuch-mua-new-reply (notmuch-show-get-message-id) prompt-for-sender t)) (notmuch-mua-new-reply (notmuch-show-get-message-id) prompt-for-sender t))
(put 'notmuch-show-reply-sender 'notmuch-prefix-doc "... and prompt for sender")
(defun notmuch-show-reply-sender (&optional prompt-for-sender) (defun notmuch-show-reply-sender (&optional prompt-for-sender)
"Reply to the sender of the current message." "Reply to the sender of the current message."
(interactive "P") (interactive "P")
(notmuch-mua-new-reply (notmuch-show-get-message-id) prompt-for-sender nil)) (notmuch-mua-new-reply (notmuch-show-get-message-id) prompt-for-sender nil))
(put 'notmuch-show-forward-message 'notmuch-prefix-doc
"... and prompt for sender")
(defun notmuch-show-forward-message (&optional prompt-for-sender) (defun notmuch-show-forward-message (&optional prompt-for-sender)
"Forward the current message." "Forward the current message."
(interactive "P") (interactive "P")
@ -1722,6 +1728,10 @@ to show, nil otherwise."
(set-buffer-modified-p nil) (set-buffer-modified-p nil)
(view-buffer buf 'kill-buffer-if-not-modified))) (view-buffer buf 'kill-buffer-if-not-modified)))
(put 'notmuch-show-pipe-message 'notmuch-doc
"Pipe the contents of the current message to a command.")
(put 'notmuch-show-pipe-message 'notmuch-prefix-doc
"Pipe the thread as an mbox to a command.")
(defun notmuch-show-pipe-message (entire-thread command) (defun notmuch-show-pipe-message (entire-thread command)
"Pipe the contents of the current message (or thread) to COMMAND. "Pipe the contents of the current message (or thread) to COMMAND.
@ -1795,12 +1805,16 @@ See `notmuch-tag' for information on the format of TAG-CHANGES."
(notmuch-show-set-tags new-tags)))))) (notmuch-show-set-tags new-tags))))))
(defun notmuch-show-add-tag () (defun notmuch-show-add-tag ()
"Same as `notmuch-show-tag' but sets initial input to '+'." "Change tags for the current message (defaulting to add).
Same as `notmuch-show-tag' but sets initial input to '+'."
(interactive) (interactive)
(notmuch-show-tag "+")) (notmuch-show-tag "+"))
(defun notmuch-show-remove-tag () (defun notmuch-show-remove-tag ()
"Same as `notmuch-show-tag' but sets initial input to '-'." "Change tags for the current message (defaulting to remove).
Same as `notmuch-show-tag' but sets initial input to '-'."
(interactive) (interactive)
(notmuch-show-tag "-")) (notmuch-show-tag "-"))
@ -1822,6 +1836,8 @@ See `notmuch-tag' for information on the format of TAG-CHANGES."
(not (plist-get props :message-visible)))) (not (plist-get props :message-visible))))
(force-window-update)) (force-window-update))
(put 'notmuch-show-open-or-close-all 'notmuch-doc "Show all messages.")
(put 'notmuch-show-open-or-close-all 'notmuch-prefix-doc "Hide all messages.")
(defun notmuch-show-open-or-close-all () (defun notmuch-show-open-or-close-all ()
"Set the visibility all of the messages in the current thread. "Set the visibility all of the messages in the current thread.
@ -1873,6 +1889,8 @@ search results instead."
(interactive) (interactive)
(notmuch-show-next-thread t t)) (notmuch-show-next-thread t t))
(put 'notmuch-show-archive-thread 'notmuch-prefix-doc
"Un-archive each message in thread.")
(defun notmuch-show-archive-thread (&optional unarchive) (defun notmuch-show-archive-thread (&optional unarchive)
"Archive each message in thread. "Archive each message in thread.
@ -1902,6 +1920,8 @@ buffer."
(notmuch-show-archive-thread) (notmuch-show-archive-thread)
(notmuch-show-next-thread)) (notmuch-show-next-thread))
(put 'notmuch-show-archive-message 'notmuch-prefix-doc
"Un-archive the current message.")
(defun notmuch-show-archive-message (&optional unarchive) (defun notmuch-show-archive-message (&optional unarchive)
"Archive the current message. "Archive the current message.
@ -1953,6 +1973,8 @@ thread from search."
(interactive) (interactive)
(notmuch-common-do-stash (notmuch-show-get-from))) (notmuch-common-do-stash (notmuch-show-get-from)))
(put 'notmuch-show-stash-message-id 'notmuch-prefix-doc
"Copy thread: query matching current thread to kill-ring.")
(defun notmuch-show-stash-message-id (&optional stash-thread-id) (defun notmuch-show-stash-message-id (&optional stash-thread-id)
"Copy id: query matching the current message to kill-ring. "Copy id: query matching the current message to kill-ring.

View file

@ -575,15 +575,21 @@ See `notmuch-tag' for information on the format of TAG-CHANGES."
(notmuch-search-tag-region beg end tag-changes))) (notmuch-search-tag-region beg end tag-changes)))
(defun notmuch-search-add-tag () (defun notmuch-search-add-tag ()
"Same as `notmuch-search-tag' but sets initial input to '+'." "Change tags for the current thread (defaulting to add).
Same as `notmuch-search-tag' but sets initial input to '+'."
(interactive) (interactive)
(notmuch-search-tag "+")) (notmuch-search-tag "+"))
(defun notmuch-search-remove-tag () (defun notmuch-search-remove-tag ()
"Same as `notmuch-search-tag' but sets initial input to '-'." "Change tags for the current thread (defaulting to remove).
Same as `notmuch-search-tag' but sets initial input to '-'."
(interactive) (interactive)
(notmuch-search-tag "-")) (notmuch-search-tag "-"))
(put 'notmuch-search-archive-thread 'notmuch-prefix-doc
"Un-archive the currently selected thread.")
(defun notmuch-search-archive-thread (&optional unarchive) (defun notmuch-search-archive-thread (&optional unarchive)
"Archive the currently selected thread. "Archive the currently selected thread.
@ -887,6 +893,7 @@ PROMPT is the string to prompt with."
'notmuch-search-history nil nil))))) 'notmuch-search-history nil nil)))))
;;;###autoload ;;;###autoload
(put 'notmuch-search 'notmuch-doc "Search for messages.")
(defun notmuch-search (&optional query oldest-first target-thread target-line) (defun notmuch-search (&optional query oldest-first target-thread target-line)
"Display threads matching QUERY in a notmuch-search buffer. "Display threads matching QUERY in a notmuch-search buffer.