aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Dominik2006-01-20 13:53:32 +0000
committerCarsten Dominik2006-01-20 13:53:32 +0000
commit6e2752e742f9a65499e813fec0d0a2f3d4707fc0 (patch)
treecc7550d9094b824e47d9d4d73b056a06630c220b
parentd86e2d954dd2eb817d4318d26ba92307ac2a4863 (diff)
downloademacs-6e2752e742f9a65499e813fec0d0a2f3d4707fc0.tar.gz
emacs-6e2752e742f9a65499e813fec0d0a2f3d4707fc0.zip
(org-open-at-point): Fixed bug with matching a link.
Fixed buggy argument sequence in call to `org-view-tags'. (org-compile-prefix-format): Set `org-prefix-has-tag'. (org-prefix-has-tag): New variable. (org-format-agenda-item): Remove tags from headline if appropriate. (org-agenda-remove-tags-when-in-prefix): New option.
-rw-r--r--lisp/textmodes/org.el277
1 files changed, 153 insertions, 124 deletions
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index 7c686091319..926cc56bfe9 100644
--- a/lisp/textmodes/org.el
+++ b/lisp/textmodes/org.el
@@ -5,7 +5,7 @@
5;; Author: Carsten Dominik <dominik at science dot uva dot nl> 5;; Author: Carsten Dominik <dominik at science dot uva dot nl>
6;; Keywords: outlines, hypermedia, calendar, wp 6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ 7;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
8;; Version: 4.03 8;; Version: 4.04
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -81,6 +81,10 @@
81;; 81;;
82;; Changes since version 4.00: 82;; Changes since version 4.00:
83;; --------------------------- 83;; ---------------------------
84;; Version 4.04
85;; - Cleanup tags display in agenda.
86;; - Bug fixes.
87;;
84;; Version 4.03 88;; Version 4.03
85;; - Table alignment fixed for use with wide characters. 89;; - Table alignment fixed for use with wide characters.
86;; - `C-c -' leaves cursor in current table line. 90;; - `C-c -' leaves cursor in current table line.
@@ -111,7 +115,7 @@
111 115
112;;; Customization variables 116;;; Customization variables
113 117
114(defvar org-version "4.03" 118(defvar org-version "4.04"
115 "The version number of the file org.el.") 119 "The version number of the file org.el.")
116(defun org-version () 120(defun org-version ()
117 (interactive) 121 (interactive)
@@ -608,7 +612,8 @@ the prefix, you could use:
608 612
609 (setq org-agenda-prefix-format \" %-11:c% s\") 613 (setq org-agenda-prefix-format \" %-11:c% s\")
610 614
611See also the variable `org-agenda-remove-times-when-in-prefix'." 615See also the variables `org-agenda-remove-times-when-in-prefix' and
616`org-agenda-remove-tags-when-in-prefix'."
612 :type 'string 617 :type 'string
613 :group 'org-agenda) 618 :group 'org-agenda)
614 619
@@ -691,6 +696,16 @@ agenda entries."
691 :group 'org-agenda 696 :group 'org-agenda
692 :type 'boolean) 697 :type 'boolean)
693 698
699(defcustom org-agenda-remove-tags-when-in-prefix nil
700 "Non-nil means, the tags from copy of headline in agenda.
701When this is the symbol `prefix', only remove tags when
702`org-agenda-prefix-format' contains a `%T' specifier."
703 :group 'org-agenda
704 :type '(choice
705 (const :tag "Always" t)
706 (const :tag "Never" nil)
707 (const :tag "When prefix format contains %T" prefix)))
708
694(defgroup org-structure nil 709(defgroup org-structure nil
695 "Options concerning structure editing in Org-mode." 710 "Options concerning structure editing in Org-mode."
696 :tag "Org Structure" 711 :tag "Org Structure"
@@ -1875,42 +1890,43 @@ When this is non-nil, the headline after the keyword is set to the
1875 1890
1876;; Tell the compiler about dynamically scoped variables, 1891;; Tell the compiler about dynamically scoped variables,
1877;; and variables from other packages 1892;; and variables from other packages
1878(defvar zmacs-regions) 1893(eval-when-compile
1879(defvar original-date) 1894 (defvar zmacs-regions)
1880(defvar org-transient-mark-mode) 1895 (defvar original-date)
1881(defvar org-old-auto-fill-inhibit-regexp) 1896 (defvar org-transient-mark-mode)
1882(defvar orgtbl-mode-menu) 1897 (defvar org-old-auto-fill-inhibit-regexp)
1883(defvar org-html-entities) 1898 (defvar orgtbl-mode-menu)
1884(defvar org-goto-start-pos) 1899 (defvar org-html-entities)
1885(defvar org-cursor-color) 1900 (defvar org-goto-start-pos)
1886(defvar org-time-was-given) 1901 (defvar org-cursor-color)
1887(defvar org-ts-what) 1902 (defvar org-time-was-given)
1888(defvar mark-active) 1903 (defvar org-ts-what)
1889(defvar timecnt) 1904 (defvar mark-active)
1890(defvar levels-open) 1905 (defvar timecnt)
1891(defvar title) 1906 (defvar levels-open)
1892(defvar author) 1907 (defvar title)
1893(defvar email) 1908 (defvar author)
1894(defvar text) 1909 (defvar email)
1895(defvar entry) 1910 (defvar text)
1896(defvar date) 1911 (defvar entry)
1897(defvar language) 1912 (defvar date)
1898(defvar options) 1913 (defvar language)
1899(defvar ans1) 1914 (defvar options)
1900(defvar ans2) 1915 (defvar ans1)
1901(defvar starting-day) 1916 (defvar ans2)
1902(defvar include-all-loc) 1917 (defvar starting-day)
1903(defvar vm-message-pointer) 1918 (defvar include-all-loc)
1904(defvar vm-folder-directory) 1919 (defvar vm-message-pointer)
1905(defvar wl-summary-buffer-elmo-folder) 1920 (defvar vm-folder-directory)
1906(defvar wl-summary-buffer-folder-name) 1921 (defvar wl-summary-buffer-elmo-folder)
1907(defvar gnus-group-name) 1922 (defvar wl-summary-buffer-folder-name)
1908(defvar gnus-article-current) 1923 (defvar gnus-group-name)
1909(defvar w3m-current-url) 1924 (defvar gnus-article-current)
1910(defvar org-selected-point) 1925 (defvar w3m-current-url)
1911(defvar calendar-mode-map) 1926 (defvar org-selected-point)
1912(defvar remember-save-after-remembering) 1927 (defvar calendar-mode-map)
1913(defvar remember-data-file) 1928 (defvar remember-save-after-remembering)
1929 (defvar remember-data-file))
1914 1930
1915 1931
1916;;; Define the mode 1932;;; Define the mode
@@ -3100,7 +3116,7 @@ heading be marked DONE, and the current time will be added."
3100 (if (string-match "\\(.*\\)::\\(.*\\)" org-archive-location) 3116 (if (string-match "\\(.*\\)::\\(.*\\)" org-archive-location)
3101 (progn 3117 (progn
3102 (setq file (format (match-string 1 org-archive-location) 3118 (setq file (format (match-string 1 org-archive-location)
3103 (file-name-nondirectory buffer-file-name)) 3119 (file-name-nondirectory (buffer-file-name)))
3104 heading (match-string 2 org-archive-location))) 3120 heading (match-string 2 org-archive-location)))
3105 (error "Invalid `org-archive-location'")) 3121 (error "Invalid `org-archive-location'"))
3106 (if (> (length file) 0) 3122 (if (> (length file) 0)
@@ -4031,8 +4047,9 @@ in the timestamp determines what will be changed."
4031 (nthcdr 6 time0)))) 4047 (nthcdr 6 time0))))
4032 (if (eq what 'calendar) 4048 (if (eq what 'calendar)
4033 (let ((cal-date 4049 (let ((cal-date
4034 (save-match-data 4050 (save-excursion
4035 (with-current-buffer "*Calendar*" 4051 (save-match-data
4052 (set-buffer "*Calendar*")
4036 (calendar-cursor-to-date))))) 4053 (calendar-cursor-to-date)))))
4037 (setcar (nthcdr 4 time0) (nth 0 cal-date)) ; month 4054 (setcar (nthcdr 4 time0) (nth 0 cal-date)) ; month
4038 (setcar (nthcdr 3 time0) (nth 1 cal-date)) ; day 4055 (setcar (nthcdr 3 time0) (nth 1 cal-date)) ; day
@@ -4285,7 +4302,7 @@ first press `1' to indicate that the agenda should be temporarily (until the
4285next use of \\[org-agenda]) restricted to the current file." 4302next use of \\[org-agenda]) restricted to the current file."
4286 (interactive "P") 4303 (interactive "P")
4287 (catch 'exit 4304 (catch 'exit
4288 (let ((restrict-ok (and buffer-file-name (eq major-mode 'org-mode))) 4305 (let ((restrict-ok (and (buffer-file-name) (eq major-mode 'org-mode)))
4289 (custom org-agenda-custom-commands) 4306 (custom org-agenda-custom-commands)
4290 c entry key type string) 4307 c entry key type string)
4291 (put 'org-agenda-files 'org-restrict nil) 4308 (put 'org-agenda-files 'org-restrict nil)
@@ -4320,7 +4337,7 @@ C Configure your own agenda commands")
4320 (message "") 4337 (message "")
4321 (when (equal c ?1) 4338 (when (equal c ?1)
4322 (if restrict-ok 4339 (if restrict-ok
4323 (put 'org-agenda-files 'org-restrict (list buffer-file-name)) 4340 (put 'org-agenda-files 'org-restrict (list (buffer-file-name)))
4324 (error "Cannot restrict agenda to current buffer")) 4341 (error "Cannot restrict agenda to current buffer"))
4325 (message "Press key for agenda command%s" 4342 (message "Press key for agenda command%s"
4326 (if restrict-ok " (restricted to current file)" "")) 4343 (if restrict-ok " (restricted to current file)" ""))
@@ -4444,8 +4461,8 @@ dates."
4444 (dotodo include-all) 4461 (dotodo include-all)
4445 (doclosed org-agenda-show-log) 4462 (doclosed org-agenda-show-log)
4446 (org-agenda-keep-modes keep-modes) 4463 (org-agenda-keep-modes keep-modes)
4447 (entry buffer-file-name) 4464 (entry (buffer-file-name))
4448 (org-agenda-files (list buffer-file-name)) 4465 (org-agenda-files (list (buffer-file-name)))
4449 (date (calendar-current-date)) 4466 (date (calendar-current-date))
4450 (win (selected-window)) 4467 (win (selected-window))
4451 (pos1 (point)) 4468 (pos1 (point))
@@ -4672,9 +4689,10 @@ for a keyword. A numeric prefix directly selects the Nth keyword in
4672 (erase-buffer) 4689 (erase-buffer)
4673 (org-agenda-mode) (setq buffer-read-only nil) 4690 (org-agenda-mode) (setq buffer-read-only nil)
4674 (set (make-local-variable 'org-agenda-type) 'todo) 4691 (set (make-local-variable 'org-agenda-type) 'todo)
4692 (set (make-local-variable 'last-arg) arg)
4675 (set (make-local-variable 'org-todo-keywords) kwds) 4693 (set (make-local-variable 'org-todo-keywords) kwds)
4676 (set (make-local-variable 'org-agenda-redo-command) 4694 (set (make-local-variable 'org-agenda-redo-command)
4677 `(org-todo-list (or current-prefix-arg ',arg) t)) 4695 '(org-todo-list (or current-prefix-arg last-arg) t))
4678 (setq files (org-agenda-files) 4696 (setq files (org-agenda-files)
4679 rtnall nil) 4697 rtnall nil)
4680 (while (setq file (pop files)) 4698 (while (setq file (pop files))
@@ -4971,7 +4989,7 @@ date. Itt also removes lines that contain only whitespace."
4971 "Make the position visible." 4989 "Make the position visible."
4972 (if (and org-disable-agenda-to-diary ;; called from org-agenda 4990 (if (and org-disable-agenda-to-diary ;; called from org-agenda
4973 (stringp string) 4991 (stringp string)
4974 buffer-file-name) 4992 (buffer-file-name))
4975 (setq string (org-modify-diary-entry-string string)))))) 4993 (setq string (org-modify-diary-entry-string string))))))
4976 4994
4977(defun org-modify-diary-entry-string (string) 4995(defun org-modify-diary-entry-string (string)
@@ -4983,7 +5001,7 @@ date. Itt also removes lines that contain only whitespace."
4983 'help-echo 5001 'help-echo
4984 (format 5002 (format
4985 "mouse-2 or RET jump to diary file %s" 5003 "mouse-2 or RET jump to diary file %s"
4986 (abbreviate-file-name buffer-file-name)) 5004 (abbreviate-file-name (buffer-file-name)))
4987 'org-agenda-diary-link t 5005 'org-agenda-diary-link t
4988 'org-marker (org-agenda-new-marker (point-at-bol))) 5006 'org-marker (org-agenda-new-marker (point-at-bol)))
4989 string) 5007 string)
@@ -5005,7 +5023,7 @@ If the current buffer visits an agenda file, find the next one in the list.
5005If the current buffer does not, find the first agenda file." 5023If the current buffer does not, find the first agenda file."
5006 (interactive) 5024 (interactive)
5007 (let ((files (append org-agenda-files (list (car org-agenda-files)))) 5025 (let ((files (append org-agenda-files (list (car org-agenda-files))))
5008 (tcf (if buffer-file-name (file-truename buffer-file-name))) 5026 (tcf (if (buffer-file-name) (file-truename (buffer-file-name))))
5009 file) 5027 file)
5010 (unless files (error "No agenda files")) 5028 (unless files (error "No agenda files"))
5011 (catch 'exit 5029 (catch 'exit
@@ -5016,28 +5034,30 @@ If the current buffer does not, find the first agenda file."
5016 (throw 'exit t)))) 5034 (throw 'exit t))))
5017 (find-file (car org-agenda-files))))) 5035 (find-file (car org-agenda-files)))))
5018 5036
5019(defun org-agenda-file-to-end () 5037(defun org-agenda-file-to-end (&optional file)
5020 "Move/add the current file to the end of the agenda fiole list. 5038 "Move/add the current file to the end of the agenda fiole list.
5021If the file is not present in the list, append it to the list. If it is 5039I the file is not present in the list, it is appended ot the list. If it is
5022present, move it there." 5040present, it is moved there."
5023 (interactive) 5041 (interactive)
5024 (org-agenda-file-to-front 'to-end)) 5042 (org-agenda-file-to-front 'to-end file))
5025 5043
5026(defun org-agenda-file-to-front (&optional to-end) 5044(defun org-agenda-file-to-front (&optional to-end file)
5027 "Move/add the current file to the top of the agenda file list. 5045 "Move/add the current file to the top of the agenda file list.
5028If the file is not present in the list, add it to the front. If it is 5046If the file is not present in the list, it is added to the front. If it is
5029present, it move it there. With optional argument TO-END, add/move to the 5047present, it is moved there. With optional argument TO-END, add/move to the
5030end of the list." 5048end of the list."
5031 (interactive "P") 5049 (interactive "P")
5032 (let* ((file-alist (mapcar (lambda (x) 5050 (let ((file-alist (mapcar (lambda (x)
5033 (cons (file-truename x) x)) 5051 (cons (file-truename x) x))
5034 org-agenda-files)) 5052 org-agenda-files))
5035 (ctf (file-truename buffer-file-name)) 5053 (ctf (file-truename (buffer-file-name)))
5036 (had (assoc ctf file-alist)) 5054 x had)
5037 (x (or had (cons ctf (abbreviate-file-name buffer-file-name))))) 5055 (setq x (assoc ctf file-alist) had x)
5038 (setq file-alist (if to-end 5056
5039 (append (delq x file-alist) (list x)) 5057 (if (not x) (setq x (cons ctf (abbreviate-file-name (buffer-file-name)))))
5040 (cons x (delq x file-alist)))) 5058 (if to-end
5059 (setq file-alist (append (delq x file-alist) (list x)))
5060 (setq file-alist (cons x (delq x file-alist))))
5041 (setq org-agenda-files (mapcar 'cdr file-alist)) 5061 (setq org-agenda-files (mapcar 'cdr file-alist))
5042 (let ((org-mode-hook nil) (default-major-mode 'fundamental-mode)) 5062 (let ((org-mode-hook nil) (default-major-mode 'fundamental-mode))
5043 (customize-save-variable 'org-agenda-files org-agenda-files)) 5063 (customize-save-variable 'org-agenda-files org-agenda-files))
@@ -5050,7 +5070,7 @@ end of the list."
5050These are the files which are being checked for agenda entries. 5070These are the files which are being checked for agenda entries.
5051Optional argument FILE means, use this file instead of the current." 5071Optional argument FILE means, use this file instead of the current."
5052 (interactive) 5072 (interactive)
5053 (let* ((file (or file buffer-file-name)) 5073 (let* ((file (or file (buffer-file-name)))
5054 (true-file (file-truename file)) 5074 (true-file (file-truename file))
5055 (afile (abbreviate-file-name file)) 5075 (afile (abbreviate-file-name file))
5056 (files (delq nil (mapcar 5076 (files (delq nil (mapcar
@@ -5174,9 +5194,9 @@ function from a program - use `org-agenda-get-day-entries' instead."
5174 (cond 5194 (cond
5175 ((null org-category) 5195 ((null org-category)
5176 (setq org-category 5196 (setq org-category
5177 (if buffer-file-name 5197 (if (buffer-file-name)
5178 (file-name-sans-extension 5198 (file-name-sans-extension
5179 (file-name-nondirectory buffer-file-name)) 5199 (file-name-nondirectory (buffer-file-name)))
5180 "???"))) 5200 "???")))
5181 ((symbolp org-category) (symbol-name org-category)) 5201 ((symbolp org-category) (symbol-name org-category))
5182 (t org-category)) 5202 (t org-category))
@@ -5265,6 +5285,27 @@ the documentation of `org-diary'."
5265 (throw 'exit t))) 5285 (throw 'exit t)))
5266 nil))) 5286 nil)))
5267 5287
5288(defun org-get-tags-at (&optional pos)
5289 "Get a list of all headline targs applicable at POS.
5290POS defaults to point. If tags are inherited, the list contains
5291the targets in the same sequence as the headlines appear, i.e.
5292the tags of the current headline come last."
5293 (interactive)
5294 (let (tags)
5295 (save-excursion
5296 (goto-char (or pos (point)))
5297 (save-match-data
5298 (org-back-to-heading t)
5299 (condition-case nil
5300 (while t
5301 (if (looking-at "[^\r\n]+?:\\([a-zA-Z_:]+\\):[ \t]*\\([\n\r]\\|\\'\\)")
5302 (setq tags (append (org-split-string (match-string 1) ":") tags)))
5303 (or org-use-tag-inheritance (error ""))
5304 (org-up-heading-all 1))
5305 (error nil))))
5306 (message "%s" tags)
5307 tags))
5308
5268(defun org-agenda-get-todos () 5309(defun org-agenda-get-todos ()
5269 "Return the TODO information for agenda display." 5310 "Return the TODO information for agenda display."
5270 (let* ((props (list 'face nil 5311 (let* ((props (list 'face nil
@@ -5273,7 +5314,7 @@ the documentation of `org-diary'."
5273 'keymap org-agenda-keymap 5314 'keymap org-agenda-keymap
5274 'help-echo 5315 'help-echo
5275 (format "mouse-2 or RET jump to org file %s" 5316 (format "mouse-2 or RET jump to org file %s"
5276 (abbreviate-file-name buffer-file-name)))) 5317 (abbreviate-file-name (buffer-file-name)))))
5277 (regexp (concat "[\n\r]\\*+ *\\(" 5318 (regexp (concat "[\n\r]\\*+ *\\("
5278 (if org-select-this-todo-keyword 5319 (if org-select-this-todo-keyword
5279 (concat "\\<\\(" org-select-this-todo-keyword 5320 (concat "\\<\\(" org-select-this-todo-keyword
@@ -5315,7 +5356,7 @@ the documentation of `org-diary'."
5315 'keymap org-agenda-keymap 5356 'keymap org-agenda-keymap
5316 'help-echo 5357 'help-echo
5317 (format "mouse-2 or RET jump to org file %s" 5358 (format "mouse-2 or RET jump to org file %s"
5318 (abbreviate-file-name buffer-file-name)))) 5359 (abbreviate-file-name (buffer-file-name)))))
5319 (regexp (regexp-quote 5360 (regexp (regexp-quote
5320 (substring 5361 (substring
5321 (format-time-string 5362 (format-time-string
@@ -5392,7 +5433,7 @@ the documentation of `org-diary'."
5392 'keymap org-agenda-keymap 5433 'keymap org-agenda-keymap
5393 'help-echo 5434 'help-echo
5394 (format "mouse-2 or RET jump to org file %s" 5435 (format "mouse-2 or RET jump to org file %s"
5395 (abbreviate-file-name buffer-file-name)))) 5436 (abbreviate-file-name (buffer-file-name)))))
5396 (regexp (concat 5437 (regexp (concat
5397 "\\<" org-closed-string " *\\[" 5438 "\\<" org-closed-string " *\\["
5398 (regexp-quote 5439 (regexp-quote
@@ -5448,7 +5489,7 @@ the documentation of `org-diary'."
5448 'keymap org-agenda-keymap 5489 'keymap org-agenda-keymap
5449 'help-echo 5490 'help-echo
5450 (format "mouse-2 or RET jump to org file %s" 5491 (format "mouse-2 or RET jump to org file %s"
5451 (abbreviate-file-name buffer-file-name)))) 5492 (abbreviate-file-name (buffer-file-name)))))
5452 (regexp org-deadline-time-regexp) 5493 (regexp org-deadline-time-regexp)
5453 (todayp (equal date (calendar-current-date))) ; DATE bound by calendar 5494 (todayp (equal date (calendar-current-date))) ; DATE bound by calendar
5454 (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar 5495 (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar
@@ -5510,7 +5551,7 @@ the documentation of `org-diary'."
5510 'keymap org-agenda-keymap 5551 'keymap org-agenda-keymap
5511 'help-echo 5552 'help-echo
5512 (format "mouse-2 or RET jump to org file %s" 5553 (format "mouse-2 or RET jump to org file %s"
5513 (abbreviate-file-name buffer-file-name)))) 5554 (abbreviate-file-name (buffer-file-name)))))
5514 (regexp org-scheduled-time-regexp) 5555 (regexp org-scheduled-time-regexp)
5515 (todayp (equal date (calendar-current-date))) ; DATE bound by calendar 5556 (todayp (equal date (calendar-current-date))) ; DATE bound by calendar
5516 (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar 5557 (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar
@@ -5559,7 +5600,7 @@ the documentation of `org-diary'."
5559 'keymap org-agenda-keymap 5600 'keymap org-agenda-keymap
5560 'help-echo 5601 'help-echo
5561 (format "mouse-2 or RET jump to org file %s" 5602 (format "mouse-2 or RET jump to org file %s"
5562 (abbreviate-file-name buffer-file-name)))) 5603 (abbreviate-file-name (buffer-file-name)))))
5563 (regexp org-tr-regexp) 5604 (regexp org-tr-regexp)
5564 (d0 (calendar-absolute-from-gregorian date)) 5605 (d0 (calendar-absolute-from-gregorian date))
5565 marker hdmarker ee txt d1 d2 s1 s2 timestr category tags) 5606 marker hdmarker ee txt d1 d2 s1 s2 timestr category tags)
@@ -5631,9 +5672,10 @@ After a match, the following groups carry important information:
5631(defvar org-prefix-has-time nil 5672(defvar org-prefix-has-time nil
5632 "A flag, set by `org-compile-prefix-format'. 5673 "A flag, set by `org-compile-prefix-format'.
5633The flag is set if the currently compiled format contains a `%t'.") 5674The flag is set if the currently compiled format contains a `%t'.")
5675(defvar org-prefix-has-tag nil
5676 "A flag, set by `org-compile-prefix-format'.
5677The flag is set if the currently compiled format contains a `%T'.")
5634 5678
5635(defvar time) ;Needed for the eval of the prefix format.
5636(defvar tag) ;Presumably, same thing as above.
5637(defun org-format-agenda-item (extra txt &optional category tags dotime noprefix) 5679(defun org-format-agenda-item (extra txt &optional category tags dotime noprefix)
5638 "Format TXT to be inserted into the agenda buffer. 5680 "Format TXT to be inserted into the agenda buffer.
5639In particular, it adds the prefix and corresponding text properties. EXTRA 5681In particular, it adds the prefix and corresponding text properties. EXTRA
@@ -5651,9 +5693,9 @@ only the correctly processes TXT should be returned - this is used by
5651 (if (string-match "^ +" txt) (setq txt (replace-match "" nil nil txt))) 5693 (if (string-match "^ +" txt) (setq txt (replace-match "" nil nil txt)))
5652 (let* ((category (or category 5694 (let* ((category (or category
5653 org-category 5695 org-category
5654 (if buffer-file-name 5696 (if (buffer-file-name)
5655 (file-name-sans-extension 5697 (file-name-sans-extension
5656 (file-name-nondirectory buffer-file-name)) 5698 (file-name-nondirectory (buffer-file-name)))
5657 ""))) 5699 "")))
5658 (tag (or (nth (1- (length tags)) tags) "")) 5700 (tag (or (nth (1- (length tags)) tags) ""))
5659 time ;; needed for the eval of the prefix format 5701 time ;; needed for the eval of the prefix format
@@ -5681,6 +5723,12 @@ only the correctly processes TXT should be returned - this is used by
5681 (if s1 (setq s1 (org-get-time-of-day s1 'string))) 5723 (if s1 (setq s1 (org-get-time-of-day s1 'string)))
5682 (if s2 (setq s2 (org-get-time-of-day s2 'string)))) 5724 (if s2 (setq s2 (org-get-time-of-day s2 'string))))
5683 5725
5726 (when (and (or (eq org-agenda-remove-tags-when-in-prefix t)
5727 (and org-agenda-remove-tags-when-in-prefix
5728 org-prefix-has-tag))
5729 (string-match ":[a-zA-Z_:]+:[ \t]*$" txt))
5730 (setq txt (replace-match "" t t txt)))
5731
5684 ;; Create the final string 5732 ;; Create the final string
5685 (if noprefix 5733 (if noprefix
5686 (setq rtn txt) 5734 (setq rtn txt)
@@ -5738,7 +5786,7 @@ only the correctly processes TXT should be returned - this is used by
5738 "Compile the prefix format into a Lisp form that can be evaluated. 5786 "Compile the prefix format into a Lisp form that can be evaluated.
5739The resulting form is returned and stored in the variable 5787The resulting form is returned and stored in the variable
5740`org-prefix-format-compiled'." 5788`org-prefix-format-compiled'."
5741 (setq org-prefix-has-time nil) 5789 (setq org-prefix-has-time nil org-prefix-has-tag nil)
5742 (let ((start 0) varform vars var (s format)e c f opt) 5790 (let ((start 0) varform vars var (s format)e c f opt)
5743 (while (string-match "%\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([cts]\\)" 5791 (while (string-match "%\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([cts]\\)"
5744 s start) 5792 s start)
@@ -5749,6 +5797,7 @@ The resulting form is returned and stored in the variable
5749 opt (match-beginning 1) 5797 opt (match-beginning 1)
5750 start (1+ (match-beginning 0))) 5798 start (1+ (match-beginning 0)))
5751 (if (equal var 'time) (setq org-prefix-has-time t)) 5799 (if (equal var 'time) (setq org-prefix-has-time t))
5800 (if (equal var 'tag) (setq org-prefix-has-tag t))
5752 (setq f (concat "%" (match-string 2 s) "s")) 5801 (setq f (concat "%" (match-string 2 s) "s"))
5753 (if opt 5802 (if opt
5754 (setq varform 5803 (setq varform
@@ -5783,7 +5832,7 @@ HH:MM."
5783 (string-to-number (match-string 3 s)) 5832 (string-to-number (match-string 3 s))
5784 0))) 5833 0)))
5785 (t1 (concat " " 5834 (t1 (concat " "
5786 (if (< t0 100) "0" "") (if (< t0 10) "0" "") 5835 (if (< t0 100) "0" "") (if (< t0 10) "0" "")
5787 (int-to-string t0)))) 5836 (int-to-string t0))))
5788 (if string (concat (substring t1 -4 -2) ":" (substring t1 -2)) t0))))) 5837 (if string (concat (substring t1 -4 -2) ":" (substring t1 -2)) t0)))))
5789 5838
@@ -5816,9 +5865,6 @@ HH:MM."
5816 ((< tb ta) +1) 5865 ((< tb ta) +1)
5817 (t nil)))) 5866 (t nil))))
5818 5867
5819(defvar time-up) (defvar time-down)
5820(defvar priority-up) (defvar priority-down)
5821(defvar category-up) (defvar category-down) (defvar category-keep)
5822(defun org-entries-lessp (a b) 5868(defun org-entries-lessp (a b)
5823 "Predicate for sorting agenda entries." 5869 "Predicate for sorting agenda entries."
5824 ;; The following variables will be used when the form is evaluated. 5870 ;; The following variables will be used when the form is evaluated.
@@ -6260,7 +6306,7 @@ d are included in the output."
6260 'keymap org-agenda-keymap 6306 'keymap org-agenda-keymap
6261 'help-echo 6307 'help-echo
6262 (format "mouse-2 or RET jump to org file %s" 6308 (format "mouse-2 or RET jump to org file %s"
6263 (abbreviate-file-name buffer-file-name)))) 6309 (abbreviate-file-name (buffer-file-name)))))
6264 lspos 6310 lspos
6265 tags tags-list tags-alist (llast 0) rtn level category i txt 6311 tags tags-list tags-alist (llast 0) rtn level category i txt
6266 todo marker) 6312 todo marker)
@@ -6551,7 +6597,10 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
6551 (skip-chars-backward 6597 (skip-chars-backward
6552 (concat (if org-allow-space-in-links "^" "^ ") 6598 (concat (if org-allow-space-in-links "^" "^ ")
6553 org-non-link-chars)) 6599 org-non-link-chars))
6554 (when (looking-at org-link-regexp) 6600 (when (or (looking-at org-link-regexp)
6601 (and (re-search-forward org-link-regexp (point-at-eol) t)
6602 (<= (match-beginning 0) pos)
6603 (>= (match-end 0) pos)))
6555 (setq type (match-string 1) 6604 (setq type (match-string 1)
6556 path (match-string 2)) 6605 path (match-string 2))
6557 (throw 'match t))) 6606 (throw 'match t)))
@@ -6589,7 +6638,7 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
6589 (cond 6638 (cond
6590 6639
6591 ((string= type "tags") 6640 ((string= type "tags")
6592 (org-tags-view path in-emacs)) 6641 (org-tags-view in-emacs path))
6593 ((string= type "camel") 6642 ((string= type "camel")
6594 (org-link-search 6643 (org-link-search
6595 path 6644 path
@@ -6862,7 +6911,7 @@ openen in emacs.
6862If the file does not exist, an error is thrown." 6911If the file does not exist, an error is thrown."
6863 (setq in-emacs (or in-emacs line search)) 6912 (setq in-emacs (or in-emacs line search))
6864 (let* ((file (if (equal path "") 6913 (let* ((file (if (equal path "")
6865 buffer-file-name 6914 (buffer-file-name)
6866 (convert-standard-filename (org-expand-file-name path)))) 6915 (convert-standard-filename (org-expand-file-name path))))
6867 (dfile (downcase file)) 6916 (dfile (downcase file))
6868 ext cmd apps) 6917 ext cmd apps)
@@ -6893,7 +6942,7 @@ If the file does not exist, an error is thrown."
6893 (shell-command (concat cmd " &")))) 6942 (shell-command (concat cmd " &"))))
6894 ((or (stringp cmd) 6943 ((or (stringp cmd)
6895 (eq cmd 'emacs)) 6944 (eq cmd 'emacs))
6896 (unless (equal (file-truename file) (file-truename buffer-file-name)) 6945 (unless (equal (file-truename file) (file-truename (buffer-file-name)))
6897 (funcall (cdr (assq 'file org-link-frame-setup)) file)) 6946 (funcall (cdr (assq 'file org-link-frame-setup)) file))
6898 (if line (goto-line line) 6947 (if line (goto-line line)
6899 (if search (org-link-search search)))) 6948 (if search (org-link-search search))))
@@ -6956,7 +7005,7 @@ For file links, arg negates `org-context-in-file-links'."
6956 (save-excursion 7005 (save-excursion
6957 (vm-select-folder-buffer) 7006 (vm-select-folder-buffer)
6958 (let* ((message (car vm-message-pointer)) 7007 (let* ((message (car vm-message-pointer))
6959 (folder buffer-file-name) 7008 (folder (buffer-file-name))
6960 (subject (vm-su-subject message)) 7009 (subject (vm-su-subject message))
6961 (author (vm-su-full-name message)) 7010 (author (vm-su-full-name message))
6962 (message-id (vm-su-message-id message))) 7011 (message-id (vm-su-message-id message)))
@@ -6987,7 +7036,7 @@ For file links, arg negates `org-context-in-file-links'."
6987 (save-excursion 7036 (save-excursion
6988 (save-restriction 7037 (save-restriction
6989 (rmail-narrow-to-non-pruned-header) 7038 (rmail-narrow-to-non-pruned-header)
6990 (let ((folder buffer-file-name) 7039 (let ((folder (buffer-file-name))
6991 (message-id (mail-fetch-field "message-id")) 7040 (message-id (mail-fetch-field "message-id"))
6992 (author (mail-fetch-field "from")) 7041 (author (mail-fetch-field "from"))
6993 (subject (mail-fetch-field "subject"))) 7042 (subject (mail-fetch-field "subject")))
@@ -7041,7 +7090,7 @@ For file links, arg negates `org-context-in-file-links'."
7041 ((eq major-mode 'org-mode) 7090 ((eq major-mode 'org-mode)
7042 ;; Just link to current headline 7091 ;; Just link to current headline
7043 (setq cpltxt (concat "file:" 7092 (setq cpltxt (concat "file:"
7044 (abbreviate-file-name buffer-file-name))) 7093 (abbreviate-file-name (buffer-file-name))))
7045 ;; Add a context search string 7094 ;; Add a context search string
7046 (when (org-xor org-context-in-file-links arg) 7095 (when (org-xor org-context-in-file-links arg)
7047 (if (save-excursion 7096 (if (save-excursion
@@ -7059,10 +7108,10 @@ For file links, arg negates `org-context-in-file-links'."
7059 ))))) 7108 )))))
7060 (setq link (org-make-link cpltxt))) 7109 (setq link (org-make-link cpltxt)))
7061 7110
7062 (buffer-file-name 7111 ((buffer-file-name)
7063 ;; Just link to this file here. 7112 ;; Just link to this file here.
7064 (setq cpltxt (concat "file:" 7113 (setq cpltxt (concat "file:"
7065 (abbreviate-file-name buffer-file-name))) 7114 (abbreviate-file-name (buffer-file-name))))
7066 ;; Add a context string 7115 ;; Add a context string
7067 (when (org-xor org-context-in-file-links arg) 7116 (when (org-xor org-context-in-file-links arg)
7068 (setq cpltxt 7117 (setq cpltxt
@@ -7197,7 +7246,7 @@ is in the current directory or below."
7197 (case-fold-search nil) 7246 (case-fold-search nil)
7198 (search (match-string 2 link))) 7247 (search (match-string 2 link)))
7199 (when (save-match-data 7248 (when (save-match-data
7200 (equal (file-truename buffer-file-name) 7249 (equal (file-truename (buffer-file-name))
7201 (file-truename path))) 7250 (file-truename path)))
7202 (if (save-match-data 7251 (if (save-match-data
7203 (string-match (concat "^" org-camel-regexp "$") search)) 7252 (string-match (concat "^" org-camel-regexp "$") search))
@@ -7356,7 +7405,7 @@ See also the variable `org-reverse-note-order'."
7356 (let ((all org-reverse-note-order) 7405 (let ((all org-reverse-note-order)
7357 entry) 7406 entry)
7358 (while (setq entry (pop all)) 7407 (while (setq entry (pop all))
7359 (if (string-match (car entry) buffer-file-name) 7408 (if (string-match (car entry) (buffer-file-name))
7360 (throw 'exit (cdr entry)))) 7409 (throw 'exit (cdr entry))))
7361 nil))))) 7410 nil)))))
7362 7411
@@ -10010,7 +10059,7 @@ underlined headlines. The default is 3."
10010 (level 0) line txt 10059 (level 0) line txt
10011 (umax nil) 10060 (umax nil)
10012 (case-fold-search nil) 10061 (case-fold-search nil)
10013 (filename (concat (file-name-sans-extension buffer-file-name) 10062 (filename (concat (file-name-sans-extension (buffer-file-name))
10014 ".txt")) 10063 ".txt"))
10015 (buffer (find-file-noselect filename)) 10064 (buffer (find-file-noselect filename))
10016 (levels-open (make-vector org-level-max nil)) 10065 (levels-open (make-vector org-level-max nil))
@@ -10159,7 +10208,7 @@ underlined headlines. The default is 3."
10159Also removes the first line of the buffer if it specifies a mode, 10208Also removes the first line of the buffer if it specifies a mode,
10160and all options lines." 10209and all options lines."
10161 (interactive) 10210 (interactive)
10162 (let* ((filename (concat (file-name-sans-extension buffer-file-name) 10211 (let* ((filename (concat (file-name-sans-extension (buffer-file-name))
10163 ".txt")) 10212 ".txt"))
10164 (buffer (find-file-noselect filename)) 10213 (buffer (find-file-noselect filename))
10165 (ore (concat 10214 (ore (concat
@@ -10233,7 +10282,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
10233 org-export-with-sub-superscripts 10282 org-export-with-sub-superscripts
10234 org-export-with-emphasize 10283 org-export-with-emphasize
10235 org-export-with-TeX-macros 10284 org-export-with-TeX-macros
10236 (file-name-nondirectory buffer-file-name) 10285 (file-name-nondirectory (buffer-file-name))
10237 (if (equal org-todo-interpretation 'sequence) 10286 (if (equal org-todo-interpretation 'sequence)
10238 (mapconcat 'identity org-todo-keywords " ") 10287 (mapconcat 'identity org-todo-keywords " ")
10239 "TODO FEEDBACK VERIFY DONE") 10288 "TODO FEEDBACK VERIFY DONE")
@@ -10306,7 +10355,7 @@ The prefix ARG specifies how many levels of the outline should become
10306headlines. The default is 3. Lower levels will become bulleted lists." 10355headlines. The default is 3. Lower levels will become bulleted lists."
10307 (interactive "P") 10356 (interactive "P")
10308 (org-export-as-html arg 'hidden) 10357 (org-export-as-html arg 'hidden)
10309 (org-open-file buffer-file-name)) 10358 (org-open-file (buffer-file-name)))
10310 10359
10311(defun org-export-as-html-batch () 10360(defun org-export-as-html-batch ()
10312 "Call `org-export-as-html', may be used in batch processing as 10361 "Call `org-export-as-html', may be used in batch processing as
@@ -10336,7 +10385,7 @@ headlines. The default is 3. Lower levels will become bulleted lists."
10336 (lines (org-export-find-first-heading-line all_lines)) 10385 (lines (org-export-find-first-heading-line all_lines))
10337 (level 0) (line "") (origline "") txt todo 10386 (level 0) (line "") (origline "") txt todo
10338 (umax nil) 10387 (umax nil)
10339 (filename (concat (file-name-sans-extension buffer-file-name) 10388 (filename (concat (file-name-sans-extension (buffer-file-name))
10340 ".html")) 10389 ".html"))
10341 (buffer (find-file-noselect filename)) 10390 (buffer (find-file-noselect filename))
10342 (levels-open (make-vector org-level-max nil)) 10391 (levels-open (make-vector org-level-max nil))
@@ -10999,7 +11048,7 @@ When LEVEL is non-nil, increase section numbers on that level."
10999The iCalendar file will be located in the same directory as the Org-mode 11048The iCalendar file will be located in the same directory as the Org-mode
11000file, but with extension `.ics'." 11049file, but with extension `.ics'."
11001 (interactive) 11050 (interactive)
11002 (org-export-icalendar nil buffer-file-name)) 11051 (org-export-icalendar nil (buffer-file-name)))
11003 11052
11004;;;###autoload 11053;;;###autoload
11005(defun org-export-icalendar-all-agenda-files () 11054(defun org-export-icalendar-all-agenda-files ()
@@ -11036,7 +11085,7 @@ file and store it under the name `org-combined-agenda-icalendar-file'."
11036 (set-buffer (org-get-agenda-file-buffer file)) 11085 (set-buffer (org-get-agenda-file-buffer file))
11037 (setq category (or org-category 11086 (setq category (or org-category
11038 (file-name-sans-extension 11087 (file-name-sans-extension
11039 (file-name-nondirectory buffer-file-name)))) 11088 (file-name-nondirectory (buffer-file-name)))))
11040 (if (symbolp category) (setq category (symbol-name category))) 11089 (if (symbolp category) (setq category (symbol-name category)))
11041 (let ((standard-output ical-buffer)) 11090 (let ((standard-output ical-buffer))
11042 (if combine 11091 (if combine
@@ -12137,27 +12186,6 @@ Show the heading too, if it is currently invisible."
12137 (org-invisible-p))) 12186 (org-invisible-p)))
12138 (org-show-hierarchy-above))) 12187 (org-show-hierarchy-above)))
12139 12188
12140(defun org-get-tags-at (&optional pos)
12141 "Get a list of all headline targs applicable at POS.
12142POS defaults to point. If tags are inherited, the list contains
12143the targets in the same sequence as the headlines appear, i.e.
12144the tags of the current headline come last."
12145 (interactive)
12146 (let (tags)
12147 (save-excursion
12148 (goto-char (or pos (point)))
12149 (save-match-data
12150 (org-back-to-heading t)
12151 (condition-case nil
12152 (while t
12153 (if (looking-at "[^\r\n]+?:\\([a-zA-Z_:]+\\):[ \t]*\\([\n\r]\\|\\'\\)")
12154 (setq tags (append (org-split-string (match-string 1) ":") tags)))
12155 (or org-use-tag-inheritance (error ""))
12156 (org-up-heading-all 1))
12157 (error nil))))
12158 (message "%s" tags)
12159 tags))
12160
12161;;; Finish up 12189;;; Finish up
12162 12190
12163(provide 'org) 12191(provide 'org)
@@ -12166,4 +12194,5 @@ the tags of the current headline come last."
12166 12194
12167;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd 12195;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
12168;;; org.el ends here 12196;;; org.el ends here
12197
12169 12198