[Org] Avoid some byte compiler warnings

This commit is contained in:
Daniel - 2018-01-16 17:55:15 +01:00
parent 925bb90dee
commit 55e3c0ab8f
Signed by: dbo
GPG Key ID: 4F63DB96D45AA9C6
1 changed files with 37 additions and 33 deletions

View File

@ -108,17 +108,17 @@
org-clock-auto-clock-resolution 'when-no-clock-is-running org-clock-auto-clock-resolution 'when-no-clock-is-running
org-clock-mode-line-total 'auto org-clock-mode-line-total 'auto
org-clock-report-include-clocking-task t org-clock-report-include-clocking-task t
org-clock-in-switch-to-state (lambda (kw) org-clock-in-switch-to-state (lambda (_)
(when (and (not (when (and (not
(and (boundp 'org-capture-mode) (and (boundp 'org-capture-mode)
org-capture-mode))) org-capture-mode)))
(cond (cond
((member (org-get-todo-state) ((member (org-get-todo-state)
(list "TODO" "READ")) (list "TODO" "READ"))
"CONT") "CONT")
((member (org-get-todo-state) ((member (org-get-todo-state)
(list "GOTO")) (list "GOTO"))
"ATTN"))))) "ATTN")))))
(org-clock-persistence-insinuate) (org-clock-persistence-insinuate)
@ -253,7 +253,7 @@ forces clocking in of the default task."
(defun db/update-org-agenda-files (symbol value) (defun db/update-org-agenda-files (symbol value)
"Set SYMBOL to VALUE and update `org-agenda-files afterwards." "Set SYMBOL to VALUE and update `org-agenda-files afterwards."
(set-default symbol value) (set-default symbol value)
(setq org-agenda-files (remove-duplicates (setq org-agenda-files (cl-remove-duplicates
(cl-remove-if #'string-empty-p (cl-remove-if #'string-empty-p
(mapcar (lambda (symbol) (mapcar (lambda (symbol)
(when (boundp symbol) (when (boundp symbol)
@ -364,7 +364,7 @@ Ignores MATCH."
(let* ((today (org-today)) (let* ((today (org-today))
(thefiles (org-agenda-files nil 'ifmode)) (thefiles (org-agenda-files nil 'ifmode))
(inhibit-redisplay (not debug-on-error)) (inhibit-redisplay (not debug-on-error))
s rtn rtnall file files date start-pos end-pos) s rtn rtnall file files date start-pos)
;; headline ;; headline
(unless org-agenda-compact-blocks (unless org-agenda-compact-blocks
@ -445,7 +445,7 @@ are equal return nil."
(b-date (or (org-entry-get b-pos prop) (b-date (or (org-entry-get b-pos prop)
(format "<%s>" (org-read-date t nil "now")))) (format "<%s>" (org-read-date t nil "now"))))
(cmp (compare-strings a-date nil nil b-date nil nil))) (cmp (compare-strings a-date nil nil b-date nil nil)))
(if (eq cmp t) nil (signum cmp)))))) (if (eq cmp t) nil (cl-signum cmp))))))
(setq org-agenda-custom-commands (setq org-agenda-custom-commands
`(("A" "Main List" `(("A" "Main List"
@ -515,10 +515,10 @@ are equal return nil."
(defun db/org-add-clocking-time (starting-time ending-time) (defun db/org-add-clocking-time (starting-time ending-time)
"Add \"CLOCK:\" line to the task under point in the current org-mode file." "Add \"CLOCK:\" line to the task under point in the current org-mode file."
(interactive (interactive
(list (starting-time (org-read-date 4 'totime nil (list (org-read-date 4 'totime nil
"Start:" (current-time) nil t)) "Start:" (current-time) nil t)
(ending-time (org-read-date 4 'totime nil (org-read-date 4 'totime nil
"End:" (current-time) nil t)))) "End:" (current-time) nil t)))
(if (not (eq major-mode 'org-mode)) (if (not (eq major-mode 'org-mode))
(user-error "Must be in org mode") (user-error "Must be in org mode")
(save-mark-and-excursion (save-mark-and-excursion
@ -688,9 +688,9 @@ _y_: ?y? year _q_: quit _L__l__c_: ?l?
;; Things copied from `org-clock-update-time-maybe ;; Things copied from `org-clock-update-time-maybe
(let* ((s (- (let* ((s (-
(float-time (float-time
(apply #'encode-time (org-parse-time-string stamp-2 nil t))) (apply #'encode-time (org-parse-time-string stamp-2 t)))
(float-time (float-time
(apply #'encode-time (org-parse-time-string stamp-1 nil t))))) (apply #'encode-time (org-parse-time-string stamp-1 t)))))
(neg (< s 0)) (neg (< s 0))
(s (abs s)) (s (abs s))
(h (floor (/ s 3600))) (h (floor (/ s 3600)))
@ -792,10 +792,10 @@ This is done only if the value of this variable is not null."
db/org-default-work-file))) db/org-default-work-file)))
(org-agenda-new-buffers nil)) (org-agenda-new-buffers nil))
;; check whether we need to do something ;; check whether we need to do something
(when (some (lambda (org-file) (when (cl-some (lambda (org-file)
(file-newer-than-file-p org-file (file-newer-than-file-p org-file
org-icalendar-combined-agenda-file)) org-icalendar-combined-agenda-file))
org-agenda-files) org-agenda-files)
(message "Exporting diary ...") (message "Exporting diary ...")
;; open files manually to avoid polluting `org-agenda-new-buffers; we ;; open files manually to avoid polluting `org-agenda-new-buffers; we
;; dont want these buffers to be closed after exporting ;; dont want these buffers to be closed after exporting
@ -925,11 +925,12 @@ Current Task: %`org-clock-current-task; "
;;; Custom links for Windows ;;; Custom links for Windows
(org-link-set-parameters "onenote" :follow #'db/org-onenote-open) (when (eq system-type 'windows-nt)
(org-link-set-parameters "onenote" :follow #'db/org-onenote-open)
(defun db/org-onenote-open (path) (defun db/org-onenote-open (path)
"Visit OneNote document on PATH." "Visit OneNote document on PATH."
(w32-shell-execute "open" path)) (w32-shell-execute "open" path)))
;;; Reporting ;;; Reporting
@ -939,7 +940,8 @@ Current Task: %`org-clock-current-task; "
(defgroup timeline-reporting nil (defgroup timeline-reporting nil
"Functionality for formatting timelines." "Functionality for formatting timelines."
:tag "Formatting timelines") :tag "Timeline Formatter"
:group 'applications)
(require 'dash) (require 'dash)
@ -988,7 +990,7 @@ always true that TSTART ≤ END ≤ TEND or TSTART ≤ START ≤ TEND."
(tend (cond ((stringp tend) (org-time-string-to-seconds tend)) (tend (cond ((stringp tend) (org-time-string-to-seconds tend))
((consp tend) (float-time tend)) ((consp tend) (float-time tend))
(t tend))) (t tend)))
task-clock-times headline times) task-clock-times times)
(db/org-map-clock-lines-and-entries (db/org-map-clock-lines-and-entries
;; when on clock line, collect times ;; when on clock line, collect times
#'(lambda (start end) #'(lambda (start end)
@ -1059,13 +1061,14 @@ Markers to org mode tasks are combined into a list."
A slot is short if it is not longer than THRESHOLD seconds. A slot is short if it is not longer than THRESHOLD seconds.
Resulting gaps are distributed evenly among adjacent slots." Resulting gaps are distributed evenly among adjacent slots."
(let ((start (first (first timeline))) (let ((start (first (first timeline)))
(end (second (car (last timeline))))) (end (second (car (last timeline))))
new-timeline)
;; remove all slots that are too short ;; remove all slots that are too short
(setq new-timeline (setq new-timeline
(remove-if (lambda (entry) (cl-remove-if (lambda (entry)
(<= (- (second entry) (first entry)) (<= (- (second entry) (first entry))
threshold)) threshold))
timeline)) timeline))
;; reset start and end times ;; reset start and end times
(setf (first (first new-timeline)) start) (setf (first (first new-timeline)) start)
@ -1160,7 +1163,8 @@ ending at 23:61. When not given, FILES defaults to
(interactive) (interactive)
(goto-char (point-min)) (goto-char (point-min))
(kill-line 8) (kill-line 8)
(replace-regexp "^\"\\|\"$\\|\";\"" "|") (while (re-search-forward "^\"\\|\"$\\|\";\"")
(replace-match "|"))
(goto-char (point-min)) (goto-char (point-min))
(org-mode) (org-mode)
(org-table-align) (org-table-align)
@ -1171,7 +1175,7 @@ ending at 23:61. When not given, FILES defaults to
("Buchungsdetails" . 3)) ("Buchungsdetails" . 3))
do (progn (goto-char (point-min)) do (progn (goto-char (point-min))
(search-forward word) (search-forward word)
(dotimes (i count) (dotimes (_ count)
(org-table-move-column-right)))) (org-table-move-column-right))))
(goto-char (point-min))) (goto-char (point-min)))