From 7fbdca5dc81dfe0dd542ed0e2352d3334b16fd7f Mon Sep 17 00:00:00 2001 From: Nicholas Vollmer Date: Mon, 27 Sep 2021 20:35:12 -0400 Subject: [PATCH] org-id: Fix checkdoc warnings * org-id: Fix checkdoc warnings. --- lisp/org-id.el | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/lisp/org-id.el b/lisp/org-id.el index 3725ff9e5..56783d108 100644 --- a/lisp/org-id.el +++ b/lisp/org-id.el @@ -419,15 +419,15 @@ So a typical ID could look like \"Org:4nd91V40HI\"." (substring rnd 18 20) (substring rnd 20 32)))) -(defun org-id-int-to-b36-one-digit (i) - "Turn an integer between 0 and 61 into a single character 0..9, A..Z, a..z." +(defun org-id-int-to-b36-one-digit (integer) + "Convert INTEGER between 0 and 61 into a single character 0..9, A..Z, a..z." (cond - ((< i 10) (+ ?0 i)) - ((< i 36) (+ ?a i -10)) + ((< integer 10) (+ ?0 integer)) + ((< integer 36) (+ ?a integer -10)) (t (error "Larger that 35")))) (defun org-id-b36-to-int-one-digit (i) - "Turn a character 0..9, A..Z, a..z into a number 0..61. + "Convert character 0..9, A..Z, a..z into a number 0..61. The input I may be a character, or a single-letter string." (and (stringp i) (setq i (string-to-char i))) (cond @@ -435,9 +435,11 @@ The input I may be a character, or a single-letter string." ((and (>= i ?a) (<= i ?z)) (+ (- i ?a) 10)) (t (error "Invalid b36 letter")))) -(defun org-id-int-to-b36 (i &optional length) - "Convert an integer to a base-36 number represented as a string." - (let ((s "")) +(defun org-id-int-to-b36 (integer &optional length) + "Convert an INTEGER to a base-36 number represented as a string. +The returned string is padded with leading zeros to LENGTH if necessary." + (let ((s "") + (i integer)) (while (> i 0) (setq s (concat (char-to-string (org-id-int-to-b36-one-digit (mod i 36))) s) @@ -447,11 +449,11 @@ The input I may be a character, or a single-letter string." (setq s (concat (make-string (- length (length s)) ?0) s))) s)) -(defun org-id-b36-to-int (s) - "Convert a base-36 string into the corresponding integer." +(defun org-id-b36-to-int (string) + "Convert a base-36 STRING into the corresponding integer." (let ((r 0)) (mapc (lambda (i) (setq r (+ (* r 36) (org-id-b36-to-int-one-digit i)))) - s) + string) r)) (defun org-id-time-to-b36 (&optional time) @@ -489,7 +491,8 @@ and TIME is a Lisp time value (HI LO USEC)." Store the relation between files and corresponding IDs. This will scan all agenda files, all associated archives, and all files currently mentioned in `org-id-locations'. -When FILES is given, scan also these files." +When FILES is given, scan also these files. +If SILENT is non-nil, messages are suppressed." (interactive) (unless org-id-track-globally (error "Please turn on `org-id-track-globally' if you want to track IDs")) @@ -610,7 +613,7 @@ When FILES is given, scan also these files." (add-hook 'kill-emacs-hook 'org-id-locations-save)) (defun org-id-hash-to-alist (hash) - "Turn an org-id hash into an alist. + "Turn an org-id HASH into an alist. This is to be able to write it to a file." (let (res x) (maphash @@ -622,7 +625,7 @@ This is to be able to write it to a file." res)) (defun org-id-alist-to-hash (list) - "Turn an org-id location list into a hash table." + "Turn an org-id location LIST into a hash table." (let ((res (make-hash-table :test 'equal :size (apply '+ (mapcar 'length list)))) -- 2.33.0