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,55 +1663,52 @@ buffer and update it."
(defun org-quarter-to-date (quarter year)
"Get the date (week day year) of the first day of a given quarter."
(cond
((= quarter 1)
(setq startday (org-day-of-week 1 1 year))
(let (startday)
(cond
((= startday 0)
(list 52 7 (- year 1)))
((= startday 6)
(list 52 6 (- year 1)))
((<= startday 4)
(list 1 startday year))
((> startday 4)
(list 53 startday (- year 1)))
)
)
((= quarter 2)
(setq startday (org-day-of-week 1 4 year))
(cond
((= startday 0)
(list 13 startday year))
((< startday 4)
(list 14 startday year))
((>= startday 4)
(list 13 startday year))
)
)
((= quarter 3)
(setq startday (org-day-of-week 1 7 year))
(cond
((= startday 0)
(list 26 startday year))
((< startday 4)
(list 27 startday year))
((>= startday 4)
(list 26 startday year))
)
)
((= quarter 4)
(setq startday (org-day-of-week 1 10 year))
(cond
((= startday 0)
(list 39 startday year))
((<= startday 4)
(list 40 startday year))
((> startday 4)
(list 39 startday year))
)
)
)
)
((= quarter 1)
(setq startday (org-day-of-week 1 1 year))
(cond
((= startday 0)
(list 52 7 (- year 1)))
((= startday 6)
(list 52 6 (- year 1)))
((<= startday 4)
(list 1 startday year))
((> startday 4)
(list 53 startday (- year 1)))
)
)
((= quarter 2)
(setq startday (org-day-of-week 1 4 year))
(cond
((= startday 0)
(list 13 startday year))
((< startday 4)
(list 14 startday year))
((>= startday 4)
(list 13 startday year))
)
)
((= quarter 3)
(setq startday (org-day-of-week 1 7 year))
(cond
((= startday 0)
(list 26 startday year))
((< startday 4)
(list 27 startday year))
((>= startday 4)
(list 26 startday year))
)
)
((= quarter 4)
(setq startday (org-day-of-week 1 10 year))
(cond
((= startday 0)
(list 39 startday year))
((<= startday 4)
(list 40 startday year))
((> startday 4)
(list 39 startday year)))))))
(defun org-clock-special-range (key &optional time as-strings)
"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) 4) 2)
((>= (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
((string-match "^[0-9]+$" skey)
(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
(setq interval (* -1 (+ (- q 1) 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
(if (= 0 (nth 1 tmp))
(setq shiftedy (- y (nth 0 tmp))
@ -2032,7 +2030,7 @@ from the dynamic block defintion."
(indent (plist-get params :indent))
range-text total-time tbl level hlc formula pcol
file-time entries entry headline
recalc content narrow-cut-p)
recalc content narrow-cut-p tcol)
;; Implement abbreviations
(when (plist-get params :compact)

View File

@ -418,6 +418,12 @@ LIMIT."
(looking-at (concat "\\(?:" regexp "\\)\\'")))))
(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)
;; arch-tag: a0a0579f-e68c-4bdf-9e55-93768b846bbe

View File

@ -35,6 +35,16 @@
(require 'org-macs)
(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
(defgroup org-complete nil
@ -119,6 +129,7 @@ When completing for #+STARTUP, for example, this function returns
(car (org-thing-at-point)))
pcomplete-default-completion-function))))
(defvar org-additional-option-like-keywords)
(defun pcomplete/org-mode/file-option ()
"Complete against all valid file options."
(require 'org-exp)
@ -138,6 +149,7 @@ When completing for #+STARTUP, for example, this function returns
org-additional-option-like-keywords)))))
(substring pcomplete-stub 2)))
(defvar org-startup-options)
(defun pcomplete/org-mode/file-option/startup ()
"Complete arguments for the #+STARTUP file option."
(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)))))
(pcomplete-here vars)))
(defvar org-link-abbrev-alist-local)
(defvar org-link-abbrev-alist)
(defun pcomplete/org-mode/link ()
"Complete against defined #+LINK patterns."
(pcomplete-here
(pcomplete-uniqify-list (append (mapcar 'car org-link-abbrev-alist-local)
(mapcar 'car org-link-abbrev-alist)))))
(defvar org-entities)
(defun pcomplete/org-mode/tex ()
"Complete against TeX-style HTML entity names."
(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)))
(substring pcomplete-stub 1))))
(defvar org-todo-keywords-1)
(defun pcomplete/org-mode/todo ()
"Complete against known TODO keywords."
(pcomplete-here (pcomplete-uniqify-list org-todo-keywords-1)))
(defvar org-todo-line-regexp)
(defun pcomplete/org-mode/searchhead ()
"Complete against all headings.
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)))
(substring pcomplete-stub 1))))
(defvar org-tag-alist)
(defun pcomplete/org-mode/tag ()
"Complete a tag name. Omit tags already set."
(while (pcomplete-here

View File

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