diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-07 02:37:18 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2023-01-07 02:38:17 +0100 |
| commit | 28494d7c792131064f1e1a16a37762cf4bd42dae (patch) | |
| tree | 18998f1a1c40e6082dc5eeedbcc9e82840cf7233 /compat-26.el | |
| parent | 557c74f87fe8298d186703b8b7ed46745d9bb7dd (diff) | |
Explicit functions: Mention reason of existence in the docstring
Replicating the docstring of the original function is not needed.
Diffstat (limited to 'compat-26.el')
| -rw-r--r-- | compat-26.el | 35 |
1 files changed, 8 insertions, 27 deletions
diff --git a/compat-26.el b/compat-26.el index 504d14b..4578f2a 100644 --- a/compat-26.el +++ b/compat-26.el @@ -28,11 +28,7 @@ ;;;; Defined in fns.c (compat-defun assoc (key alist &optional testfn) ;; <OK> - "Handle the optional argument TESTFN. -Equality is defined by the function TESTFN, defaulting to -`equal'. TESTFN is called with 2 arguments: a car of an alist -element and KEY. With no optional argument, the function behaves -just like `assoc'." + "Handle the optional TESTFN." :explicit t (if testfn (catch 'found @@ -48,12 +44,7 @@ SEQUENCE may be a list, a vector, a boolean vector, or a string." (apply #'nconc (mapcar func sequence))) (compat-defun line-number-at-pos (&optional position absolute) ;; <OK> - "Handle optional argument ABSOLUTE: - -If the buffer is narrowed, the return value by default counts the lines -from the beginning of the accessible portion of the buffer. But if the -second optional argument ABSOLUTE is non-nil, the value counts the lines -from the absolute start of the buffer, disregarding the narrowing." + "Handle optional argument ABSOLUTE." :explicit t (if absolute (save-restriction @@ -64,7 +55,7 @@ from the absolute start of the buffer, disregarding the narrowing." ;;;; Defined in subr.el (compat-defun alist-get (key alist &optional default remove testfn) ;; <OK> - "Handle TESTFN manually." + "Handle optional argument TESTFN." :explicit t (if testfn (let (entry) @@ -113,18 +104,14 @@ from the absolute start of the buffer, disregarding the narrowing." ,v))))))))))) (compat-defun string-trim-left (string &optional regexp) ;; <OK> - "Trim STRING of leading string matching REGEXP. - -REGEXP defaults to \"[ \\t\\n\\r]+\"." + "Handle optional argument REGEXP." :explicit t (if (string-match (concat "\\`\\(?:" (or regexp "[ \t\n\r]+") "\\)") string) (substring string (match-end 0)) string)) (compat-defun string-trim-right (string &optional regexp) ;; <OK> - "Trim STRING of trailing string matching REGEXP. - -REGEXP defaults to \"[ \\t\\n\\r]+\"." + "Handle optional argument REGEXP." :explicit t (let ((i (string-match-p (concat "\\(?:" (or regexp "[ \t\n\r]+") "\\)\\'") @@ -132,9 +119,7 @@ REGEXP defaults to \"[ \\t\\n\\r]+\"." (if i (substring string 0 i) string))) (compat-defun string-trim (string &optional trim-left trim-right) ;; <OK> - "Trim STRING of leading with and trailing matching TRIM-LEFT and TRIM-RIGHT. - -TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"." + "Handle optional arguments TRIM-LEFT and TRIM-RIGHT." :explicit t (compat--string-trim-left (compat--string-trim-right @@ -348,17 +333,13 @@ The returned file name can be used directly as argument of (or (file-remote-p file 'localname) file)) (compat-defun file-name-quoted-p (name &optional top) ;; <OK> - "Whether NAME is quoted with prefix \"/:\". -If NAME is a remote file name and TOP is nil, check the local part of NAME." + "Handle optional argument TOP." :explicit t (let ((file-name-handler-alist (unless top file-name-handler-alist))) (string-prefix-p "/:" (file-local-name name)))) (compat-defun file-name-quote (name &optional top) ;; <OK> - "Add the quotation prefix \"/:\" to file NAME. -If NAME is a remote file name and TOP is nil, the local part of -NAME is quoted. If NAME is already a quoted file name, NAME is -returned unchanged." + "Handle optional argument TOP." :explicit t (let ((file-name-handler-alist (unless top file-name-handler-alist))) (if (string-prefix-p "/:" (file-local-name name)) |
