Mercurial > emacs
comparison lisp/textmodes/org.el @ 68294:f915fc860323
(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.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Fri, 20 Jan 2006 13:53:32 +0000 |
parents | 1a47b5a03b4a |
children | 61b78b1445bf 5b7d410e31f9 |
comparison
equal
deleted
inserted
replaced
68293:5d930699173f | 68294:f915fc860323 |
---|---|
3 ;; Copyright (c) 2004, 2005, 2006 Free Software Foundation | 3 ;; Copyright (c) 2004, 2005, 2006 Free Software Foundation |
4 ;; | 4 ;; |
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 ;; |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
79 ;; excellent reference card made by Philip Rooke. This card can be found | 79 ;; excellent reference card made by Philip Rooke. This card can be found |
80 ;; in the etc/ directory of Emacs 22. | 80 ;; in the etc/ directory of Emacs 22. |
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. |
87 ;; - The current TAG can be incorporated into the agenda prefix. | 91 ;; - The current TAG can be incorporated into the agenda prefix. |
88 ;; See option `org-agenda-prefix-format' for details. | 92 ;; See option `org-agenda-prefix-format' for details. |
109 (defvar calc-embedded-open-formula) | 113 (defvar calc-embedded-open-formula) |
110 (defvar font-lock-unfontify-region-function) | 114 (defvar font-lock-unfontify-region-function) |
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) |
118 (message "Org-mode version %s" org-version)) | 122 (message "Org-mode version %s" org-version)) |
119 | 123 |
606 As another example, if you don't want the time-of-day of entries in | 610 As another example, if you don't want the time-of-day of entries in |
607 the prefix, you could use: | 611 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 |
611 See also the variable `org-agenda-remove-times-when-in-prefix'." | 615 See 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 |
615 (defcustom org-timeline-prefix-format " % s" | 620 (defcustom org-timeline-prefix-format " % s" |
616 "Like `org-agenda-prefix-format', but for the timeline of a single file." | 621 "Like `org-agenda-prefix-format', but for the timeline of a single file." |
688 do have a time. When nil, the default time is before 0:00. You can use this | 693 do have a time. When nil, the default time is before 0:00. You can use this |
689 option to decide if the schedule for today should come before or after timeless | 694 option to decide if the schedule for today should come before or after timeless |
690 agenda entries." | 695 agenda entries." |
691 :group 'org-agenda | 696 :group 'org-agenda |
692 :type 'boolean) | 697 :type 'boolean) |
698 | |
699 (defcustom org-agenda-remove-tags-when-in-prefix nil | |
700 "Non-nil means, the tags from copy of headline in agenda. | |
701 When 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))) | |
693 | 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" |
697 :group 'org) | 712 :group 'org) |
1873 (concat "\\<" org-scheduled-string " *<\\([^>]+\\)>")) | 1888 (concat "\\<" org-scheduled-string " *<\\([^>]+\\)>")) |
1874 (org-set-font-lock-defaults))) | 1889 (org-set-font-lock-defaults))) |
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 |
1917 | 1933 |
1918 (defvar org-mode-map (copy-keymap outline-mode-map) | 1934 (defvar org-mode-map (copy-keymap outline-mode-map) |
3098 (this-buffer (current-buffer)) | 3114 (this-buffer (current-buffer)) |
3099 file heading buffer level newfile-p) | 3115 file heading buffer level newfile-p) |
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) |
3107 (setq newfile-p (not (file-exists-p file)) | 3123 (setq newfile-p (not (file-exists-p file)) |
3108 buffer (find-file-noselect file)) | 3124 buffer (find-file-noselect file)) |
4029 (list (+ (if (eq org-ts-what 'month) n 0) (nth 4 time0))) | 4045 (list (+ (if (eq org-ts-what 'month) n 0) (nth 4 time0))) |
4030 (list (+ (if (eq org-ts-what 'year) n 0) (nth 5 time0))) | 4046 (list (+ (if (eq org-ts-what 'year) n 0) (nth 5 time0))) |
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 |
4039 (setcar (nthcdr 5 time0) (nth 2 cal-date)) ; year | 4056 (setcar (nthcdr 5 time0) (nth 2 cal-date)) ; year |
4040 (setcar time0 (or (car time0) 0)) | 4057 (setcar time0 (or (car time0) 0)) |
4283 If the current buffer is in Org-mode and visiting a file, you can also | 4300 If the current buffer is in Org-mode and visiting a file, you can also |
4284 first press `1' to indicate that the agenda should be temporarily (until the | 4301 first press `1' to indicate that the agenda should be temporarily (until the |
4285 next use of \\[org-agenda]) restricted to the current file." | 4302 next 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) |
4292 (save-window-excursion | 4309 (save-window-excursion |
4293 (delete-other-windows) | 4310 (delete-other-windows) |
4318 (if restrict-ok ", or [1] to restrict to current file" "")) | 4335 (if restrict-ok ", or [1] to restrict to current file" "")) |
4319 (setq c (read-char-exclusive)) | 4336 (setq c (read-char-exclusive)) |
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)" "")) |
4327 (setq c (read-char-exclusive)) | 4344 (setq c (read-char-exclusive)) |
4328 (message ""))) | 4345 (message ""))) |
4442 (org-compile-prefix-format org-timeline-prefix-format) | 4459 (org-compile-prefix-format org-timeline-prefix-format) |
4443 (let* ((dopast t) | 4460 (let* ((dopast t) |
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)) |
4452 (beg (if (org-region-active-p) (region-beginning) (point-min))) | 4469 (beg (if (org-region-active-p) (region-beginning) (point-min))) |
4453 (end (if (org-region-active-p) (region-end) (point-max))) | 4470 (end (if (org-region-active-p) (region-end) (point-max))) |
4670 (get-buffer-create org-agenda-buffer-name)))) | 4687 (get-buffer-create org-agenda-buffer-name)))) |
4671 (setq buffer-read-only nil) | 4688 (setq buffer-read-only nil) |
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)) |
4681 (catch 'nextfile | 4699 (catch 'nextfile |
4682 (org-check-agenda-file file) | 4700 (org-check-agenda-file file) |
4969 ;; Hook not avaiable, must use advice to make this work | 4987 ;; Hook not avaiable, must use advice to make this work |
4970 (defadvice add-to-diary-list (before org-mark-diary-entry activate) | 4988 (defadvice add-to-diary-list (before org-mark-diary-entry activate) |
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) |
4978 "Add text properties to string, allowing org-mode to act on it." | 4996 "Add text properties to string, allowing org-mode to act on it." |
4979 (add-text-properties | 4997 (add-text-properties |
4981 (list 'mouse-face 'highlight | 4999 (list 'mouse-face 'highlight |
4982 'keymap org-agenda-keymap | 5000 'keymap org-agenda-keymap |
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) |
4990 string) | 5008 string) |
4991 | 5009 |
5003 "Cycle through the files in `org-agenda-files'. | 5021 "Cycle through the files in `org-agenda-files'. |
5004 If the current buffer visits an agenda file, find the next one in the list. | 5022 If the current buffer visits an agenda file, find the next one in the list. |
5005 If the current buffer does not, find the first agenda file." | 5023 If 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 |
5012 (while (setq file (pop files)) | 5030 (while (setq file (pop files)) |
5013 (if (equal (file-truename file) tcf) | 5031 (if (equal (file-truename file) tcf) |
5014 (when (car files) | 5032 (when (car files) |
5015 (find-file (car files)) | 5033 (find-file (car files)) |
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. |
5021 If the file is not present in the list, append it to the list. If it is | 5039 I the file is not present in the list, it is appended ot the list. If it is |
5022 present, move it there." | 5040 present, 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. |
5028 If the file is not present in the list, add it to the front. If it is | 5046 If the file is not present in the list, it is added to the front. If it is |
5029 present, it move it there. With optional argument TO-END, add/move to the | 5047 present, it is moved there. With optional argument TO-END, add/move to the |
5030 end of the list." | 5048 end 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)) |
5044 (org-install-agenda-files-menu) | 5064 (org-install-agenda-files-menu) |
5045 (message "File %s to %s of agenda file list" | 5065 (message "File %s to %s of agenda file list" |
5048 (defun org-remove-file (&optional file) | 5068 (defun org-remove-file (&optional file) |
5049 "Remove current file from the list of files in variable `org-agenda-files'. | 5069 "Remove current file from the list of files in variable `org-agenda-files'. |
5050 These are the files which are being checked for agenda entries. | 5070 These are the files which are being checked for agenda entries. |
5051 Optional argument FILE means, use this file instead of the current." | 5071 Optional 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 |
5057 (lambda (x) | 5077 (lambda (x) |
5058 (if (equal true-file | 5078 (if (equal true-file |
5172 "Get the category applying to position POS." | 5192 "Get the category applying to position POS." |
5173 (if (not org-category-table) | 5193 (if (not org-category-table) |
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)) |
5183 (let ((tbl org-category-table) | 5203 (let ((tbl org-category-table) |
5184 (pos (or pos (point)))) | 5204 (pos (or pos (point)))) |
5263 (and (looking-at org-tr-regexp) | 5283 (and (looking-at org-tr-regexp) |
5264 (>= (match-end 0) pos) | 5284 (>= (match-end 0) pos) |
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. | |
5290 POS defaults to point. If tags are inherited, the list contains | |
5291 the targets in the same sequence as the headlines appear, i.e. | |
5292 the 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 |
5271 'done-face 'org-done | 5312 'done-face 'org-done |
5272 'mouse-face 'highlight | 5313 'mouse-face 'highlight |
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 |
5280 "\\)\\>") | 5321 "\\)\\>") |
5281 org-not-done-regexp) | 5322 org-not-done-regexp) |
5313 (let* ((props (list 'face nil | 5354 (let* ((props (list 'face nil |
5314 'mouse-face 'highlight | 5355 'mouse-face 'highlight |
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 |
5322 (car org-time-stamp-formats) | 5363 (car org-time-stamp-formats) |
5323 (apply 'encode-time ; DATE bound by calendar | 5364 (apply 'encode-time ; DATE bound by calendar |
5390 "Return the loggedd TODO entries for agenda display." | 5431 "Return the loggedd TODO entries for agenda display." |
5391 (let* ((props (list 'mouse-face 'highlight | 5432 (let* ((props (list 'mouse-face 'highlight |
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 |
5399 (substring | 5440 (substring |
5400 (format-time-string | 5441 (format-time-string |
5446 (let* ((wdays org-deadline-warning-days) | 5487 (let* ((wdays org-deadline-warning-days) |
5447 (props (list 'mouse-face 'highlight | 5488 (props (list 'mouse-face 'highlight |
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 |
5455 d2 diff pos pos1 category tags | 5496 d2 diff pos pos1 category tags |
5456 ee txt head) | 5497 ee txt head) |
5508 'done-face 'org-done | 5549 'done-face 'org-done |
5509 'mouse-face 'highlight | 5550 'mouse-face 'highlight |
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 |
5517 d2 diff pos pos1 category tags | 5558 d2 diff pos pos1 category tags |
5518 ee txt head) | 5559 ee txt head) |
5557 (let* ((props (list 'face nil | 5598 (let* ((props (list 'face nil |
5558 'mouse-face 'highlight | 5599 'mouse-face 'highlight |
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) |
5566 (goto-char (point-min)) | 5607 (goto-char (point-min)) |
5567 (while (re-search-forward regexp nil t) | 5608 (while (re-search-forward regexp nil t) |
5629 4 the second time, if it is a range.") | 5670 4 the second time, if it is a range.") |
5630 | 5671 |
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'. |
5633 The flag is set if the currently compiled format contains a `%t'.") | 5674 The flag is set if the currently compiled format contains a `%t'.") |
5634 | 5675 (defvar org-prefix-has-tag nil |
5635 (defvar time) ;Needed for the eval of the prefix format. | 5676 "A flag, set by `org-compile-prefix-format'. |
5636 (defvar tag) ;Presumably, same thing as above. | 5677 The flag is set if the currently compiled format contains a `%T'.") |
5678 | |
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. |
5639 In particular, it adds the prefix and corresponding text properties. EXTRA | 5681 In particular, it adds the prefix and corresponding text properties. EXTRA |
5640 must be a string and replaces the `%s' specifier in the prefix format. | 5682 must be a string and replaces the `%s' specifier in the prefix format. |
5641 CATEGORY (string, symbol or nil) may be used to overule the default | 5683 CATEGORY (string, symbol or nil) may be used to overule the default |
5649 (save-match-data | 5691 (save-match-data |
5650 ;; Diary entries sometimes have extra whitespace at the beginning | 5692 ;; Diary entries sometimes have extra whitespace at the beginning |
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 |
5660 (ts (if dotime (concat (if (stringp dotime) dotime "") txt))) | 5702 (ts (if dotime (concat (if (stringp dotime) dotime "") txt))) |
5661 (time-of-day (and dotime (org-get-time-of-day ts))) | 5703 (time-of-day (and dotime (org-get-time-of-day ts))) |
5678 t)) | 5720 t)) |
5679 (setq txt (replace-match "" nil nil txt)))) | 5721 (setq txt (replace-match "" nil nil txt)))) |
5680 ;; Normalize the time(s) to 24 hour | 5722 ;; Normalize the time(s) to 24 hour |
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)))) |
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))) | |
5683 | 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) |
5687 ;; Prepare the variables needed in the eval of the compiled format | 5735 ;; Prepare the variables needed in the eval of the compiled format |
5736 | 5784 |
5737 (defun org-compile-prefix-format (format) | 5785 (defun org-compile-prefix-format (format) |
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. |
5739 The resulting form is returned and stored in the variable | 5787 The 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) |
5745 (setq var (cdr (assoc (match-string 4 s) | 5793 (setq var (cdr (assoc (match-string 4 s) |
5746 '(("c" . category) ("t" . time) ("s" . extra) | 5794 '(("c" . category) ("t" . time) ("s" . extra) |
5747 ("T" . tag)))) | 5795 ("T" . tag)))) |
5748 c (or (match-string 3 s) "") | 5796 c (or (match-string 3 s) "") |
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 |
5755 `(if (equal "" ,var) | 5804 `(if (equal "" ,var) |
5756 "" | 5805 "" |
5781 12 0))) | 5830 12 0))) |
5782 (if (match-beginning 3) | 5831 (if (match-beginning 3) |
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 |
5790 (defun org-finalize-agenda-entries (list) | 5839 (defun org-finalize-agenda-entries (list) |
5791 "Sort and concatenate the agenda items." | 5840 "Sort and concatenate the agenda items." |
5814 (tb (or (get-text-property 1 'time-of-day b) def))) | 5863 (tb (or (get-text-property 1 'time-of-day b) def))) |
5815 (cond ((< ta tb) -1) | 5864 (cond ((< ta tb) -1) |
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. |
5825 (let* ((time-up (org-cmp-time a b)) | 5871 (let* ((time-up (org-cmp-time a b)) |
5826 (time-down (if time-up (- time-up) nil)) | 5872 (time-down (if time-up (- time-up) nil)) |
6258 'undone-face nil | 6304 'undone-face nil |
6259 'mouse-face 'highlight | 6305 'mouse-face 'highlight |
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) |
6267 | 6313 |
6268 (save-excursion | 6314 (save-excursion |
6549 (catch 'match | 6595 (catch 'match |
6550 (save-excursion | 6596 (save-excursion |
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))) |
6558 (save-excursion | 6607 (save-excursion |
6559 (skip-chars-backward "^ \t\n\r") | 6608 (skip-chars-backward "^ \t\n\r") |
6587 (setq path (replace-match "" t t path))) | 6636 (setq path (replace-match "" t t path))) |
6588 | 6637 |
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 |
6596 (cond ((equal in-emacs '(4)) 'occur) | 6645 (cond ((equal in-emacs '(4)) 'occur) |
6597 ((equal in-emacs '(16)) 'org-occur) | 6646 ((equal in-emacs '(16)) 'org-occur) |
6860 search for. If LINE or SEARCH is given, the file will always be | 6909 search for. If LINE or SEARCH is given, the file will always be |
6861 openen in emacs. | 6910 openen in emacs. |
6862 If the file does not exist, an error is thrown." | 6911 If 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) |
6869 (if (and (not (file-exists-p file)) | 6918 (if (and (not (file-exists-p file)) |
6870 (not org-open-non-existing-files)) | 6919 (not org-open-non-existing-files)) |
6891 (setq cmd (format cmd (concat "\"" file "\""))) | 6940 (setq cmd (format cmd (concat "\"" file "\""))) |
6892 (save-window-excursion | 6941 (save-window-excursion |
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)))) |
6900 ((consp cmd) | 6949 ((consp cmd) |
6901 (eval cmd)) | 6950 (eval cmd)) |
6954 (and (eq major-mode 'vm-presentation-mode) (vm-summarize)) | 7003 (and (eq major-mode 'vm-presentation-mode) (vm-summarize)) |
6955 (vm-follow-summary-cursor) | 7004 (vm-follow-summary-cursor) |
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))) |
6963 (setq folder (abbreviate-file-name folder)) | 7012 (setq folder (abbreviate-file-name folder)) |
6964 (if (string-match (concat "^" (regexp-quote vm-folder-directory)) | 7013 (if (string-match (concat "^" (regexp-quote vm-folder-directory)) |
6985 | 7034 |
6986 ((eq major-mode 'rmail-mode) | 7035 ((eq major-mode 'rmail-mode) |
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"))) |
6994 (setq cpltxt (concat author " on: " subject)) | 7043 (setq cpltxt (concat author " on: " subject)) |
6995 (setq link (concat cpltxt "\n " | 7044 (setq link (concat cpltxt "\n " |
7039 link (org-make-link cpltxt))) | 7088 link (org-make-link cpltxt))) |
7040 | 7089 |
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 |
7048 (skip-chars-backward "a-zA-Z<") | 7097 (skip-chars-backward "a-zA-Z<") |
7049 (looking-at (concat "<<\\(" org-camel-regexp "\\)>>"))) | 7098 (looking-at (concat "<<\\(" org-camel-regexp "\\)>>"))) |
7057 (buffer-substring (region-beginning) (region-end))) | 7106 (buffer-substring (region-beginning) (region-end))) |
7058 (t (buffer-substring (point-at-bol) (point-at-eol)))) | 7107 (t (buffer-substring (point-at-bol) (point-at-eol)))) |
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 |
7069 (concat cpltxt "::" | 7118 (concat cpltxt "::" |
7070 (org-make-org-heading-camel | 7119 (org-make-org-heading-camel |
7195 (when (string-match "<\\<file:\\(.+?\\)::\\([^>]+\\)>" link) | 7244 (when (string-match "<\\<file:\\(.+?\\)::\\([^>]+\\)>" link) |
7196 (let* ((path (match-string 1 link)) | 7245 (let* ((path (match-string 1 link)) |
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)) |
7204 (setq link (replace-match search t t link) | 7253 (setq link (replace-match search t t link) |
7205 matched t) | 7254 matched t) |
7354 ((not (listp org-reverse-note-order)) nil) | 7403 ((not (listp org-reverse-note-order)) nil) |
7355 (t (catch 'exit | 7404 (t (catch 'exit |
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 |
7363 ;;; Tables | 7412 ;;; Tables |
7364 | 7413 |
10008 (org-skip-comments (org-split-string region "[\r\n]")))) | 10057 (org-skip-comments (org-split-string region "[\r\n]")))) |
10009 (org-startup-with-deadline-check nil) | 10058 (org-startup-with-deadline-check nil) |
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)) |
10017 (date (format-time-string "%Y/%m/%d" (current-time))) | 10066 (date (format-time-string "%Y/%m/%d" (current-time))) |
10018 (time (format-time-string "%X" (current-time))) | 10067 (time (format-time-string "%X" (current-time))) |
10157 (defun org-export-copy-visible () | 10206 (defun org-export-copy-visible () |
10158 "Copy the visible part of the buffer to another buffer, for printing. | 10207 "Copy the visible part of the buffer to another buffer, for printing. |
10159 Also removes the first line of the buffer if it specifies a mode, | 10208 Also removes the first line of the buffer if it specifies a mode, |
10160 and all options lines." | 10209 and 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 |
10166 (org-make-options-regexp | 10215 (org-make-options-regexp |
10167 '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" | 10216 '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" |
10231 org-export-with-fixed-width | 10280 org-export-with-fixed-width |
10232 org-export-with-tables | 10281 org-export-with-tables |
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") |
10240 (if (equal org-todo-interpretation 'type) | 10289 (if (equal org-todo-interpretation 'type) |
10241 (mapconcat 'identity org-todo-keywords " ") | 10290 (mapconcat 'identity org-todo-keywords " ") |
10304 If there is an active region, export only the region. | 10353 If there is an active region, export only the region. |
10305 The prefix ARG specifies how many levels of the outline should become | 10354 The prefix ARG specifies how many levels of the outline should become |
10306 headlines. The default is 3. Lower levels will become bulleted lists." | 10355 headlines. 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 |
10313 emacs --batch | 10362 emacs --batch |
10314 --load=$HOME/lib/emacs/org.el | 10363 --load=$HOME/lib/emacs/org.el |
10334 (all_lines | 10383 (all_lines |
10335 (org-skip-comments (org-split-string region "[\r\n]"))) | 10384 (org-skip-comments (org-split-string region "[\r\n]"))) |
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)) |
10343 (date (format-time-string "%Y/%m/%d" (current-time))) | 10392 (date (format-time-string "%Y/%m/%d" (current-time))) |
10344 (time (format-time-string "%X" (current-time))) | 10393 (time (format-time-string "%X" (current-time))) |
10997 (defun org-export-icalendar-this-file () | 11046 (defun org-export-icalendar-this-file () |
10998 "Export current file as an iCalendar file. | 11047 "Export current file as an iCalendar file. |
10999 The iCalendar file will be located in the same directory as the Org-mode | 11048 The iCalendar file will be located in the same directory as the Org-mode |
11000 file, but with extension `.ics'." | 11049 file, 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 () |
11006 "Export all files in `org-agenda-files' to iCalendar .ics files. | 11055 "Export all files in `org-agenda-files' to iCalendar .ics files. |
11007 Each iCalendar file will be located in the same directory as the Org-mode | 11056 Each iCalendar file will be located in the same directory as the Org-mode |
11034 (setq ical-buffer (org-get-agenda-file-buffer ical-file)) | 11083 (setq ical-buffer (org-get-agenda-file-buffer ical-file)) |
11035 (set-buffer ical-buffer) (erase-buffer)) | 11084 (set-buffer ical-buffer) (erase-buffer)) |
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 |
11043 (and (not started) (setq started t) | 11092 (and (not started) (setq started t) |
11044 (org-start-icalendar-file org-icalendar-combined-name)) | 11093 (org-start-icalendar-file org-icalendar-combined-name)) |
12135 (or (org-invisible-p) | 12184 (or (org-invisible-p) |
12136 (save-excursion (goto-char (max (point-min) (1- (point)))) | 12185 (save-excursion (goto-char (max (point-min) (1- (point)))) |
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. | |
12142 POS defaults to point. If tags are inherited, the list contains | |
12143 the targets in the same sequence as the headlines appear, i.e. | |
12144 the 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) |
12164 | 12192 |
12165 (run-hooks 'org-load-hook) | 12193 (run-hooks 'org-load-hook) |
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 |