Mercurial > emacs
comparison lisp/textmodes/org.el @ 68171:0164d7cc3832
(org-open-file): Use mailcap for selecting an
application.
(org-file-apps-defaults-gnu): Use mailcap as the default for
selecting an application on a UNIX system.
(org-agenda-show-tags): New command.
(org-table-insert-hline): Keep cursor in current table
line.
(org-table-convert): Offset effect of modifying
`org-table-insert-hline'.
(org-format-agenda-item): New optional argument TAG.
(org-compile-prefix-format): Handle %T format for the tag.
(org-expand-wide-chars): New function.
(org-table-insert-row, org-table-insert-hline): Use
`org-expand-wide-chars'.
(org-open-file): Fixed bug in program launch.
(org-get-time-of-day): Fixed bug with times before 1am.
(org-agenda-menu): Addes tags commands.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Fri, 13 Jan 2006 11:29:17 +0000 |
parents | f556787bf755 |
children | 85897d09e200 |
comparison
equal
deleted
inserted
replaced
68170:c49519c91e45 | 68171:0164d7cc3832 |
---|---|
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.02 | 8 ;; Version: 4.03 |
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.03 | |
85 ;; - Table alignment fixed for use with wide characters. | |
86 ;; - `C-c -' leaves cursor in current table line. | |
87 ;; - The current TAG can be incorporated into the agenda prefix. | |
88 ;; See option `org-agenda-prefix-format' for details. | |
89 ;; | |
84 ;; Version 4.02 | 90 ;; Version 4.02 |
85 ;; - Minor bug fixes and improvements around tag searches. | 91 ;; - Minor bug fixes and improvements around tag searches. |
86 ;; - XEmacs compatibility fixes. | 92 ;; - XEmacs compatibility fixes. |
87 ;; | 93 ;; |
88 ;; Version 4.01 | 94 ;; Version 4.01 |
103 (defvar calc-embedded-open-formula) | 109 (defvar calc-embedded-open-formula) |
104 (defvar font-lock-unfontify-region-function) | 110 (defvar font-lock-unfontify-region-function) |
105 | 111 |
106 ;;; Customization variables | 112 ;;; Customization variables |
107 | 113 |
108 (defvar org-version "4.01" | 114 (defvar org-version "4.03" |
109 "The version number of the file org.el.") | 115 "The version number of the file org.el.") |
110 (defun org-version () | 116 (defun org-version () |
111 (interactive) | 117 (interactive) |
112 (message "Org-mode version %s" org-version)) | 118 (message "Org-mode version %s" org-version)) |
113 | 119 |
563 "Format specification for the prefix of items in the agenda buffer. | 569 "Format specification for the prefix of items in the agenda buffer. |
564 This format works similar to a printf format, with the following meaning: | 570 This format works similar to a printf format, with the following meaning: |
565 | 571 |
566 %c the category of the item, \"Diary\" for entries from the diary, or | 572 %c the category of the item, \"Diary\" for entries from the diary, or |
567 as given by the CATEGORY keyword or derived from the file name. | 573 as given by the CATEGORY keyword or derived from the file name. |
574 %T the first tag of the item. | |
568 %t the time-of-day specification if one applies to the entry, in the | 575 %t the time-of-day specification if one applies to the entry, in the |
569 format HH:MM | 576 format HH:MM |
570 %s Scheduling/Deadline information, a short string | 577 %s Scheduling/Deadline information, a short string |
571 | 578 |
572 All specifiers work basically like the standard `%s' of printf, but may | 579 All specifiers work basically like the standard `%s' of printf, but may |
1010 The default is true, to keep new users from shooting into their own foot." | 1017 The default is true, to keep new users from shooting into their own foot." |
1011 :group 'org-link | 1018 :group 'org-link |
1012 :type 'boolean) | 1019 :type 'boolean) |
1013 | 1020 |
1014 (defconst org-file-apps-defaults-gnu | 1021 (defconst org-file-apps-defaults-gnu |
1015 '((t . emacs) | 1022 '((t . mailcap)) |
1016 ("jpg" . "xv %s") | |
1017 ("gif" . "xv %s") | |
1018 ("ppm" . "xv %s") | |
1019 ("pgm" . "xv %s") | |
1020 ("pbm" . "xv %s") | |
1021 ("tif" . "xv %s") | |
1022 ("png" . "xv %s") | |
1023 ("ps" . "gv %s") | |
1024 ("ps.gz" . "gv %s") | |
1025 ("eps" . "gv %s") | |
1026 ("eps.gz" . "gv %s") | |
1027 ("dvi" . "xdvi %s") | |
1028 ("mpeg" . "plaympeg %s") | |
1029 ("mp3" . "plaympeg %s") | |
1030 ("fig" . "xfig %s") | |
1031 ("pdf" . "acroread %s") | |
1032 ("doc" . "soffice %s") | |
1033 ("ppt" . "soffice %s") | |
1034 ("pps" . "soffice %s") | |
1035 ("html" . "netscape -remote openURL(%s,new-window)") | |
1036 ("htm" . "netscape -remote openURL(%s,new-window)") | |
1037 ("xs" . "soffice %s")) | |
1038 "Default file applications on a UNIX/LINUX system. | 1023 "Default file applications on a UNIX/LINUX system. |
1039 See `org-file-apps'.") | 1024 See `org-file-apps'.") |
1040 | 1025 |
1041 (defconst org-file-apps-defaults-macosx | 1026 (defconst org-file-apps-defaults-macosx |
1042 '((t . "open %s") | 1027 '((t . "open %s") |
4184 (define-key org-agenda-mode-map "g" 'org-agenda-toggle-time-grid) | 4169 (define-key org-agenda-mode-map "g" 'org-agenda-toggle-time-grid) |
4185 (define-key org-agenda-mode-map "r" 'org-agenda-redo) | 4170 (define-key org-agenda-mode-map "r" 'org-agenda-redo) |
4186 (define-key org-agenda-mode-map "q" 'org-agenda-quit) | 4171 (define-key org-agenda-mode-map "q" 'org-agenda-quit) |
4187 (define-key org-agenda-mode-map "x" 'org-agenda-exit) | 4172 (define-key org-agenda-mode-map "x" 'org-agenda-exit) |
4188 (define-key org-agenda-mode-map "P" 'org-agenda-show-priority) | 4173 (define-key org-agenda-mode-map "P" 'org-agenda-show-priority) |
4174 (define-key org-agenda-mode-map "T" 'org-agenda-show-tags) | |
4189 (define-key org-agenda-mode-map "n" 'next-line) | 4175 (define-key org-agenda-mode-map "n" 'next-line) |
4190 (define-key org-agenda-mode-map "p" 'previous-line) | 4176 (define-key org-agenda-mode-map "p" 'previous-line) |
4191 (define-key org-agenda-mode-map "\C-n" 'org-agenda-next-date-line) | 4177 (define-key org-agenda-mode-map "\C-n" 'org-agenda-next-date-line) |
4192 (define-key org-agenda-mode-map "\C-p" 'org-agenda-previous-date-line) | 4178 (define-key org-agenda-mode-map "\C-p" 'org-agenda-previous-date-line) |
4193 (define-key org-agenda-mode-map "," 'org-agenda-priority) | 4179 (define-key org-agenda-mode-map "," 'org-agenda-priority) |
4230 ["Go To (one window)" org-agenda-switch-to t] | 4216 ["Go To (one window)" org-agenda-switch-to t] |
4231 ["Follow Mode" org-agenda-follow-mode | 4217 ["Follow Mode" org-agenda-follow-mode |
4232 :style toggle :selected org-agenda-follow-mode :active t] | 4218 :style toggle :selected org-agenda-follow-mode :active t] |
4233 "--" | 4219 "--" |
4234 ["Cycle TODO" org-agenda-todo t] | 4220 ["Cycle TODO" org-agenda-todo t] |
4235 ["Set Tags" org-agenda-set-tags t] | 4221 ("Tags" |
4222 ["Show all Tags" org-agenda-show-tags t] | |
4223 ["Set Tags" org-agenda-set-tags t]) | |
4236 ("Reschedule" | 4224 ("Reschedule" |
4237 ["Reschedule +1 day" org-agenda-date-later (org-agenda-check-type nil 'agenda 'timeline)] | 4225 ["Reschedule +1 day" org-agenda-date-later (org-agenda-check-type nil 'agenda 'timeline)] |
4238 ["Reschedule -1 day" org-agenda-date-earlier (org-agenda-check-type nil 'agenda 'timeline)] | 4226 ["Reschedule -1 day" org-agenda-date-earlier (org-agenda-check-type nil 'agenda 'timeline)] |
4239 "--" | 4227 "--" |
4240 ["Reschedule to ..." org-agenda-date-prompt (org-agenda-check-type nil 'agenda 'timeline)]) | 4228 ["Reschedule to ..." org-agenda-date-prompt (org-agenda-check-type nil 'agenda 'timeline)]) |
4944 (when entries | 4932 (when entries |
4945 (setq entries (org-split-string entries "\n")) | 4933 (setq entries (org-split-string entries "\n")) |
4946 (setq entries | 4934 (setq entries |
4947 (mapcar | 4935 (mapcar |
4948 (lambda (x) | 4936 (lambda (x) |
4949 (setq x (org-format-agenda-item "" x "Diary" 'time)) | 4937 (setq x (org-format-agenda-item "" x "Diary" nil 'time)) |
4950 ;; Extend the text properties to the beginning of the line | 4938 ;; Extend the text properties to the beginning of the line |
4951 (add-text-properties | 4939 (add-text-properties |
4952 0 (length x) | 4940 0 (length x) |
4953 (text-properties-at (1- (length x)) x) | 4941 (text-properties-at (1- (length x)) x) |
4954 x) | 4942 x) |
5295 (if org-select-this-todo-keyword | 5283 (if org-select-this-todo-keyword |
5296 (concat "\\<\\(" org-select-this-todo-keyword | 5284 (concat "\\<\\(" org-select-this-todo-keyword |
5297 "\\)\\>") | 5285 "\\)\\>") |
5298 org-not-done-regexp) | 5286 org-not-done-regexp) |
5299 "[^\n\r]*\\)")) | 5287 "[^\n\r]*\\)")) |
5300 marker priority category | 5288 marker priority category tags |
5301 ee txt) | 5289 ee txt) |
5302 (goto-char (point-min)) | 5290 (goto-char (point-min)) |
5303 (while (re-search-forward regexp nil t) | 5291 (while (re-search-forward regexp nil t) |
5304 (goto-char (match-beginning 1)) | 5292 (goto-char (match-beginning 1)) |
5305 (setq marker (org-agenda-new-marker (1+ (match-beginning 0))) | 5293 (setq marker (org-agenda-new-marker (1+ (match-beginning 0))) |
5306 category (org-get-category) | 5294 category (org-get-category) |
5307 txt (org-format-agenda-item "" (match-string 1) category) | 5295 tags (org-get-tags-at (point)) |
5296 txt (org-format-agenda-item "" (match-string 1) category tags) | |
5308 priority | 5297 priority |
5309 (+ (org-get-priority txt) | 5298 (+ (org-get-priority txt) |
5310 (if org-todo-kwd-priority-p | 5299 (if org-todo-kwd-priority-p |
5311 (- org-todo-kwd-max-priority -2 | 5300 (- org-todo-kwd-max-priority -2 |
5312 (length | 5301 (length |
5338 (car org-time-stamp-formats) | 5327 (car org-time-stamp-formats) |
5339 (apply 'encode-time ; DATE bound by calendar | 5328 (apply 'encode-time ; DATE bound by calendar |
5340 (list 0 0 0 (nth 1 date) (car date) (nth 2 date)))) | 5329 (list 0 0 0 (nth 1 date) (car date) (nth 2 date)))) |
5341 0 11))) | 5330 0 11))) |
5342 marker hdmarker deadlinep scheduledp donep tmp priority category | 5331 marker hdmarker deadlinep scheduledp donep tmp priority category |
5343 ee txt timestr) | 5332 ee txt timestr tags) |
5344 (goto-char (point-min)) | 5333 (goto-char (point-min)) |
5345 (while (re-search-forward regexp nil t) | 5334 (while (re-search-forward regexp nil t) |
5346 (if (not (save-match-data (org-at-date-range-p))) | 5335 (if (not (save-match-data (org-at-date-range-p))) |
5347 (progn | 5336 (progn |
5348 (setq marker (org-agenda-new-marker (match-beginning 0)) | 5337 (setq marker (org-agenda-new-marker (match-beginning 0)) |
5360 (setq timestr (substring timestr 0 (match-end 0)))) | 5349 (setq timestr (substring timestr 0 (match-end 0)))) |
5361 (save-excursion | 5350 (save-excursion |
5362 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t) | 5351 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t) |
5363 (progn | 5352 (progn |
5364 (goto-char (match-end 1)) | 5353 (goto-char (match-end 1)) |
5365 (setq hdmarker (org-agenda-new-marker)) | 5354 (setq hdmarker (org-agenda-new-marker) |
5355 tags (org-get-tags-at)) | |
5366 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)") | 5356 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)") |
5367 (setq txt (org-format-agenda-item | 5357 (setq txt (org-format-agenda-item |
5368 (format "%s%s" | 5358 (format "%s%s" |
5369 (if deadlinep "Deadline: " "") | 5359 (if deadlinep "Deadline: " "") |
5370 (if scheduledp "Scheduled: " "")) | 5360 (if scheduledp "Scheduled: " "")) |
5371 (match-string 1) category timestr))) | 5361 (match-string 1) category tags timestr))) |
5372 (setq txt org-agenda-no-heading-message)) | 5362 (setq txt org-agenda-no-heading-message)) |
5373 (setq priority (org-get-priority txt)) | 5363 (setq priority (org-get-priority txt)) |
5374 (add-text-properties | 5364 (add-text-properties |
5375 0 (length txt) (append (list 'org-marker marker | 5365 0 (length txt) (append (list 'org-marker marker |
5376 'org-hd-marker hdmarker) props) | 5366 'org-hd-marker hdmarker) props) |
5415 (format-time-string | 5405 (format-time-string |
5416 (car org-time-stamp-formats) | 5406 (car org-time-stamp-formats) |
5417 (apply 'encode-time ; DATE bound by calendar | 5407 (apply 'encode-time ; DATE bound by calendar |
5418 (list 0 0 0 (nth 1 date) (car date) (nth 2 date)))) | 5408 (list 0 0 0 (nth 1 date) (car date) (nth 2 date)))) |
5419 1 11)))) | 5409 1 11)))) |
5420 marker hdmarker priority category | 5410 marker hdmarker priority category tags |
5421 ee txt timestr) | 5411 ee txt timestr) |
5422 (goto-char (point-min)) | 5412 (goto-char (point-min)) |
5423 (while (re-search-forward regexp nil t) | 5413 (while (re-search-forward regexp nil t) |
5424 (if (not (save-match-data (org-at-date-range-p))) | 5414 (if (not (save-match-data (org-at-date-range-p))) |
5425 (progn | 5415 (progn |
5433 (setq timestr (substring timestr 0 (match-end 0)))) | 5423 (setq timestr (substring timestr 0 (match-end 0)))) |
5434 (save-excursion | 5424 (save-excursion |
5435 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t) | 5425 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t) |
5436 (progn | 5426 (progn |
5437 (goto-char (match-end 1)) | 5427 (goto-char (match-end 1)) |
5438 (setq hdmarker (org-agenda-new-marker)) | 5428 (setq hdmarker (org-agenda-new-marker) |
5429 tags (org-get-tags-at)) | |
5439 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)") | 5430 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)") |
5440 (setq txt (org-format-agenda-item | 5431 (setq txt (org-format-agenda-item |
5441 "Closed: " | 5432 "Closed: " |
5442 (match-string 1) category timestr))) | 5433 (match-string 1) category tags timestr))) |
5443 (setq txt org-agenda-no-heading-message)) | 5434 (setq txt org-agenda-no-heading-message)) |
5444 (setq priority 100000) | 5435 (setq priority 100000) |
5445 (add-text-properties | 5436 (add-text-properties |
5446 0 (length txt) (append (list 'org-marker marker | 5437 0 (length txt) (append (list 'org-marker marker |
5447 'org-hd-marker hdmarker | 5438 'org-hd-marker hdmarker |
5464 (format "mouse-2 or RET jump to org file %s" | 5455 (format "mouse-2 or RET jump to org file %s" |
5465 (abbreviate-file-name (buffer-file-name))))) | 5456 (abbreviate-file-name (buffer-file-name))))) |
5466 (regexp org-deadline-time-regexp) | 5457 (regexp org-deadline-time-regexp) |
5467 (todayp (equal date (calendar-current-date))) ; DATE bound by calendar | 5458 (todayp (equal date (calendar-current-date))) ; DATE bound by calendar |
5468 (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar | 5459 (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar |
5469 d2 diff pos pos1 category | 5460 d2 diff pos pos1 category tags |
5470 ee txt head) | 5461 ee txt head) |
5471 (goto-char (point-min)) | 5462 (goto-char (point-min)) |
5472 (while (re-search-forward regexp nil t) | 5463 (while (re-search-forward regexp nil t) |
5473 (setq pos (1- (match-beginning 1)) | 5464 (setq pos (1- (match-beginning 1)) |
5474 d2 (time-to-days | 5465 d2 (time-to-days |
5482 (setq category (org-get-category)) | 5473 (setq category (org-get-category)) |
5483 (if (re-search-backward "\\(^\\|\r\\)\\*+[ \t]*" nil t) | 5474 (if (re-search-backward "\\(^\\|\r\\)\\*+[ \t]*" nil t) |
5484 (progn | 5475 (progn |
5485 (goto-char (match-end 0)) | 5476 (goto-char (match-end 0)) |
5486 (setq pos1 (match-end 1)) | 5477 (setq pos1 (match-end 1)) |
5478 (setq tags (org-get-tags-at pos1)) | |
5487 (setq head (buffer-substring-no-properties | 5479 (setq head (buffer-substring-no-properties |
5488 (point) | 5480 (point) |
5489 (progn (skip-chars-forward "^\r\n") | 5481 (progn (skip-chars-forward "^\r\n") |
5490 (point)))) | 5482 (point)))) |
5491 (if (string-match org-looking-at-done-regexp head) | 5483 (if (string-match org-looking-at-done-regexp head) |
5492 (setq txt nil) | 5484 (setq txt nil) |
5493 (setq txt (org-format-agenda-item | 5485 (setq txt (org-format-agenda-item |
5494 (format "In %3d d.: " diff) head category)))) | 5486 (format "In %3d d.: " diff) head category tags)))) |
5495 (setq txt org-agenda-no-heading-message)) | 5487 (setq txt org-agenda-no-heading-message)) |
5496 (when txt | 5488 (when txt |
5497 (add-text-properties | 5489 (add-text-properties |
5498 0 (length txt) | 5490 0 (length txt) |
5499 (append | 5491 (append |
5525 (format "mouse-2 or RET jump to org file %s" | 5517 (format "mouse-2 or RET jump to org file %s" |
5526 (abbreviate-file-name (buffer-file-name))))) | 5518 (abbreviate-file-name (buffer-file-name))))) |
5527 (regexp org-scheduled-time-regexp) | 5519 (regexp org-scheduled-time-regexp) |
5528 (todayp (equal date (calendar-current-date))) ; DATE bound by calendar | 5520 (todayp (equal date (calendar-current-date))) ; DATE bound by calendar |
5529 (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar | 5521 (d1 (calendar-absolute-from-gregorian date)) ; DATE bound by calendar |
5530 d2 diff pos pos1 category | 5522 d2 diff pos pos1 category tags |
5531 ee txt head) | 5523 ee txt head) |
5532 (goto-char (point-min)) | 5524 (goto-char (point-min)) |
5533 (while (re-search-forward regexp nil t) | 5525 (while (re-search-forward regexp nil t) |
5534 (setq pos (1- (match-beginning 1)) | 5526 (setq pos (1- (match-beginning 1)) |
5535 d2 (time-to-days | 5527 d2 (time-to-days |
5542 (setq category (org-get-category)) | 5534 (setq category (org-get-category)) |
5543 (if (re-search-backward "\\(^\\|\r\\)\\*+[ \t]*" nil t) | 5535 (if (re-search-backward "\\(^\\|\r\\)\\*+[ \t]*" nil t) |
5544 (progn | 5536 (progn |
5545 (goto-char (match-end 0)) | 5537 (goto-char (match-end 0)) |
5546 (setq pos1 (match-end 1)) | 5538 (setq pos1 (match-end 1)) |
5539 (setq tags (org-get-tags-at)) | |
5547 (setq head (buffer-substring-no-properties | 5540 (setq head (buffer-substring-no-properties |
5548 (point) | 5541 (point) |
5549 (progn (skip-chars-forward "^\r\n") (point)))) | 5542 (progn (skip-chars-forward "^\r\n") (point)))) |
5550 (if (string-match org-looking-at-done-regexp head) | 5543 (if (string-match org-looking-at-done-regexp head) |
5551 (setq txt nil) | 5544 (setq txt nil) |
5552 (setq txt (org-format-agenda-item | 5545 (setq txt (org-format-agenda-item |
5553 (format "Sched.%2dx: " (- 1 diff)) head | 5546 (format "Sched.%2dx: " (- 1 diff)) head |
5554 category)))) | 5547 category tags)))) |
5555 (setq txt org-agenda-no-heading-message)) | 5548 (setq txt org-agenda-no-heading-message)) |
5556 (when txt | 5549 (when txt |
5557 (add-text-properties | 5550 (add-text-properties |
5558 0 (length txt) | 5551 0 (length txt) |
5559 (append (list 'org-marker (org-agenda-new-marker pos) | 5552 (append (list 'org-marker (org-agenda-new-marker pos) |
5572 'help-echo | 5565 'help-echo |
5573 (format "mouse-2 or RET jump to org file %s" | 5566 (format "mouse-2 or RET jump to org file %s" |
5574 (abbreviate-file-name (buffer-file-name))))) | 5567 (abbreviate-file-name (buffer-file-name))))) |
5575 (regexp org-tr-regexp) | 5568 (regexp org-tr-regexp) |
5576 (d0 (calendar-absolute-from-gregorian date)) | 5569 (d0 (calendar-absolute-from-gregorian date)) |
5577 marker hdmarker ee txt d1 d2 s1 s2 timestr category) | 5570 marker hdmarker ee txt d1 d2 s1 s2 timestr category tags) |
5578 (goto-char (point-min)) | 5571 (goto-char (point-min)) |
5579 (while (re-search-forward regexp nil t) | 5572 (while (re-search-forward regexp nil t) |
5580 (setq timestr (match-string 0) | 5573 (setq timestr (match-string 0) |
5581 s1 (match-string 1) | 5574 s1 (match-string 1) |
5582 s2 (match-string 2) | 5575 s2 (match-string 2) |
5590 (setq category (org-get-category)) | 5583 (setq category (org-get-category)) |
5591 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t) | 5584 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t) |
5592 (progn | 5585 (progn |
5593 (setq hdmarker (org-agenda-new-marker (match-end 1))) | 5586 (setq hdmarker (org-agenda-new-marker (match-end 1))) |
5594 (goto-char (match-end 1)) | 5587 (goto-char (match-end 1)) |
5588 (setq tags (org-get-tags-at)) | |
5595 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)") | 5589 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)") |
5596 (setq txt (org-format-agenda-item | 5590 (setq txt (org-format-agenda-item |
5597 (format (if (= d1 d2) "" "(%d/%d): ") | 5591 (format (if (= d1 d2) "" "(%d/%d): ") |
5598 (1+ (- d0 d1)) (1+ (- d2 d1))) | 5592 (1+ (- d0 d1)) (1+ (- d2 d1))) |
5599 (match-string 1) category | 5593 (match-string 1) category tags |
5600 (if (= d0 d1) timestr)))) | 5594 (if (= d0 d1) timestr)))) |
5601 (setq txt org-agenda-no-heading-message)) | 5595 (setq txt org-agenda-no-heading-message)) |
5602 (add-text-properties | 5596 (add-text-properties |
5603 0 (length txt) (append (list 'org-marker marker | 5597 0 (length txt) (append (list 'org-marker marker |
5604 'org-hd-marker hdmarker | 5598 'org-hd-marker hdmarker |
5641 | 5635 |
5642 (defvar org-prefix-has-time nil | 5636 (defvar org-prefix-has-time nil |
5643 "A flag, set by `org-compile-prefix-format'. | 5637 "A flag, set by `org-compile-prefix-format'. |
5644 The flag is set if the currently compiled format contains a `%t'.") | 5638 The flag is set if the currently compiled format contains a `%t'.") |
5645 | 5639 |
5646 (defun org-format-agenda-item (extra txt &optional category dotime noprefix) | 5640 (defun org-format-agenda-item (extra txt &optional category tags dotime noprefix) |
5647 "Format TXT to be inserted into the agenda buffer. | 5641 "Format TXT to be inserted into the agenda buffer. |
5648 In particular, it adds the prefix and corresponding text properties. EXTRA | 5642 In particular, it adds the prefix and corresponding text properties. EXTRA |
5649 must be a string and replaces the `%s' specifier in the prefix format. | 5643 must be a string and replaces the `%s' specifier in the prefix format. |
5650 CATEGORY (string, symbol or nil) may be used to overule the default | 5644 CATEGORY (string, symbol or nil) may be used to overule the default |
5651 category taken from local variable or file name. It will replace the `%c' | 5645 category taken from local variable or file name. It will replace the `%c' |
5652 specifier in the format. DOTIME, when non-nil, indicates that a | 5646 specifier in the format. DOTIME, when non-nil, indicates that a |
5653 time-of-day should be extracted from TXT for sorting of this entry, and for | 5647 time-of-day should be extracted from TXT for sorting of this entry, and for |
5654 the `%t' specifier in the format. When DOTIME is a string, this string is | 5648 the `%t' specifier in the format. When DOTIME is a string, this string is |
5655 searched for a time before TXT is. NOPREFIX is a flag and indicates that | 5649 searched for a time before TXT is. NOPREFIX is a flag and indicates that |
5656 only the correctly processes TXT should be returned - this is used by | 5650 only the correctly processes TXT should be returned - this is used by |
5657 `org-agenda-change-all-lines'." | 5651 `org-agenda-change-all-lines'. TAG can be the tag of the headline." |
5658 (save-match-data | 5652 (save-match-data |
5659 ;; Diary entries sometimes have extra whitespace at the beginning | 5653 ;; Diary entries sometimes have extra whitespace at the beginning |
5660 (if (string-match "^ +" txt) (setq txt (replace-match "" nil nil txt))) | 5654 (if (string-match "^ +" txt) (setq txt (replace-match "" nil nil txt))) |
5661 (let* ((category (or category | 5655 (let* ((category (or category |
5662 org-category | 5656 org-category |
5663 (if (buffer-file-name) | 5657 (if (buffer-file-name) |
5664 (file-name-sans-extension | 5658 (file-name-sans-extension |
5665 (file-name-nondirectory (buffer-file-name))) | 5659 (file-name-nondirectory (buffer-file-name))) |
5666 ""))) | 5660 ""))) |
5661 (tag (or (nth (1- (length tags)) tags) "")) | |
5667 time ;; needed for the eval of the prefix format | 5662 time ;; needed for the eval of the prefix format |
5668 (ts (if dotime (concat (if (stringp dotime) dotime "") txt))) | 5663 (ts (if dotime (concat (if (stringp dotime) dotime "") txt))) |
5669 (time-of-day (and dotime (org-get-time-of-day ts))) | 5664 (time-of-day (and dotime (org-get-time-of-day ts))) |
5670 stamp plain s0 s1 s2 rtn) | 5665 stamp plain s0 s1 s2 rtn) |
5671 (when (and dotime time-of-day org-prefix-has-time) | 5666 (when (and dotime time-of-day org-prefix-has-time) |
5702 (setq rtn (concat (eval org-prefix-format-compiled) txt))) | 5697 (setq rtn (concat (eval org-prefix-format-compiled) txt))) |
5703 | 5698 |
5704 ;; And finally add the text properties | 5699 ;; And finally add the text properties |
5705 (add-text-properties | 5700 (add-text-properties |
5706 0 (length rtn) (list 'category (downcase category) | 5701 0 (length rtn) (list 'category (downcase category) |
5702 'tags tags | |
5707 'prefix-length (- (length rtn) (length txt)) | 5703 'prefix-length (- (length rtn) (length txt)) |
5708 'time-of-day time-of-day | 5704 'time-of-day time-of-day |
5709 'dotime dotime) | 5705 'dotime dotime) |
5710 rtn) | 5706 rtn) |
5711 rtn))) | 5707 rtn))) |
5730 (throw 'exit list)) | 5726 (throw 'exit list)) |
5731 (while (setq time (pop gridtimes)) | 5727 (while (setq time (pop gridtimes)) |
5732 (unless (and remove (member time have)) | 5728 (unless (and remove (member time have)) |
5733 (setq time (int-to-string time)) | 5729 (setq time (int-to-string time)) |
5734 (push (org-format-agenda-item | 5730 (push (org-format-agenda-item |
5735 nil string "" ;; FIXME: put a category for the grid? | 5731 nil string "" nil ;; FIXME: put a category for the grid? |
5736 (concat (substring time 0 -2) ":" (substring time -2))) | 5732 (concat (substring time 0 -2) ":" (substring time -2))) |
5737 new) | 5733 new) |
5738 (put-text-property | 5734 (put-text-property |
5739 1 (length (car new)) 'face 'org-time-grid (car new)))) | 5735 1 (length (car new)) 'face 'org-time-grid (car new)))) |
5740 (if (member 'time-up org-agenda-sorting-strategy) | 5736 (if (member 'time-up org-agenda-sorting-strategy) |
5744 (defun org-compile-prefix-format (format) | 5740 (defun org-compile-prefix-format (format) |
5745 "Compile the prefix format into a Lisp form that can be evaluated. | 5741 "Compile the prefix format into a Lisp form that can be evaluated. |
5746 The resulting form is returned and stored in the variable | 5742 The resulting form is returned and stored in the variable |
5747 `org-prefix-format-compiled'." | 5743 `org-prefix-format-compiled'." |
5748 (setq org-prefix-has-time nil) | 5744 (setq org-prefix-has-time nil) |
5749 (let ((start 0) varform vars var (s format) c f opt) | 5745 (let ((start 0) varform vars var (s format)e c f opt) |
5750 (while (string-match "%\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([cts]\\)" | 5746 (while (string-match "%\\(\\?\\)?\\([-+]?[0-9.]*\\)\\([ .;,:!?=|/<>]?\\)\\([cts]\\)" |
5751 s start) | 5747 s start) |
5752 (setq var (cdr (assoc (match-string 4 s) | 5748 (setq var (cdr (assoc (match-string 4 s) |
5753 '(("c" . category) ("t" . time) ("s" . extra)))) | 5749 '(("c" . category) ("t" . time) ("s" . extra) |
5750 ("T" . tag)))) | |
5754 c (or (match-string 3 s) "") | 5751 c (or (match-string 3 s) "") |
5755 opt (match-beginning 1) | 5752 opt (match-beginning 1) |
5756 start (1+ (match-beginning 0))) | 5753 start (1+ (match-beginning 0))) |
5757 (if (equal var 'time) (setq org-prefix-has-time t)) | 5754 (if (equal var 'time) (setq org-prefix-has-time t)) |
5758 (setq f (concat "%" (match-string 2 s) "s")) | 5755 (setq f (concat "%" (match-string 2 s) "s")) |
5786 (equal (downcase (match-string 4 s)) "pm")) | 5783 (equal (downcase (match-string 4 s)) "pm")) |
5787 12 0))) | 5784 12 0))) |
5788 (if (match-beginning 3) | 5785 (if (match-beginning 3) |
5789 (string-to-number (match-string 3 s)) | 5786 (string-to-number (match-string 3 s)) |
5790 0))) | 5787 0))) |
5791 (t1 (concat " " (int-to-string t0)))) | 5788 (t1 (concat " " |
5789 (if (< t0 100) "0" "") | |
5790 (int-to-string t0)))) | |
5792 (if string (concat (substring t1 -4 -2) ":" (substring t1 -2)) t0))))) | 5791 (if string (concat (substring t1 -4 -2) ":" (substring t1 -2)) t0))))) |
5793 | 5792 |
5794 (defun org-finalize-agenda-entries (list) | 5793 (defun org-finalize-agenda-entries (list) |
5795 "Sort and concatenate the agenda items." | 5794 "Sort and concatenate the agenda items." |
5796 (mapconcat 'identity (sort list 'org-entries-lessp) "\n")) | 5795 (mapconcat 'identity (sort list 'org-entries-lessp) "\n")) |
5839 This priority is composed of the main priority given with the [#A] cookies, | 5838 This priority is composed of the main priority given with the [#A] cookies, |
5840 and by additional input from the age of a schedules or deadline entry." | 5839 and by additional input from the age of a schedules or deadline entry." |
5841 (interactive) | 5840 (interactive) |
5842 (let* ((pri (get-text-property (point-at-bol) 'priority))) | 5841 (let* ((pri (get-text-property (point-at-bol) 'priority))) |
5843 (message "Priority is %d" (if pri pri -1000)))) | 5842 (message "Priority is %d" (if pri pri -1000)))) |
5843 | |
5844 (defun org-agenda-show-tags () | |
5845 "Show the tags applicable to the current item." | |
5846 (interactive) | |
5847 (let* ((tags (get-text-property (point-at-bol) 'tags))) | |
5848 (if tags | |
5849 (message "Tags are :%s:" (mapconcat 'identity tags ":")) | |
5850 (message "No tags associated with this line")))) | |
5844 | 5851 |
5845 (defun org-agenda-goto (&optional highlight) | 5852 (defun org-agenda-goto (&optional highlight) |
5846 "Go to the Org-mode file which contains the item at point." | 5853 "Go to the Org-mode file which contains the item at point." |
5847 (interactive) | 5854 (interactive) |
5848 (let* ((marker (or (get-text-property (point) 'org-marker) | 5855 (let* ((marker (or (get-text-property (point) 'org-marker) |
5952 The new content of the line will be NEWHEAD (as modified by | 5959 The new content of the line will be NEWHEAD (as modified by |
5953 `org-format-agenda-item'). HDMARKER is checked with | 5960 `org-format-agenda-item'). HDMARKER is checked with |
5954 `equal' against all `org-hd-marker' text properties in the file. | 5961 `equal' against all `org-hd-marker' text properties in the file. |
5955 If FIXFACE is non-nil, the face of each item is modified acording to | 5962 If FIXFACE is non-nil, the face of each item is modified acording to |
5956 the new TODO state." | 5963 the new TODO state." |
5957 (let* (props m pl undone-face done-face finish new dotime cat) | 5964 (let* (props m pl undone-face done-face finish new dotime cat tags) |
5958 ; (setq newhead (org-format-agenda-item "x" newhead "x" nil 'noprefix)) | 5965 ; (setq newhead (org-format-agenda-item "x" newhead "x" nil 'noprefix)) |
5959 (save-excursion | 5966 (save-excursion |
5960 (goto-char (point-max)) | 5967 (goto-char (point-max)) |
5961 (beginning-of-line 1) | 5968 (beginning-of-line 1) |
5962 (while (not finish) | 5969 (while (not finish) |
5964 (when (and (setq m (get-text-property (point) 'org-hd-marker)) | 5971 (when (and (setq m (get-text-property (point) 'org-hd-marker)) |
5965 (equal m hdmarker)) | 5972 (equal m hdmarker)) |
5966 (setq props (text-properties-at (point)) | 5973 (setq props (text-properties-at (point)) |
5967 dotime (get-text-property (point) 'dotime) | 5974 dotime (get-text-property (point) 'dotime) |
5968 cat (get-text-property (point) 'category) | 5975 cat (get-text-property (point) 'category) |
5969 new (org-format-agenda-item "x" newhead cat dotime 'noprefix) | 5976 tags (get-text-property (point) 'tags) |
5977 new (org-format-agenda-item "x" newhead cat tags dotime 'noprefix) | |
5970 pl (get-text-property (point) 'prefix-length) | 5978 pl (get-text-property (point) 'prefix-length) |
5971 undone-face (get-text-property (point) 'undone-face) | 5979 undone-face (get-text-property (point) 'undone-face) |
5972 done-face (get-text-property (point) 'done-face)) | 5980 done-face (get-text-property (point) 'done-face)) |
5973 (move-to-column pl) | 5981 (move-to-column pl) |
5974 (if (looking-at ".*") | 5982 (if (looking-at ".*") |
6292 "" | 6300 "" |
6293 (concat | 6301 (concat |
6294 (if org-tags-match-list-sublevels | 6302 (if org-tags-match-list-sublevels |
6295 (make-string (1- level) ?.) "") | 6303 (make-string (1- level) ?.) "") |
6296 (org-get-heading)) | 6304 (org-get-heading)) |
6297 category)) | 6305 category tags-list)) |
6298 (goto-char lspos) | 6306 (goto-char lspos) |
6299 (setq marker (org-agenda-new-marker)) | 6307 (setq marker (org-agenda-new-marker)) |
6300 (add-text-properties | 6308 (add-text-properties |
6301 0 (length txt) | 6309 0 (length txt) |
6302 (append (list 'org-marker marker 'org-hd-marker marker | 6310 (append (list 'org-marker marker 'org-hd-marker marker |
6868 (setq apps (append org-file-apps (org-default-apps))) | 6876 (setq apps (append org-file-apps (org-default-apps))) |
6869 (if in-emacs | 6877 (if in-emacs |
6870 (setq cmd 'emacs) | 6878 (setq cmd 'emacs) |
6871 (setq cmd (or (cdr (assoc ext apps)) | 6879 (setq cmd (or (cdr (assoc ext apps)) |
6872 (cdr (assoc t apps))))) | 6880 (cdr (assoc t apps))))) |
6881 (when (eq cmd 'mailcap) | |
6882 (require 'mailcap) | |
6883 (mailcap-parse-mailcaps) | |
6884 (let* ((mime-type (mailcap-extension-to-mime (or ext ""))) | |
6885 (command (mailcap-mime-info mime-type))) | |
6886 (if (stringp command) | |
6887 (setq cmd command) | |
6888 (setq cmd 'emacs)))) | |
6873 (cond | 6889 (cond |
6874 ((and (stringp cmd) (not (string-match "^\\s-*$" cmd))) | 6890 ((and (stringp cmd) (not (string-match "^\\s-*$" cmd))) |
6875 (setq cmd (format cmd (concat "\"" file "\""))) | 6891 (setq cmd (format cmd (concat "\"" file "\""))) |
6876 (save-window-excursion | 6892 (save-window-excursion |
6877 (shell-command (concat cmd " & &")))) | 6893 (shell-command (concat cmd " &")))) |
6878 ((or (stringp cmd) | 6894 ((or (stringp cmd) |
6879 (eq cmd 'emacs)) | 6895 (eq cmd 'emacs)) |
6880 (unless (equal (file-truename file) (file-truename (buffer-file-name))) | 6896 (unless (equal (file-truename file) (file-truename (buffer-file-name))) |
6881 (funcall (cdr (assq 'file org-link-frame-setup)) file)) | 6897 (funcall (cdr (assq 'file org-link-frame-setup)) file)) |
6882 (if line (goto-line line) | 6898 (if line (goto-line line) |
7585 ;; for each column | 7601 ;; for each column |
7586 (setq i -1) | 7602 (setq i -1) |
7587 (while (< (setq i (1+ i)) maxfields) ;; Loop over all columns | 7603 (while (< (setq i (1+ i)) maxfields) ;; Loop over all columns |
7588 (setq column (mapcar (lambda (x) (or (nth i x) "")) fields)) | 7604 (setq column (mapcar (lambda (x) (or (nth i x) "")) fields)) |
7589 ;; maximum length | 7605 ;; maximum length |
7590 (push (apply 'max 1 (mapcar 'length column)) lengths) | 7606 (push (apply 'max 1 (mapcar 'string-width column)) lengths) |
7591 ;; compute the fraction stepwise, ignoring empty fields | 7607 ;; compute the fraction stepwise, ignoring empty fields |
7592 (setq cnt 0 frac 0.0) | 7608 (setq cnt 0 frac 0.0) |
7593 (mapcar | 7609 (mapcar |
7594 (lambda (x) | 7610 (lambda (x) |
7595 (if (equal x "") | 7611 (if (equal x "") |
7841 (skip-chars-backward "^|") | 7857 (skip-chars-backward "^|") |
7842 (backward-char 1) | 7858 (backward-char 1) |
7843 (if (looking-at "|[^|\n]+") | 7859 (if (looking-at "|[^|\n]+") |
7844 (let* ((pos (match-beginning 0)) | 7860 (let* ((pos (match-beginning 0)) |
7845 (match (match-string 0)) | 7861 (match (match-string 0)) |
7846 (len (length match))) | 7862 (len (string-width match))) |
7847 (replace-match (concat "|" (make-string (1- len) ?\ ))) | 7863 (replace-match (concat "|" (make-string (1- len) ?\ ))) |
7848 (goto-char (+ 2 pos)) | 7864 (goto-char (+ 2 pos)) |
7849 (substring match 1))))) | 7865 (substring match 1))))) |
7850 | 7866 |
7851 (defun org-table-get-field (&optional n replace) | 7867 (defun org-table-get-field (&optional n replace) |
8099 "Insert a new row above the current line into the table. | 8115 "Insert a new row above the current line into the table. |
8100 With prefix ARG, insert below the current line." | 8116 With prefix ARG, insert below the current line." |
8101 (interactive "P") | 8117 (interactive "P") |
8102 (if (not (org-at-table-p)) | 8118 (if (not (org-at-table-p)) |
8103 (error "Not at a table")) | 8119 (error "Not at a table")) |
8104 (let* ((line (buffer-substring-no-properties (point-at-bol) (point-at-eol))) | 8120 (let* ((line |
8121 (org-expand-wide-chars | |
8122 (buffer-substring-no-properties (point-at-bol) (point-at-eol)))) | |
8105 new) | 8123 new) |
8106 (if (string-match "^[ \t]*|-" line) | 8124 (if (string-match "^[ \t]*|-" line) |
8107 (setq new (mapcar (lambda (x) (if (member x '(?| ?+)) ?| ?\ )) line)) | 8125 (setq new (mapcar (lambda (x) (if (member x '(?| ?+)) ?| ?\ )) line)) |
8108 (setq new (mapcar (lambda (x) (if (equal x ?|) ?| ?\ )) line))) | 8126 (setq new (mapcar (lambda (x) (if (equal x ?|) ?| ?\ )) line))) |
8109 ;; Fix the first field if necessary | 8127 ;; Fix the first field if necessary |
8122 "Insert a horizontal-line below the current line into the table. | 8140 "Insert a horizontal-line below the current line into the table. |
8123 With prefix ARG, insert above the current line." | 8141 With prefix ARG, insert above the current line." |
8124 (interactive "P") | 8142 (interactive "P") |
8125 (if (not (org-at-table-p)) | 8143 (if (not (org-at-table-p)) |
8126 (error "Not at a table")) | 8144 (error "Not at a table")) |
8127 (let ((line (buffer-substring-no-properties (point-at-bol) (point-at-eol))) | 8145 (let ((line |
8146 (org-expand-wide-chars | |
8147 (buffer-substring-no-properties (point-at-bol) (point-at-eol)))) | |
8128 (col (current-column)) | 8148 (col (current-column)) |
8129 start) | 8149 start) |
8130 (if (string-match "^[ \t]*|-" line) | 8150 (if (string-match "^[ \t]*|-" line) |
8131 (setq line | 8151 (setq line |
8132 (mapcar (lambda (x) (if (member x '(?| ?+)) | 8152 (mapcar (lambda (x) (if (member x '(?| ?+)) |
8141 (beginning-of-line (if arg 1 2)) | 8161 (beginning-of-line (if arg 1 2)) |
8142 (apply 'insert line) | 8162 (apply 'insert line) |
8143 (if (equal (char-before (point)) ?+) | 8163 (if (equal (char-before (point)) ?+) |
8144 (progn (backward-delete-char 1) (insert "|"))) | 8164 (progn (backward-delete-char 1) (insert "|"))) |
8145 (insert "\n") | 8165 (insert "\n") |
8146 (beginning-of-line 0) | 8166 (beginning-of-line (if arg 1 -1)) |
8147 (move-to-column col))) | 8167 (move-to-column col))) |
8168 | |
8169 (defun org-expand-wide-chars (s) | |
8170 "Expand wide characters to spaces." | |
8171 (let (w a) | |
8172 (mapconcat | |
8173 (lambda (x) | |
8174 (if (> (setq w (string-width (setq a (char-to-string x)))) 1) | |
8175 (make-string w ?\ ) | |
8176 a)) | |
8177 s ""))) | |
8148 | 8178 |
8149 (defun org-table-kill-row () | 8179 (defun org-table-kill-row () |
8150 "Delete the current row or horizontal line from the table." | 8180 "Delete the current row or horizontal line from the table." |
8151 (interactive) | 8181 (interactive) |
8152 (if (not (org-at-table-p)) | 8182 (if (not (org-at-table-p)) |
8298 (while (re-search-forward "^\\([ \t]*\\)|-.*\n" end t) | 8328 (while (re-search-forward "^\\([ \t]*\\)|-.*\n" end t) |
8299 (replace-match "")) | 8329 (replace-match "")) |
8300 ;; insert a hline before first | 8330 ;; insert a hline before first |
8301 (goto-char beg) | 8331 (goto-char beg) |
8302 (org-table-insert-hline 'above) | 8332 (org-table-insert-hline 'above) |
8333 (beginning-of-line -1) | |
8303 ;; insert a hline after each line | 8334 ;; insert a hline after each line |
8304 (while (progn (beginning-of-line 2) (< (point) end)) | 8335 (while (progn (beginning-of-line 3) (< (point) end)) |
8305 (org-table-insert-hline)) | 8336 (org-table-insert-hline)) |
8306 (goto-char beg) | 8337 (goto-char beg) |
8307 (setq end (move-marker end (org-table-end))) | 8338 (setq end (move-marker end (org-table-end))) |
8308 ;; replace "+" at beginning and ending of hlines | 8339 ;; replace "+" at beginning and ending of hlines |
8309 (while (re-search-forward "^\\([ \t]*\\)|-" end t) | 8340 (while (re-search-forward "^\\([ \t]*\\)|-" end t) |
8388 wrapped to the length of that word. | 8419 wrapped to the length of that word. |
8389 IF WIDTH is nil and LINES is non-nil, the string is forced into at most that | 8420 IF WIDTH is nil and LINES is non-nil, the string is forced into at most that |
8390 many lines, whatever width that takes. | 8421 many lines, whatever width that takes. |
8391 The return value is a list of lines, without newlines at the end." | 8422 The return value is a list of lines, without newlines at the end." |
8392 (let* ((words (org-split-string string "[ \t\n]+")) | 8423 (let* ((words (org-split-string string "[ \t\n]+")) |
8393 (maxword (apply 'max (mapcar 'length words))) | 8424 (maxword (apply 'max (mapcar 'string-width words))) |
8394 w ll) | 8425 w ll) |
8395 (cond (width | 8426 (cond (width |
8396 (org-do-wrap words (max maxword width))) | 8427 (org-do-wrap words (max maxword width))) |
8397 (lines | 8428 (lines |
8398 (setq w maxword) | 8429 (setq w maxword) |
11128 | 11159 |
11129 ;;; Key bindings | 11160 ;;; Key bindings |
11130 | 11161 |
11131 ;; - Bindings in Org-mode map are currently | 11162 ;; - Bindings in Org-mode map are currently |
11132 ;; 0123456789abcdefghijklmnopqrstuvwxyz!?@#$%^&-+*/=()_{}[]:;"|,.<>~`'\t the alphabet | 11163 ;; 0123456789abcdefghijklmnopqrstuvwxyz!?@#$%^&-+*/=()_{}[]:;"|,.<>~`'\t the alphabet |
11133 ;; abcd fgh j lmnopqrstuvwxyz ? #$ -+*/= [] ; |,.<>~ \t necessary bindings | 11164 ;; abcd fgh j lmnopqrstuvwxyz!? #$ -+*/= [] ; |,.<>~ \t necessary bindings |
11134 ;; e (?) useful from outline-mode | 11165 ;; e (?) useful from outline-mode |
11135 ;; i k @ expendable from outline-mode | 11166 ;; i k @ expendable from outline-mode |
11136 ;; 0123456789 ! %^& ()_{} " `' free | 11167 ;; 0123456789 %^& ()_{} " `' free |
11137 | 11168 |
11138 ;; Make `C-c C-x' a prefix key | 11169 ;; Make `C-c C-x' a prefix key |
11139 (define-key org-mode-map "\C-c\C-x" (make-sparse-keymap)) | 11170 (define-key org-mode-map "\C-c\C-x" (make-sparse-keymap)) |
11140 | 11171 |
11141 ;; TAB key with modifiers | 11172 ;; TAB key with modifiers |
12114 (run-hooks 'org-load-hook) | 12145 (run-hooks 'org-load-hook) |
12115 | 12146 |
12116 ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd | 12147 ;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd |
12117 ;;; org.el ends here | 12148 ;;; org.el ends here |
12118 | 12149 |
12150 | |
12151 (defun org-get-tags-at (&optional pos) | |
12152 "Get a list of all headline targs applicable at POS. | |
12153 POS defaults to point. If tags are inherited, the list contains | |
12154 the targets in the same sequence as the headlines appear, i.e. | |
12155 the tags of the current headline come last." | |
12156 (interactive) | |
12157 (let (tags) | |
12158 (save-excursion | |
12159 (goto-char (or pos (point))) | |
12160 (save-match-data | |
12161 (org-back-to-heading t) | |
12162 (condition-case nil | |
12163 (while t | |
12164 (if (looking-at "[^\r\n]+?:\\([a-zA-Z_:]+\\):[ \t]*\\([\n\r]\\|\\'\\)") | |
12165 (setq tags (append (org-split-string (match-string 1) ":") tags))) | |
12166 (or org-use-tag-inheritance (error "")) | |
12167 (org-up-heading-all 1)) | |
12168 (error nil)))) | |
12169 (message "%s" tags) | |
12170 tags)) | |
12171 |