comparison lisp/org/org-list.el @ 99849:621e15919df0

2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-dblock-write:clocktable): Make sure the clocktable sees the first line. (org-clock-in): Warn if the clock cannot be resumed. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-open-at-point): Fix mixup about interactive and non-interactive elisp links. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-preprocess-string): Allow one comment line before the first headline to always be included. This is to not miss a commented target. * org-mouse.el (org-mouse-insert-item): Call `org-indent-to-column' instead of `indent-to', for XEmacs compatibility. * org.el (org-refile-targets): Fix customize definition so that it works also in XEmacs. (org-fixup-indentation): Call `org-indent-to-column' instead of `indent-to', for XEmacs compatibility. 2008-11-23 Tokuya Kameshima <kames@fa2.so-net.ne.jp> * org-mew.el (org-mew-store-link): Get the correct case folder for refiled messages. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-export-as-ascii): Remove the "\\" forced line break indicators. * org.el (org-ido-completing-read): Remove the "i:" prefix for ido-completion propts. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-remember.el (org-remember-apply-template): Use `org-substring-no-properties'. * org-compat.el (org-substring-no-properties): New function. * org-remember.el (org-remember-apply-template): Use `org-substring-no-properties' for compatibility. * org-list.el (org-list-two-spaces-after-bullet-regexp): New option. (org-fix-bullet-type): respect `org-list-two-spaces-after-bullet-regexp'. * org-clock.el (org-clock-load): Clean up the code. * org.el (org-adaptive-fill-function): Allow two spaces after "1." as a list bullet. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-clock.el (org-clock-save, org-clock-load): Check for live buffers, existing files, and buffer file names to ensure consistent information. (org-clock-persist): Make `clock' a special value of this variable, and improve docstring. * org-list.el (org-cycle-list-bullet, org-fix-bullet-type) (org-get-string-indentation): Adapt indentation when the bullet width changes. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-remember.el (org-remember-finalize): Make interactive. (org-remember-kill): New command. (org-remember-finish-immediately): Call `org-remember-finalize' directly. (org-remember-finalize): Make `org-remember-finalize' an interactive function. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-remember.el (org-remember-apply-template): No ido completion for free prompts in remember templates. (org-remember-before-finalize-hook): New hook. (org-remember-mode): New minor mode. (org-remember-apply-template): Turn on `org-remember-mode'. * org-id.el (org-id-add-location): Avoid error when no file is given. * org-remember.el (org-remember-apply-template): Fix the way how the list of allowed properties is retrieved from the target file. * org.el (org-insert-link): Improve file link matching. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-colview.el (org-columns-display-here): New argument DATELINE, to trigger using the new face. (org-agenda-colview-summarize): Call `org-columns-display-here' with the new argument. * org-faces.el (org-agenda-column-dateline): New face. * org-publish.el (org-publish-org-index): Use index-title at page title, not as section. * org-exp.el (org-export-html-format-desc): Respect the org-protect property. (org-export-as-html): Protect image specifiers that are in the description part of a link. * org.el (org-sort-entries-or-items, org-completing-read) (org-refile-get-location, org-olpath-completing-read, org-todo) (org-show-todo-tree, org-sparse-tree, org-make-tags-matcher) (org-set-tags, org-change-tag-in-region, org-fast-tag-selection) (org-set-property, org-delete-property) (org-delete-property-globally): Use `org-ido-completing-read'. * org-remember.el (org-remember-apply-template): Use `org-ido-completing-read'. * org-publish.el (org-publish): Use `org-ido-completing-read'. * org-colview.el (org-columns-edit-value, org-columns-new) (org-insert-columns-dblock): Use `org-ido-completing-read'. * org-colview-xemacs.el (org-columns-edit-value) (org-columns-new, org-insert-columns-dblock): Use `org-ido-completing-read'. * org-attach.el (org-attach-delete-one, org-attach-open): Use `org-ido-completing-read'. * org-agenda.el (org-todo-list, org-agenda-filter-by-tag): Use `org-ido-completing-read'. * org.el (org-time-today): New function. (org-matcher-time): Use `org-time-today'. Add special treatment for "<tomorrow>" and "<yesterday>". (org-ido-completing-read): New function. (org-completion-use-ido): New option. * org-exp.el (org-export-format-source-code): Fix bug in require htmlize code. (org-export-target-internal-links): Fix bug in search for text property. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-export-latex.el (org-export-latex-subcontent): Interprete target aliases as additonal labels. * org-exp.el (org-export-target-aliases): New variable. (org-export-preprocess-string) (org-export-handle-invisible-targets): Fill the alias alist. (org-export-as-html): Remove the &nbsp; from the anchor, and also assign an id. (org-html-level-start): Insert the target aliases as additonal anchors. * org.el (org-edit-fixed-width-region): Fix bug when starting a new picture area. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-open-at-mouse): Ensure correct link abbreviations when following a link with the mouse from the agenda. * org-exp.el (org-export-as-html): Avoid lone </div> when no headlines are created. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org.el (org-link-translation-function): New option. (org-open-at-point): Call `org-link-translation-function' if non-nil. (org-translate-link): New function. (org-translate-link-from-planner): New function. (org-open-at-point): Allow interactive commands in elisp links. * org-exp.el (org-icalendar-cleanup-string): Restore the old iCalendar quoting. The new one seems to caus problems with applications. * org.el (org-yank): Set `this-command' to `yank', so that `yank-pop' will work. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-exp.el (org-icalendar-cleanup-string): Improve RFC2455 compliance as far as quoting is concerned. * org.el (org-link-expand-abbrev): Implement %h as an escape for a hexified version of the tag. * org-vm.el (org-vm-follow-link): Require `vm-search'. * org.el (org-up-heading-safe, org-forward-same-level): Always call `org-back-to-heading' instead of `outline-back-to-heading'. (org-back-to-heading): New wrapper around outline-back-to-heading, with a useful error message telling where the error happened. * org-list.el (org-update-checkbox-count): Always call `org-back-to-heading' instead of `outline-back-to-heading'. * org-exp.el (org-export-as-html): Make sure that each <img> tag has an `alt' attribute, to ensure XHTML validation. 2008-11-23 Carsten Dominik <carsten.dominik@gmail.com> * org-publish.el (org-publish-attachment): Allow publishing to overwrite attachment files. * org-agenda.el (org-agenda-timerange-leaders): New option. (org-agenda-get-blocks): Use `org-agenda-timerange-leaders'. * org.el (org-edit-src-exit): Untabify ASCII image before returning.
author Carsten Dominik <dominik@science.uva.nl>
date Sun, 23 Nov 2008 13:37:44 +0000
parents e3acb52d33e1
children 57447f70a253
comparison
equal deleted inserted replaced
99848:80e53e313ff5 99849:621e15919df0
4 ;; 4 ;;
5 ;; Author: Carsten Dominik <carsten at orgmode dot org> 5 ;; Author: Carsten Dominik <carsten at orgmode dot org>
6 ;; Bastien Guerry <bzg AT altern DOT org> 6 ;; Bastien Guerry <bzg AT altern DOT org>
7 ;; Keywords: outlines, hypermedia, calendar, wp 7 ;; Keywords: outlines, hypermedia, calendar, wp
8 ;; Homepage: http://orgmode.org 8 ;; Homepage: http://orgmode.org
9 ;; Version: 6.12a 9 ;; Version: 6.13
10 ;; 10 ;;
11 ;; This file is part of GNU Emacs. 11 ;; This file is part of GNU Emacs.
12 ;; 12 ;;
13 ;; GNU Emacs is free software: you can redistribute it and/or modify 13 ;; GNU Emacs is free software: you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by 14 ;; it under the terms of the GNU General Public License as published by
69 the safe choice." 69 the safe choice."
70 :group 'org-plain-lists 70 :group 'org-plain-lists
71 :type '(choice (const :tag "dot like in \"2.\"" ?.) 71 :type '(choice (const :tag "dot like in \"2.\"" ?.)
72 (const :tag "paren like in \"2)\"" ?\)) 72 (const :tag "paren like in \"2)\"" ?\))
73 (const :tab "both" t))) 73 (const :tab "both" t)))
74
75 (defcustom org-list-two-spaces-after-bullet-regexp nil
76 "A regular expression matching bullets that should have 2 spaces after them.
77 When nil, no bullet will have two spaces after them.
78 When a string, it will be used as a regular expression. When the bullet
79 type of a list is changed, the new bullet type will be matched against this
80 regexp. If it matches, there will be two spaces instead of one after
81 the bullet in each item of he list."
82 :group 'org-plain-list
83 :type '(choice
84 (const :tag "never" nil)
85 (regexp)))
74 86
75 (defcustom org-empty-line-terminates-plain-lists nil 87 (defcustom org-empty-line-terminates-plain-lists nil
76 "Non-nil means, an empty line ends all plain list levels. 88 "Non-nil means, an empty line ends all plain list levels.
77 When nil, empty lines are part of the preceeding item." 89 When nil, empty lines are part of the preceeding item."
78 :group 'org-plain-lists 90 :group 'org-plain-lists
257 the whole buffer." 269 the whole buffer."
258 (interactive "P") 270 (interactive "P")
259 (save-excursion 271 (save-excursion
260 (let* ((buffer-invisibility-spec (org-inhibit-invisibility)) ; Emacs 21 272 (let* ((buffer-invisibility-spec (org-inhibit-invisibility)) ; Emacs 21
261 (beg (condition-case nil 273 (beg (condition-case nil
262 (progn (outline-back-to-heading) (point)) 274 (progn (org-back-to-heading) (point))
263 (error (point-min)))) 275 (error (point-min))))
264 (end (move-marker (make-marker) 276 (end (move-marker (make-marker)
265 (progn (outline-next-heading) (point)))) 277 (progn (outline-next-heading) (point))))
266 (re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)") 278 (re "\\(\\(\\[[0-9]*%\\]\\)\\|\\(\\[[0-9]*/[0-9]*\\]\\)\\)")
267 (re-box "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)") 279 (re-box "^[ \t]*\\([-+*]\\|[0-9]+[.)]\\) +\\(\\[[- X]\\]\\)")
587 (org-beginning-of-item-list) 599 (org-beginning-of-item-list)
588 (org-at-item-p) 600 (org-at-item-p)
589 (beginning-of-line 1) 601 (beginning-of-line 1)
590 (let ((current (match-string 0)) 602 (let ((current (match-string 0))
591 (prevp (eq which 'previous)) 603 (prevp (eq which 'previous))
592 new) 604 new old)
593 (setq new (cond 605 (setq new (cond
594 ((and (numberp which) 606 ((and (numberp which)
595 (nth (1- which) '("-" "+" "*" "1." "1)")))) 607 (nth (1- which) '("-" "+" "*" "1." "1)"))))
596 ((string-match "-" current) (if prevp "1)" "+")) 608 ((string-match "-" current) (if prevp "1)" "+"))
597 ((string-match "\\+" current) 609 ((string-match "\\+" current)
598 (if prevp "-" (if (looking-at "\\S-") "1." "*"))) 610 (if prevp "-" (if (looking-at "\\S-") "1." "*")))
599 ((string-match "\\*" current) (if prevp "+" "1.")) 611 ((string-match "\\*" current) (if prevp "+" "1."))
600 ((string-match "\\." current) (if prevp "*" "1)")) 612 ((string-match "\\." current)
613 (if prevp (if (looking-at "\\S-") "+" "*") "1)"))
601 ((string-match ")" current) (if prevp "1." "-")) 614 ((string-match ")" current) (if prevp "1." "-"))
602 (t (error "This should not happen")))) 615 (t (error "This should not happen"))))
603 (and (looking-at "\\([ \t]*\\)\\S-+") (replace-match (concat "\\1" new))) 616 (and (looking-at "\\([ \t]*\\)\\(\\S-+\\)")
617 (setq old (match-string 2))
618 (replace-match (concat "\\1" new)))
619 (org-shift-item-indentation (- (length new) (length old)))
604 (org-fix-bullet-type) 620 (org-fix-bullet-type)
605 (org-maybe-renumber-ordered-list)))) 621 (org-maybe-renumber-ordered-list))))
606 622
607 (defun org-get-string-indentation (s) 623 (defun org-get-string-indentation (s)
608 "What indentation has S due to SPACE and TAB at the beginning of the string?" 624 "What indentation has S due to SPACE and TAB at the beginning of the string?"
627 (col (current-column)) 643 (col (current-column))
628 (ind (org-get-string-indentation 644 (ind (org-get-string-indentation
629 (buffer-substring (point-at-bol) (match-beginning 3)))) 645 (buffer-substring (point-at-bol) (match-beginning 3))))
630 ;; (term (substring (match-string 3) -1)) 646 ;; (term (substring (match-string 3) -1))
631 ind1 (n (1- arg)) 647 ind1 (n (1- arg))
632 fmt bobp) 648 fmt bobp old new)
633 ;; find where this list begins 649 ;; find where this list begins
634 (org-beginning-of-item-list) 650 (org-beginning-of-item-list)
635 (setq bobp (bobp)) 651 (setq bobp (bobp))
636 (looking-at "[ \t]*[0-9]+\\([.)]\\)") 652 (looking-at "[ \t]*[0-9]+\\([.)]\\)")
637 (setq fmt (concat "%d" (match-string 1))) 653 (setq fmt (concat "%d" (match-string 1)))
645 (if (looking-at "[ \t]*$") (throw 'next nil)) 661 (if (looking-at "[ \t]*$") (throw 'next nil))
646 (skip-chars-forward " \t") (setq ind1 (current-column)) 662 (skip-chars-forward " \t") (setq ind1 (current-column))
647 (if (> ind1 ind) (throw 'next t)) 663 (if (> ind1 ind) (throw 'next t))
648 (if (< ind1 ind) (throw 'exit t)) 664 (if (< ind1 ind) (throw 'exit t))
649 (if (not (org-at-item-p)) (throw 'exit nil)) 665 (if (not (org-at-item-p)) (throw 'exit nil))
666 (setq old (match-string 2))
650 (delete-region (match-beginning 2) (match-end 2)) 667 (delete-region (match-beginning 2) (match-end 2))
651 (goto-char (match-beginning 2)) 668 (goto-char (match-beginning 2))
652 (insert (format fmt (setq n (1+ n))))))) 669 (insert (setq new (format fmt (setq n (1+ n)))))
670 (org-shift-item-indentation (- (length new) (length old))))))
653 (goto-line line) 671 (goto-line line)
654 (org-move-to-column col))) 672 (org-move-to-column col)))
655 673
656 (defun org-fix-bullet-type () 674 (defun org-fix-bullet-type ()
657 "Make sure all items in this list have the same bullet as the firsst item." 675 "Make sure all items in this list have the same bullet as the first item.
676 Also, fix the indentation."
658 (interactive) 677 (interactive)
659 (unless (org-at-item-p) (error "This is not a list")) 678 (unless (org-at-item-p) (error "This is not a list"))
660 (let ((line (org-current-line)) 679 (let ((line (org-current-line))
661 (col (current-column)) 680 (col (current-column))
662 (ind (current-indentation)) 681 (ind (current-indentation))
663 ind1 bullet) 682 ind1 bullet oldbullet)
664 ;; find where this list begins 683 ;; find where this list begins
665 (org-beginning-of-item-list) 684 (org-beginning-of-item-list)
666 (beginning-of-line 1) 685 (beginning-of-line 1)
667 ;; find out what the bullet type is 686 ;; find out what the bullet type is
668 (looking-at "[ \t]*\\(\\S-+\\)") 687 (looking-at "[ \t]*\\(\\S-+\\)")
669 (setq bullet (match-string 1)) 688 (setq bullet (concat (match-string 1) " "))
689 (if (and org-list-two-spaces-after-bullet-regexp
690 (string-match org-list-two-spaces-after-bullet-regexp bullet))
691 (setq bullet (concat bullet " ")))
670 ;; walk forward and replace these numbers 692 ;; walk forward and replace these numbers
671 (beginning-of-line 0) 693 (beginning-of-line 0)
672 (catch 'exit 694 (catch 'exit
673 (while t 695 (while t
674 (catch 'next 696 (catch 'next
678 (skip-chars-forward " \t") (setq ind1 (current-column)) 700 (skip-chars-forward " \t") (setq ind1 (current-column))
679 (if (> ind1 ind) (throw 'next t)) 701 (if (> ind1 ind) (throw 'next t))
680 (if (< ind1 ind) (throw 'exit t)) 702 (if (< ind1 ind) (throw 'exit t))
681 (if (not (org-at-item-p)) (throw 'exit nil)) 703 (if (not (org-at-item-p)) (throw 'exit nil))
682 (skip-chars-forward " \t") 704 (skip-chars-forward " \t")
683 (looking-at "\\S-+") 705 (looking-at "\\S-+ *")
684 (replace-match bullet)))) 706 (setq oldbullet (match-string 0))
707 (replace-match bullet)
708 (org-shift-item-indentation (- (length bullet) (length oldbullet))))))
685 (goto-line line) 709 (goto-line line)
686 (org-move-to-column col) 710 (org-move-to-column col)
687 (if (string-match "[0-9]" bullet) 711 (if (string-match "[0-9]" bullet)
688 (org-renumber-ordered-list 1)))) 712 (org-renumber-ordered-list 1))))
713
714 (defun org-shift-item-indentation (delta)
715 "Shift the indentation in current item by DELTA."
716 (save-excursion
717 (let ((beg (point-at-bol))
718 (end (progn (org-end-of-item) (point)))
719 i)
720 (goto-char end)
721 (beginning-of-line 0)
722 (while (> (point) beg)
723 (when (looking-at "[ \t]*\\S-")
724 ;; this is not an empty line
725 (setq i (org-get-indentation))
726 (if (and (> i 0) (> (setq i (+ i delta)) 0))
727 (indent-line-to i)))
728 (beginning-of-line 0)))))
689 729
690 (defun org-beginning-of-item-list () 730 (defun org-beginning-of-item-list ()
691 "Go to the beginning of the current item list. 731 "Go to the beginning of the current item list.
692 I.e. to the first item in this list." 732 I.e. to the first item in this list."
693 (interactive) 733 (interactive)