mirror of
https://git.notmuchmail.org/git/notmuch
synced 2025-02-17 15:43:11 +01:00
emacs: Improve doc-strings
- The first sentence should fit on the first line in full. This is even the case when that causes the line to get a bit long. If it gets very long, then it should be made shorter. - Even even the second sentence would fit on the first line, if it just provides some details, then it shouldn't be done. - Symbols are quoted like `so'. - There is no clear rule on how to (not) quote non-atomic s-expressions, but quoting like '(this) is definitely weird. - It is a good idea to remember that \" becomes " and to take that in mind when adjusting the automatic filling by hand. - Use the imperative form. - Arguments are written in all uppercase.
This commit is contained in:
parent
c454135376
commit
e63f37a4a9
6 changed files with 43 additions and 42 deletions
|
@ -36,9 +36,9 @@
|
||||||
This variable is set by calling `notmuch-address-harvest'.")
|
This variable is set by calling `notmuch-address-harvest'.")
|
||||||
|
|
||||||
(defvar notmuch-address-full-harvest-finished nil
|
(defvar notmuch-address-full-harvest-finished nil
|
||||||
"t indicates that full completion address harvesting has been
|
"t indicates that full completion address harvesting has been finished.
|
||||||
finished. Use notmuch-address--harvest-ready to access as that
|
Use notmuch-address--harvest-ready to access as that will load a
|
||||||
will load a saved hash if necessary (and available).")
|
saved hash if necessary (and available).")
|
||||||
|
|
||||||
(defun notmuch-address--harvest-ready ()
|
(defun notmuch-address--harvest-ready ()
|
||||||
"Return t if there is a full address hash available.
|
"Return t if there is a full address hash available.
|
||||||
|
@ -54,9 +54,9 @@ If it is a string then that string should be an external program
|
||||||
which must take a single argument (searched string) and output a
|
which must take a single argument (searched string) and output a
|
||||||
list of completion candidates, one per line.
|
list of completion candidates, one per line.
|
||||||
|
|
||||||
Alternatively, it can be the symbol 'internal, in which case
|
Alternatively, it can be the symbol `internal', in which case
|
||||||
internal completion is used; the variable
|
internal completion is used; the variable
|
||||||
`notmuch-address-internal-completion` can be used to customize
|
`notmuch-address-internal-completion' can be used to customize
|
||||||
this case.
|
this case.
|
||||||
|
|
||||||
Finally, if this variable is nil then address completion is
|
Finally, if this variable is nil then address completion is
|
||||||
|
@ -72,12 +72,12 @@ disabled."
|
||||||
(defcustom notmuch-address-internal-completion '(sent nil)
|
(defcustom notmuch-address-internal-completion '(sent nil)
|
||||||
"Determines how internal address completion generates candidates.
|
"Determines how internal address completion generates candidates.
|
||||||
|
|
||||||
This should be a list of the form '(DIRECTION FILTER), where
|
This should be a list of the form (DIRECTION FILTER), where
|
||||||
DIRECTION is either sent or received and specifies whether the
|
DIRECTION is either sent or received and specifies whether the
|
||||||
candidates are searched in messages sent by the user or received
|
candidates are searched in messages sent by the user or received
|
||||||
by the user (note received by is much faster), and FILTER is
|
by the user (note received by is much faster), and FILTER is
|
||||||
either nil or a filter-string, such as \"date:1y..\" to append
|
either nil or a filter-string, such as \"date:1y..\" to append to
|
||||||
to the query."
|
the query."
|
||||||
:type '(list :tag "Use internal address completion"
|
:type '(list :tag "Use internal address completion"
|
||||||
(radio
|
(radio
|
||||||
:tag "Base completion on messages you have"
|
:tag "Base completion on messages you have"
|
||||||
|
@ -101,8 +101,8 @@ to the query."
|
||||||
"Filename to save the cached completion addresses.
|
"Filename to save the cached completion addresses.
|
||||||
|
|
||||||
All the addresses notmuch uses for address completion will be
|
All the addresses notmuch uses for address completion will be
|
||||||
cached in this file. This has obvious privacy implications so you
|
cached in this file. This has obvious privacy implications so
|
||||||
should make sure it is not somewhere publicly readable."
|
you should make sure it is not somewhere publicly readable."
|
||||||
:type '(choice (const :tag "Off" nil)
|
:type '(choice (const :tag "Off" nil)
|
||||||
(file :tag "Filename"))
|
(file :tag "Filename"))
|
||||||
:group 'notmuch-send
|
:group 'notmuch-send
|
||||||
|
@ -110,12 +110,14 @@ should make sure it is not somewhere publicly readable."
|
||||||
:group 'notmuch-external)
|
:group 'notmuch-external)
|
||||||
|
|
||||||
(defcustom notmuch-address-selection-function 'notmuch-address-selection-function
|
(defcustom notmuch-address-selection-function 'notmuch-address-selection-function
|
||||||
"The function to select address from given list. The function is
|
"The function to select address from given list.
|
||||||
called with PROMPT, COLLECTION, and INITIAL-INPUT as arguments
|
|
||||||
(subset of what `completing-read' can be called with).
|
The function is called with PROMPT, COLLECTION, and INITIAL-INPUT
|
||||||
While executed the value of `completion-ignore-case' is t.
|
as arguments (subset of what `completing-read' can be called
|
||||||
See documentation of function `notmuch-address-selection-function'
|
with). While executed the value of `completion-ignore-case'
|
||||||
to know how address selection is made by default."
|
is t. See documentation of function
|
||||||
|
`notmuch-address-selection-function' to know how address
|
||||||
|
selection is made by default."
|
||||||
:type 'function
|
:type 'function
|
||||||
:group 'notmuch-send
|
:group 'notmuch-send
|
||||||
:group 'notmuch-address
|
:group 'notmuch-address
|
||||||
|
@ -188,9 +190,9 @@ The candidates are taken from `notmuch-address-completions'."
|
||||||
candidates))
|
candidates))
|
||||||
|
|
||||||
(defun notmuch-address-options (original)
|
(defun notmuch-address-options (original)
|
||||||
"Returns a list of completion candidates. Uses either
|
"Return a list of completion candidates.
|
||||||
elisp-based implementation or older implementation requiring
|
Use either elisp-based implementation or older implementation
|
||||||
external commands."
|
requiring external commands."
|
||||||
(cond
|
(cond
|
||||||
((eq notmuch-address-command 'internal)
|
((eq notmuch-address-command 'internal)
|
||||||
(unless (notmuch-address--harvest-ready)
|
(unless (notmuch-address--harvest-ready)
|
||||||
|
@ -352,7 +354,7 @@ execution, CALLBACK is called when harvesting finishes."
|
||||||
"Version format of the save hash.")
|
"Version format of the save hash.")
|
||||||
|
|
||||||
(defun notmuch-address--get-address-hash ()
|
(defun notmuch-address--get-address-hash ()
|
||||||
"Returns the saved address hash as a plist.
|
"Return the saved address hash as a plist.
|
||||||
|
|
||||||
Returns nil if the save file does not exist, or it does not seem
|
Returns nil if the save file does not exist, or it does not seem
|
||||||
to be a saved address hash."
|
to be a saved address hash."
|
||||||
|
|
|
@ -47,22 +47,21 @@ is a possibly empty forest of replies."
|
||||||
seq)))
|
seq)))
|
||||||
|
|
||||||
(defun notmuch-query-map-threads (fn threads)
|
(defun notmuch-query-map-threads (fn threads)
|
||||||
"Apply FN to every thread in THREADS. Flatten results to a list.
|
"Apply function FN to every thread in THREADS.
|
||||||
|
Flatten results to a list. See the function
|
||||||
See the function notmuch-query-get-threads for more information."
|
`notmuch-query-get-threads' for more information."
|
||||||
(notmuch-query-map-aux 'notmuch-query-map-forest fn threads))
|
(notmuch-query-map-aux 'notmuch-query-map-forest fn threads))
|
||||||
|
|
||||||
(defun notmuch-query-map-forest (fn forest)
|
(defun notmuch-query-map-forest (fn forest)
|
||||||
"Apply function to every message in a forest. Flatten results to a list.
|
"Apply function FN to every message in FOREST.
|
||||||
|
Flatten results to a list. See the function
|
||||||
See the function notmuch-query-get-threads for more information.
|
`notmuch-query-get-threads' for more information."
|
||||||
"
|
|
||||||
(notmuch-query-map-aux 'notmuch-query-map-tree fn forest))
|
(notmuch-query-map-aux 'notmuch-query-map-tree fn forest))
|
||||||
|
|
||||||
(defun notmuch-query-map-tree (fn tree)
|
(defun notmuch-query-map-tree (fn tree)
|
||||||
"Apply function FN to every message in TREE. Flatten results to a list.
|
"Apply function FN to every message in TREE.
|
||||||
|
Flatten results to a list. See the function
|
||||||
See the function notmuch-query-get-threads for more information."
|
`notmuch-query-get-threads' for more information."
|
||||||
(cons (funcall fn (car tree)) (notmuch-query-map-forest fn (cadr tree))))
|
(cons (funcall fn (car tree)) (notmuch-query-map-forest fn (cadr tree))))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
|
@ -446,8 +446,8 @@ parsing fails."
|
||||||
(error (cons address nil))))
|
(error (cons address nil))))
|
||||||
|
|
||||||
(defun notmuch-show-clean-address (address)
|
(defun notmuch-show-clean-address (address)
|
||||||
"Try to clean a single email ADDRESS for display. Return
|
"Try to clean a single email ADDRESS for display.
|
||||||
unchanged ADDRESS if parsing fails."
|
Return unchanged ADDRESS if parsing fails."
|
||||||
(let* ((clean-address (notmuch-clean-address address))
|
(let* ((clean-address (notmuch-clean-address address))
|
||||||
(p-address (car clean-address))
|
(p-address (car clean-address))
|
||||||
(p-name (cdr clean-address)))
|
(p-name (cdr clean-address)))
|
||||||
|
|
|
@ -587,7 +587,7 @@ Shows in split pane or whole window according to value of
|
||||||
(scroll-up)))))
|
(scroll-up)))))
|
||||||
|
|
||||||
(defun notmuch-tree-scroll-message-window-back ()
|
(defun notmuch-tree-scroll-message-window-back ()
|
||||||
"Scroll the message window back(if it exists)."
|
"Scroll the message window back (if it exists)."
|
||||||
(interactive)
|
(interactive)
|
||||||
(when (window-live-p notmuch-tree-message-window)
|
(when (window-live-p notmuch-tree-message-window)
|
||||||
(with-selected-window notmuch-tree-message-window
|
(with-selected-window notmuch-tree-message-window
|
||||||
|
@ -596,7 +596,8 @@ Shows in split pane or whole window according to value of
|
||||||
(scroll-down)))))
|
(scroll-down)))))
|
||||||
|
|
||||||
(defun notmuch-tree-scroll-or-next ()
|
(defun notmuch-tree-scroll-or-next ()
|
||||||
"Scroll the message window. If it at end go to next message."
|
"Scroll the message window.
|
||||||
|
If it at end go to next message."
|
||||||
(interactive)
|
(interactive)
|
||||||
(when (notmuch-tree-scroll-message-window)
|
(when (notmuch-tree-scroll-message-window)
|
||||||
(notmuch-tree-next-matching-message)))
|
(notmuch-tree-next-matching-message)))
|
||||||
|
|
|
@ -432,11 +432,10 @@ returns nil."
|
||||||
(defun notmuch-search-foreach-result (beg end fn)
|
(defun notmuch-search-foreach-result (beg end fn)
|
||||||
"Invoke FN for each result between BEG and END.
|
"Invoke FN for each result between BEG and END.
|
||||||
|
|
||||||
FN should take one argument. It will be applied to the
|
FN should take one argument. It will be applied to the character
|
||||||
character position of the beginning of each result that overlaps
|
position of the beginning of each result that overlaps the region
|
||||||
the region between points BEG and END. As a special case, if (=
|
between points BEG and END. As a special case, if (= BEG END),
|
||||||
BEG END), FN will be applied to the result containing point
|
FN will be applied to the result containing point BEG."
|
||||||
BEG."
|
|
||||||
(let ((pos (notmuch-search-result-beginning beg))
|
(let ((pos (notmuch-search-result-beginning beg))
|
||||||
;; End must be a marker in case fn changes the
|
;; End must be a marker in case fn changes the
|
||||||
;; text.
|
;; text.
|
||||||
|
|
|
@ -36,11 +36,11 @@
|
||||||
(provide 'rstdoc)
|
(provide 'rstdoc)
|
||||||
|
|
||||||
(defun rstdoc-batch-extract ()
|
(defun rstdoc-batch-extract ()
|
||||||
"Extract docstrings to and from the files on the command line"
|
"Extract docstrings to and from the files on the command line."
|
||||||
(apply #'rstdoc-extract command-line-args-left))
|
(apply #'rstdoc-extract command-line-args-left))
|
||||||
|
|
||||||
(defun rstdoc-extract (in-file out-file)
|
(defun rstdoc-extract (in-file out-file)
|
||||||
"Write docstrings from IN-FILE to OUT-FILE"
|
"Write docstrings from IN-FILE to OUT-FILE."
|
||||||
(load-file in-file)
|
(load-file in-file)
|
||||||
(let* ((definitions (cdr (assoc (expand-file-name in-file) load-history)))
|
(let* ((definitions (cdr (assoc (expand-file-name in-file) load-history)))
|
||||||
(doc-hash (make-hash-table :test 'eq)))
|
(doc-hash (make-hash-table :test 'eq)))
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
("\\([^\\]\\)'" . "\\1`")
|
("\\([^\\]\\)'" . "\\1`")
|
||||||
("^[[:space:]\t]*$" . "|br|")
|
("^[[:space:]\t]*$" . "|br|")
|
||||||
("^[[:space:]\t]" . "|indent| "))
|
("^[[:space:]\t]" . "|indent| "))
|
||||||
"list of (regex . replacement) pairs")
|
"List of (regex . replacement) pairs.")
|
||||||
|
|
||||||
(defun rstdoc--rst-quote-string (str)
|
(defun rstdoc--rst-quote-string (str)
|
||||||
(with-temp-buffer
|
(with-temp-buffer
|
||||||
|
|
Loading…
Add table
Reference in a new issue