2 Commits

Autor SHA1 Nachricht Datum
  Daniel 7833e28185
Make checkdoc happy about db-org vor 3 Monaten
  Daniel 6e8b878b4d
Warn when using the deprecated RESET_CHECK_BOXES property vor 3 Monaten
1 geänderte Dateien mit 31 neuen und 31 gelöschten Zeilen
  1. 31
    31
      site-lisp/db-org.el

+ 31
- 31
site-lisp/db-org.el Datei anzeigen

@@ -26,10 +26,10 @@
26 26
 ;;; Agenda Customization
27 27
 
28 28
 (defun db/check-special-org-files-in-agenda (&rest args)
29
-  "Check whether the special org-mode files are part of `org-agenda-files', ignoring ARGS.
30
-The special org-mode files are `db/org-default-org-file',
29
+  "Check special Org mode files to be part of the variable `org-agenda-files'.
30
+The special Org mode files are `db/org-default-org-file',
31 31
 `db/org-default-work-file', `db/org-default-home-file', and
32
-`db/org-default-refile-file'."
32
+`db/org-default-refile-file'.  Ignore ARGS."
33 33
   (ignore args)
34 34
   (require 'org)
35 35
   (let ((agenda-files (mapcar #'file-truename (org-agenda-files t))))
@@ -227,7 +227,9 @@ Add this function to `org-agenda-finalize-hook' to enable this."
227 227
 ;;; Capturing
228 228
 
229 229
 (defun db/org-timestamp-difference (stamp-1 stamp-2)
230
-  "Returns time difference between two given org-mode timestamps."
230
+  "Return time difference between two Org mode timestamps.
231
+STAMP-1 and STAMP-2 must be understood by
232
+`org-parse-time-string'."
231 233
   ;; Things copied from `org-clock-update-time-maybe’
232 234
   (let* ((s (-
233 235
              (float-time
@@ -243,8 +245,7 @@ Add this function to `org-agenda-finalize-hook' to enable this."
243 245
 ;; Capture Code Snippets
244 246
 ;; from http://ul.io/nb/2018/04/30/better-code-snippets-with-org-capture/
245 247
 (defun db/org-capture-code-snippet (filename)
246
-  "Format Org mode entry for capturing code in active region in
247
-the buffer visiting FILENAME."
248
+  "Format Org mode source block with contant of active region in FILENAME."
248 249
   (with-current-buffer (find-buffer-visiting filename)
249 250
     (let ((code-snippet (buffer-substring-no-properties (mark) (- (point) 1)))
250 251
           (func-name (which-function))
@@ -277,9 +278,8 @@ In ~%s~:
277 278
   (delete-other-windows)
278 279
   (org-capture))
279 280
 
280
-(defun db/delete-frame-if-capture (&rest r)
281
+(defun db/delete-frame-if-capture (&rest)
281 282
   "If current frame was made for a capture, close after done."
282
-  (ignore r)
283 283
   (when (equal (frame-parameter nil 'name)
284 284
                "capture")
285 285
     (delete-frame)))
@@ -305,8 +305,9 @@ tag PERIODIC."
305 305
 ;; from `org-checklist’ by James TD Smith (@ ahktenzero (. mohorovi cc)),
306 306
 ;; version: 1.0
307 307
 (defun org-reset-checkbox-state-maybe ()
308
-  "Reset all checkboxes in an entry if the `RESET_CHECK_BOXES' property is set"
308
+  "Reset all checkboxes in an entry if `RESET_CHECK_BOXES' property is set."
309 309
   (interactive "*")
310
+  (warn "Using the RESET_CHECK_BOXES property is deprecated, user periodic tasks instead")
310 311
   (if (org-entry-get (point) "RESET_CHECK_BOXES")
311 312
       (org-reset-checkbox-state-subtree)))
312 313
 
@@ -350,8 +351,7 @@ tag PERIODIC."
350 351
          (org-clock-in '(4))))))))
351 352
 
352 353
 (defun db/save-current-org-task-to-file ()
353
-  "Format currently clocked task and write it to
354
-`db/org-clock-current-task-file'."
354
+  "Format currently clocked task and write it to`db/org-clock-current-task-file'."
355 355
   (with-temp-file db/org-clock-current-task-file
356 356
     (let ((clock-buffer (marker-buffer org-clock-marker)))
357 357
       (if (null clock-buffer)
@@ -359,8 +359,7 @@ tag PERIODIC."
359 359
         (insert org-clock-heading)))))
360 360
 
361 361
 (defun db/org-update-frame-title-with-current-clock ()
362
-  "Set the title of all active frames to the headline of the
363
-  current task."
362
+  "Set title of all active frames to the headline of the current task."
364 363
   (interactive)
365 364
   (let ((clock-buffer (marker-buffer org-clock-marker)))
366 365
     (when clock-buffer
@@ -390,7 +389,7 @@ tag PERIODIC."
390 389
   "Clock in org mode task as given by TASK-ID."
391 390
   (let ((location (org-id-find task-id 'marker)))
392 391
     (if (null location)
393
-        (user-error "Invalid location «%s» given." task-id)
392
+        (user-error "Invalid location give: %s»" task-id)
394 393
       (org-with-point-at location
395 394
         (org-clock-in))
396 395
       (org-save-all-org-buffers))))
@@ -486,14 +485,14 @@ forces clocking in of the default task."
486 485
 (defun db/org-onenote-open (path)
487 486
   "Visit OneNote document on PATH."
488 487
   (unless (file-executable-p db/path-to-onenote)
489
-    (user-error "Path for OneNote is not executable, please customize `db/path-to-onenote’."))
488
+    (user-error "Path for OneNote is not executable, please customize `db/path-to-onenote’"))
490 489
   (start-process "OneNote" nil db/path-to-onenote "/hyperlink" path))
491 490
 
492 491
 (defun db/org-outlook-open (id)
493
-  "Open the Outlook item identified by ID.
494
-  ID should be an Outlook GUID."
492
+  "Open Outlook item identified by ID.
493
+ID should be an Outlook GUID."
495 494
   (unless (file-executable-p db/path-to-outlook)
496
-    (user-error "Path for Outlook is not executable, please customize `db/path-to-outlook’."))
495
+    (user-error "Path for Outlook is not executable, please customize `db/path-to-outlook’"))
497 496
   (w32-shell-execute "open" db/path-to-outlook (concat "/select outlook:" id)))
498 497
 
499 498
 (defun db/org-rfc-open (number)
@@ -541,9 +540,9 @@ open RFC in HTML format in the default browser."
541 540
        (org-clock-update-time-maybe)))))
542 541
 
543 542
 (defun db/find-csv-in-org (arg)
544
-  "Interactively CSV find file and open it as Org mode table.
543
+  "Interactively find CSV file and open it as Org mode table.
545 544
 Default separator is \";\", but this can be changed interactively
546
-by passing a universal argument."
545
+by passing a non-nil value for ARG."
547 546
   (interactive "P")
548 547
   (let ((separator (if arg (read-from-minibuffer "Separator (regular expression): ")
549 548
                      ";")))
@@ -576,7 +575,7 @@ drawers, will be copied to point."
576 575
                                                 (org-element-at-point))))
577 576
                         (unless (string-equal (org-element-property :title template-element)
578 577
                                               "Template")
579
-                          (user-error "Template must be first headline in periodic task."))
578
+                          (user-error "Template must be first headline in periodic task"))
580 579
                         ;; Starting from the end of the last element in the
581 580
                         ;; subtree, we go up until we find a drawer or a
582 581
                         ;; headline; everything in between is considered to be the template
@@ -598,14 +597,14 @@ drawers, will be copied to point."
598 597
 ;;; Calendar
599 598
 
600 599
 (defun db/export-diary ()
601
-  "Export diary.org as ics file to the current value of `org-icalendar-combined-agenda-file’.
600
+  "Export diary.org as ics file to `org-icalendar-combined-agenda-file’.
602 601
 This is done only if the value of this variable is not null."
603 602
   (interactive)
604 603
   (cond
605 604
    ((null org-icalendar-combined-agenda-file)
606 605
     (message "`org-icalendar-combined-agenda-file’ not set, not exporting diary."))
607 606
    ((not (file-name-absolute-p org-icalendar-combined-agenda-file))
608
-    (user-error "`org-icalendar-combined-agenda-file’ not an absolute path, aborting."))
607
+    (user-error "`org-icalendar-combined-agenda-file’ not an absolute path, aborting"))
609 608
    (t
610 609
     (progn
611 610
       (org-save-all-org-buffers)
@@ -663,11 +662,12 @@ not."
663 662
 
664 663
 (defun db/org--get-location (&optional arg)
665 664
   "Interactively query for location and return mark.
666
-Searches through the current file, and through all of
667
-`org-agenda-files', `org-agenda-text-search-extra-files', and the
668
-current buffer, if ARG is non-nil.  Search is always conducted up
669
-to level 9.  If the selected location does not have an associated
670
-mark, error out."
665
+Searches through the current file, and through all files in the
666
+variables `org-agenda-files',
667
+`org-agenda-text-search-extra-files', and the current buffer, if
668
+ARG is non-nil.  Search is always conducted up to level 9.  If
669
+the selected location does not have an associated mark, error
670
+out."
671 671
   (let* ((org-refile-targets (if arg
672 672
                                  `((org-agenda-files :maxlevel . 9)
673 673
                                    (,(cl-remove-if-not
@@ -703,9 +703,9 @@ prompt for an item."
703 703
 
704 704
 Search through all items of the current buffer, or
705 705
 `db/org-default-org-file' if the current buffer is not associated
706
-with a file.  If ARG is non-nil, include all files in
707
-`org-agenda-files' and `org-agenda-text-search-extra-files' in
708
-this search.
706
+with a file.  If ARG is non-nil, include all files in the
707
+variables `org-agenda-files' and
708
+`org-agenda-text-search-extra-files' in this search.
709 709
 
710 710
 Use `org-store-link' to save link to `org-stored-links'."
711 711
   (interactive "P")

Laden…
Abbrechen
Speichern