Skip to content

Commit 839a2e1

Browse files
authored
Merge pull request #387 from jmay/master
fill docstrings to prevent byte-compile warnings
2 parents f121450 + f52e7b0 commit 839a2e1

File tree

1 file changed

+60
-54
lines changed

1 file changed

+60
-54
lines changed

org-journal.el

Lines changed: 60 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,11 @@ This runs once per date, before `org-journal-after-entry-create-hook'.")
453453
(global-set-key (kbd "C-c C-j") 'org-journal-new-entry)
454454

455455
(defmacro org-journal--with-journal (file &rest body)
456-
"Opens JOURNAL-FILE in fundamental mode, or switches to the buffer which is visiting JOURNAL-FILE.
456+
"Opens JOURNAL-FILE in fundamental mode, or switches to the
457+
buffer which is visiting JOURNAL-FILE.
457458
458-
Returns the last value from BODY. If the buffer didn't exist before it will be deposed."
459+
Returns the last value from BODY. If the buffer didn't exist
460+
before it will be deposed."
459461
;; Use find-file... instead of view-file... since
460462
;; view-file does not respect auto-mode-alist
461463
(declare (indent 1))
@@ -528,7 +530,8 @@ Returns the last value from BODY. If the buffer didn't exist before it will be d
528530

529531
;;;###autoload
530532
(defun org-journal-convert-created-property-timestamps (old-format)
531-
"Convert CREATED property timestamps to `org-journal-created-property-timestamp-format'."
533+
"Convert format of CREATED property timestamps.
534+
Convert OLD-FORMAT or input to `org-journal-created-property-timestamp-format'."
532535
(interactive "sEnter old format: ")
533536
(if (org-journal--daily-p)
534537
(message "Nothing to do, org-journal-file-type is 'daily")
@@ -568,21 +571,21 @@ the first date of the year."
568571
;; Round to the monday of the current week, e.g. 20181231 is the first week of 2019
569572
(`weekly
570573
(let* ((absolute-monday
571-
(calendar-iso-to-absolute
572-
(mapcar 'string-to-number
573-
(split-string (format-time-string "%V 1 %G" time) " "))))
574-
(absolute-now
575-
(calendar-absolute-from-gregorian
576-
(mapcar 'string-to-number
577-
(split-string (format-time-string "%m %d %Y" time) " "))))
578-
(target-date
579-
(+ absolute-monday
580-
(- org-journal-start-on-weekday 1)))
581-
(date
574+
(calendar-iso-to-absolute
575+
(mapcar 'string-to-number
576+
(split-string (format-time-string "%V 1 %G" time) " "))))
577+
(absolute-now
578+
(calendar-absolute-from-gregorian
579+
(mapcar 'string-to-number
580+
(split-string (format-time-string "%m %d %Y" time) " "))))
581+
(target-date
582+
(+ absolute-monday
583+
(- org-journal-start-on-weekday 1)))
584+
(date
582585
(calendar-gregorian-from-absolute
583586
(if (> target-date absolute-now)
584-
(- target-date 7)
585-
target-date))))
587+
(- target-date 7)
588+
target-date))))
586589
(org-journal--calendar-date->time date)))
587590
;; Round to the first day of the month, e.g. 20190301
588591
(`monthly
@@ -594,7 +597,8 @@ the first date of the year."
594597
(mapcar 'string-to-number (split-string (format-time-string "1 1 %Y" time) " "))))))
595598

596599
(defun org-journal--get-entry-path (&optional time)
597-
"Return the path to an entry matching TIME, if no TIME is given, uses the current time."
600+
"Return the path to an entry matching TIME.
601+
If no TIME is given, uses the current time."
598602
(let ((file (file-truename
599603
(expand-file-name
600604
(format-time-string org-journal-file-format
@@ -747,12 +751,12 @@ This allows the use of `org-journal-tag-alist' and
747751
(defun org-journal-new-entry (prefix &optional time)
748752
"Open today's journal file and start a new entry.
749753
750-
With a PREFIX arg, open the today's file, create a heading if it doesn't exist yet,
751-
but do not create a new entry.
754+
With a PREFIX arg, open the today's file, create a heading if it
755+
doesn't exist yet, but do not create a new entry.
752756
753-
If given a TIME, create an entry for the time's day. If no TIME was given,
754-
use the current time (which is interpreted as belonging to yesterday if
755-
smaller than `org-extend-today-until').
757+
If given a TIME, create an entry for the time's day. If no TIME
758+
was given, use the current time (which is interpreted as
759+
belonging to yesterday if smaller than `org-extend-today-until').
756760
757761
Whenever a journal entry is created the `org-journal-after-entry-create-hook'
758762
hook is run."
@@ -1073,11 +1077,12 @@ This is the counterpart of `org-journal--file-name->calendar-date' for
10731077
(defun org-journal-new-date-entry (prefix &optional event)
10741078
"Open the journal for the date indicated by point and start a new entry.
10751079
1076-
If the date is not today, it won't be given a time heading. With one prefix (C-u),
1077-
don't add a new heading.
1080+
If the date is not today, it won't be given a time heading. With
1081+
one prefix (C-u), don't add a new heading.
10781082
1079-
If the date is in the future, create a schedule entry, unless two universal prefix
1080-
arguments (C-u C-u) are given. In that case insert just the heading."
1083+
If the date is in the future, create a schedule entry, unless two
1084+
universal prefix arguments (C-u C-u) are given. In that case
1085+
insert just the heading."
10811086
(interactive
10821087
(list current-prefix-arg last-nonmenu-event))
10831088
(let* ((time (or (ignore-errors (org-journal--calendar-date->time (calendar-cursor-to-date t event)))
@@ -1540,8 +1545,8 @@ existed before)."
15401545
(def-edebug-spec org-journal--with-find-file (form body))
15411546

15421547
(defun org-journal--update-org-agenda-files ()
1543-
"Adds the current and future journal files to `org-agenda-files' containing TODOs,
1544-
and cleans out past org-journal files."
1548+
"Adds the current and future journal files to `org-agenda-files'
1549+
containing TODOs, and cleans out past org-journal files."
15451550
(when org-journal-enable-agenda-integration
15461551
(let ((not-org-journal-agenda-files
15471552
(seq-filter
@@ -1560,7 +1565,7 @@ and cleans out past org-journal files."
15601565
(org-journal--calendar-date->time beg)
15611566
(org-journal--calendar-date->time end)))))
15621567
(org-store-new-agenda-file-list (append not-org-journal-agenda-files
1563-
org-journal-agenda-files)))))
1568+
org-journal-agenda-files)))))
15641569

15651570
(defvar org-journal--schedule-buffer-name "*Org-journal schedule*")
15661571

@@ -1859,7 +1864,7 @@ If STR is empty, search for all entries using `org-journal-time-prefix'."
18591864
(defun org-journal-re-encrypt-journals (recipient)
18601865
"Re-encrypt journal files."
18611866
(interactive (list (epa-select-keys (epg-make-context epa-protocol)
1862-
"Select new recipient for encryption.
1867+
"Select new recipient for encryption.
18631868
Only one recipient is supported. ")))
18641869

18651870
(unless recipient
@@ -1869,29 +1874,29 @@ Only one recipient is supported. ")))
18691874
(user-error "org-journal encryption not enabled"))
18701875

18711876
(cl-loop
1872-
with buf
1873-
with kill-buffer
1874-
for journal in (org-journal--list-files)
1875-
do
1876-
(setq buf (find-buffer-visiting journal)
1877-
kill-buffer nil)
1878-
1879-
(when (and buf
1880-
(buffer-modified-p buf)
1881-
(y-or-n-p (format "Journal \"%s\" modified, save before re-encryption?"
1882-
(file-name-nondirectory journal))))
1883-
(save-buffer buf))
1884-
1885-
(unless buf
1886-
(setq kill-buffer t
1887-
buf (find-file-noselect journal)))
1888-
1889-
(with-current-buffer buf
1890-
(let ((epa-file-encrypt-to (epg-sub-key-id (car (epg-key-sub-key-list (car recipient))))))
1891-
(set-buffer-modified-p t)
1892-
(save-buffer)
1893-
(when kill-buffer
1894-
(kill-buffer))))))
1877+
with buf
1878+
with kill-buffer
1879+
for journal in (org-journal--list-files)
1880+
do
1881+
(setq buf (find-buffer-visiting journal)
1882+
kill-buffer nil)
1883+
1884+
(when (and buf
1885+
(buffer-modified-p buf)
1886+
(y-or-n-p (format "Journal \"%s\" modified, save before re-encryption?"
1887+
(file-name-nondirectory journal))))
1888+
(save-buffer buf))
1889+
1890+
(unless buf
1891+
(setq kill-buffer t
1892+
buf (find-file-noselect journal)))
1893+
1894+
(with-current-buffer buf
1895+
(let ((epa-file-encrypt-to (epg-sub-key-id (car (epg-key-sub-key-list (car recipient))))))
1896+
(set-buffer-modified-p t)
1897+
(save-buffer)
1898+
(when kill-buffer
1899+
(kill-buffer))))))
18951900

18961901
(defun org-journal--decrypt ()
18971902
"Decrypt journal entry at point."
@@ -1908,7 +1913,8 @@ Only one recipient is supported. ")))
19081913
(save-buffer))))
19091914

19101915
(defun org-journal-default-enable-encryption ()
1911-
"Add org-journal-encryption-hook to the hook org-journal-encrypt-on, enabling encryption by default."
1916+
"Add org-journal-encryption-hook to the hook org-journal-encrypt-on,
1917+
enabling encryption by default."
19121918
(add-hook org-journal-encrypt-on
19131919
'org-journal-encryption-hook
19141920
nil t))

0 commit comments

Comments
 (0)