1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-12-29 11:02:33 +00:00

Make compiler happy

* lisp/org-clock.el (org-quarter-to-date): Define variables.
(org-clock-special-range): Defin variables.  Use org-floor*.
(org-clocktable-write-default): Define tcol.
* lisp/org-compat.el (org-floor*): New function.
* lisp/org-complete.el: Declare external functions and variables.
This commit is contained in:
Carsten Dominik 2010-12-03 10:20:41 +01:00
parent 61b2247631
commit 94c19c82b7
4 changed files with 75 additions and 54 deletions

View File

@ -1663,6 +1663,7 @@ buffer and update it."
(defun org-quarter-to-date (quarter year) (defun org-quarter-to-date (quarter year)
"Get the date (week day year) of the first day of a given quarter." "Get the date (week day year) of the first day of a given quarter."
(let (startday)
(cond (cond
((= quarter 1) ((= quarter 1)
(setq startday (org-day-of-week 1 1 year)) (setq startday (org-day-of-week 1 1 year))
@ -1707,11 +1708,7 @@ buffer and update it."
((<= startday 4) ((<= startday 4)
(list 40 startday year)) (list 40 startday year))
((> startday 4) ((> startday 4)
(list 39 startday year)) (list 39 startday year)))))))
)
)
)
)
(defun org-clock-special-range (key &optional time as-strings) (defun org-clock-special-range (key &optional time as-strings)
"Return two times bordering a special time range. "Return two times bordering a special time range.
@ -1733,7 +1730,8 @@ the returned times will be formatted strings."
((>= (nth 4 tm) 7) 3) ((>= (nth 4 tm) 7) 3)
((>= (nth 4 tm) 4) 2) ((>= (nth 4 tm) 4) 2)
((>= (nth 4 tm) 1) 1))) ((>= (nth 4 tm) 1) 1)))
s1 m1 h1 d1 month1 y1 diff ts te fm txt w date) s1 m1 h1 d1 month1 y1 diff ts te fm txt w date
interval tmp shiftedy shiftedm shiftedq)
(cond (cond
((string-match "^[0-9]+$" skey) ((string-match "^[0-9]+$" skey)
(setq y (string-to-number skey) m 1 d 1 key 'year)) (setq y (string-to-number skey) m 1 d 1 key 'year))
@ -1793,7 +1791,7 @@ the returned times will be formatted strings."
((< (+ (- q 1) shift) 0) ; shift not in this year ((< (+ (- q 1) shift) 0) ; shift not in this year
(setq interval (* -1 (+ (- q 1) shift))) (setq interval (* -1 (+ (- q 1) shift)))
; set tmp to ((years to shift) (quarters to shift)) ; set tmp to ((years to shift) (quarters to shift))
(setq tmp (floor* interval 4)) (setq tmp (org-floor* interval 4))
; due to the use of floor, 0 quarters actually means 4 ; due to the use of floor, 0 quarters actually means 4
(if (= 0 (nth 1 tmp)) (if (= 0 (nth 1 tmp))
(setq shiftedy (- y (nth 0 tmp)) (setq shiftedy (- y (nth 0 tmp))
@ -2032,7 +2030,7 @@ from the dynamic block defintion."
(indent (plist-get params :indent)) (indent (plist-get params :indent))
range-text total-time tbl level hlc formula pcol range-text total-time tbl level hlc formula pcol
file-time entries entry headline file-time entries entry headline
recalc content narrow-cut-p) recalc content narrow-cut-p tcol)
;; Implement abbreviations ;; Implement abbreviations
(when (plist-get params :compact) (when (plist-get params :compact)

View File

@ -418,6 +418,12 @@ LIMIT."
(looking-at (concat "\\(?:" regexp "\\)\\'"))))) (looking-at (concat "\\(?:" regexp "\\)\\'")))))
(not (null pos))))) (not (null pos)))))
(defun org-floor* (x &optional y)
"Return a list of the floor of X and the fractional part of X.
With two arguments, return floor and remainder of their quotient."
(let ((q (floor x y)))
(list q (- x (if y (* y q) q)))))
(provide 'org-compat) (provide 'org-compat)
;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe ;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe

View File

@ -35,6 +35,16 @@
(require 'org-macs) (require 'org-macs)
(require 'pcomplete) (require 'pcomplete)
(declare-function org-split-string "org" (string &optional separators))
(declare-function org-get-current-options "org-exp" ())
(declare-function org-make-org-heading-search-string "org"
(&optional string heading))
(declare-function org-get-buffer-tags "org" ())
(declare-function org-get-tags "org" ())
(declare-function org-buffer-property-keys "org"
(&optional include-specials include-defaults include-columns))
(declare-function org-entry-properties "org" (&optional pom which specific))
;;;; Customization variables ;;;; Customization variables
(defgroup org-complete nil (defgroup org-complete nil
@ -119,6 +129,7 @@ When completing for #+STARTUP, for example, this function returns
(car (org-thing-at-point))) (car (org-thing-at-point)))
pcomplete-default-completion-function)))) pcomplete-default-completion-function))))
(defvar org-additional-option-like-keywords)
(defun pcomplete/org-mode/file-option () (defun pcomplete/org-mode/file-option ()
"Complete against all valid file options." "Complete against all valid file options."
(require 'org-exp) (require 'org-exp)
@ -138,6 +149,7 @@ When completing for #+STARTUP, for example, this function returns
org-additional-option-like-keywords))))) org-additional-option-like-keywords)))))
(substring pcomplete-stub 2))) (substring pcomplete-stub 2)))
(defvar org-startup-options)
(defun pcomplete/org-mode/file-option/startup () (defun pcomplete/org-mode/file-option/startup ()
"Complete arguments for the #+STARTUP file option." "Complete arguments for the #+STARTUP file option."
(while (pcomplete-here (while (pcomplete-here
@ -158,12 +170,15 @@ When completing for #+STARTUP, for example, this function returns
(lambda (a) (if (boundp a) (setq vars (cons (symbol-name a) vars))))) (lambda (a) (if (boundp a) (setq vars (cons (symbol-name a) vars)))))
(pcomplete-here vars))) (pcomplete-here vars)))
(defvar org-link-abbrev-alist-local)
(defvar org-link-abbrev-alist)
(defun pcomplete/org-mode/link () (defun pcomplete/org-mode/link ()
"Complete against defined #+LINK patterns." "Complete against defined #+LINK patterns."
(pcomplete-here (pcomplete-here
(pcomplete-uniqify-list (append (mapcar 'car org-link-abbrev-alist-local) (pcomplete-uniqify-list (append (mapcar 'car org-link-abbrev-alist-local)
(mapcar 'car org-link-abbrev-alist))))) (mapcar 'car org-link-abbrev-alist)))))
(defvar org-entities)
(defun pcomplete/org-mode/tex () (defun pcomplete/org-mode/tex ()
"Complete against TeX-style HTML entity names." "Complete against TeX-style HTML entity names."
(require 'org-entities) (require 'org-entities)
@ -171,10 +186,12 @@ When completing for #+STARTUP, for example, this function returns
(pcomplete-uniqify-list (remove nil (mapcar 'car-safe org-entities))) (pcomplete-uniqify-list (remove nil (mapcar 'car-safe org-entities)))
(substring pcomplete-stub 1)))) (substring pcomplete-stub 1))))
(defvar org-todo-keywords-1)
(defun pcomplete/org-mode/todo () (defun pcomplete/org-mode/todo ()
"Complete against known TODO keywords." "Complete against known TODO keywords."
(pcomplete-here (pcomplete-uniqify-list org-todo-keywords-1))) (pcomplete-here (pcomplete-uniqify-list org-todo-keywords-1)))
(defvar org-todo-line-regexp)
(defun pcomplete/org-mode/searchhead () (defun pcomplete/org-mode/searchhead ()
"Complete against all headings. "Complete against all headings.
This needs more work, to handle headings with lots of spaces in them." This needs more work, to handle headings with lots of spaces in them."
@ -190,6 +207,7 @@ This needs more work, to handle headings with lots of spaces in them."
(pcomplete-uniqify-list tbl))) (pcomplete-uniqify-list tbl)))
(substring pcomplete-stub 1)))) (substring pcomplete-stub 1))))
(defvar org-tag-alist)
(defun pcomplete/org-mode/tag () (defun pcomplete/org-mode/tag ()
"Complete a tag name. Omit tags already set." "Complete a tag name. Omit tags already set."
(while (pcomplete-here (while (pcomplete-here

View File

@ -72,11 +72,10 @@
(eval-when-compile (eval-when-compile
(require 'cl) (require 'cl)
(require 'gnus-sum) (require 'gnus-sum))
)
(require 'calendar) (require 'calendar)
(require 'pcomplete)
;; Emacs 22 calendar compatibility: Make sure the new variables are available ;; Emacs 22 calendar compatibility: Make sure the new variables are available
(when (fboundp 'defvaralias) (when (fboundp 'defvaralias)
(unless (boundp 'calendar-view-holidays-initially-flag) (unless (boundp 'calendar-view-holidays-initially-flag)