From 8a28a5b8d8acb314d8850b85fe5cd956a86e8ff9 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 28 Feb 2013 01:31:26 +0100 Subject: [PATCH] Merge latest Org fixes (commit 7524ef2). --- doc/misc/ChangeLog | 7 + doc/misc/org.texi | 14 +- lisp/org/ChangeLog | 74 +++++++++++ lisp/org/ob-tangle.el | 9 ++ lisp/org/org-agenda.el | 271 +-------------------------------------- lisp/org/org-clock.el | 6 - lisp/org/org-datetree.el | 2 +- lisp/org/org-docview.el | 2 +- lisp/org/org-id.el | 10 +- lisp/org/org-indent.el | 2 +- lisp/org/org-macs.el | 3 +- lisp/org/org-mobile.el | 2 +- lisp/org/org-version.el | 4 +- lisp/org/org.el | 152 +++++++++++++--------- 14 files changed, 207 insertions(+), 351 deletions(-) diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index fab7a301094..f777696eff2 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,10 @@ +2013-02-28 Bastien Guerry + + * org.texi (Visibility cycling): Suggest to set + `org-agenda-inhibit-startup' to nil if user wants the startup + visibility settings to be honored in any circumstances. + (Progress logging, Checkboxes): Fix typos. + 2013-02-25 Michael Albinus * tramp.texi (top) [xxx, yyy, trampfn]: Provide two versions of diff --git a/doc/misc/org.texi b/doc/misc/org.texi index 16015e49362..89607e7eea6 100644 --- a/doc/misc/org.texi +++ b/doc/misc/org.texi @@ -2,7 +2,8 @@ @c %**start of header @setfilename ../../info/org @settitle The Org Manual -@set VERSION 7.9.3e (GNU Emacs 24.3) + +@include org-version.inc @c Use proper quote and backtick for code sections in PDF output @c Cf. Texinfo manual 14.2 @@ -1296,6 +1297,7 @@ Copy the @i{visible} text in the region into the kill ring. @end table @vindex org-startup-folded +@vindex org-agenda-inhibit-startup @cindex @code{overview}, STARTUP keyword @cindex @code{content}, STARTUP keyword @cindex @code{showall}, STARTUP keyword @@ -1314,6 +1316,10 @@ buffer: #+STARTUP: showeverything @end example +The startup visibility options are ignored when the file is open for the +first time during the agenda generation: if you want the agenda to honor +the startup visibility, set @code{org-agenda-inhibit-startup} to nil. + @cindex property, VISIBILITY @noindent Furthermore, any entries with a @samp{VISIBILITY} property (@pxref{Properties @@ -2439,7 +2445,7 @@ You may reference a rectangular range of fields by specifying two field references connected by two dots @samp{..}. If both fields are in the current row, you may simply use @samp{$2..$7}, but if at least one field is in a different row, you need to use the general @code{@@row$column} -format at least for the first field (i.e., the reference must start with +format at least for the first field (i.e the reference must start with @samp{@@} in order to be interpreted correctly). Examples: @example @@ -4075,7 +4081,7 @@ module @file{org-depend.el}. Org mode can automatically record a timestamp and possibly a note when you mark a TODO item as DONE, or even each time you change the state of -a TODO item. This system is highly configurable, settings can be on a +a TODO item. This system is highly configurable; settings can be on a per-keyword basis and can be localized to a file or even a subtree. For information on how to clock working time for a task, see @ref{Clocking work time}. @@ -4431,7 +4437,7 @@ lists. But you can allow it by modifying @code{org-list-automatic-rules} accordingly.} (@pxref{Plain lists}) can be made into a checkbox by starting it with the string @samp{[ ]}. This feature is similar to TODO items (@pxref{TODO Items}), but is more lightweight. Checkboxes are not included -into the global TODO list, so they are often great to split a task into a +in the global TODO list, so they are often great to split a task into a number of simple steps. Or you can use them in a shopping list. To toggle a checkbox, use @kbd{C-c C-c}, or use the mouse (thanks to Piotr Zielinski's @file{org-mouse.el}). diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog index 03a0560fea8..e6b1e564de3 100644 --- a/lisp/org/ChangeLog +++ b/lisp/org/ChangeLog @@ -1,3 +1,77 @@ +2013-02-28 Achim Gratz + + * org.el (org-org-menu): Use correct key "C-u C-c C-x !" to do + org-reload uncompiled in the menu. + +2013-02-28 Bastien Guerry + + * org-indent.el + (org-indent-add-properties): Bugfix: prevent negative value for + `added-ind-per-lvl'. + + * org.el (org-mode): Add `org-fix-ellipsis-at-bol' to + `isearch-mode-end-hook' so that any isearch fixes the problem with + ellipsis on the first line. + (org-fix-ellipsis-at-bol): New defsubst. + (org-show-context, org-isearch-end): Use it. + + * org.el (org-show-context): Remove useless catch. Make sure the + top of the window is a visible headline. + (org-activate-plain-links): Remove unused catch. + + * org-macs.el (org-get-alist-option): Return nil, not (nil), so + that `org-show-context' DTRT. + + * org.el (org-imenu-get-tree): Fix bug when matching against empty + headlines. + + * org.el (org-overview): Stay on current line. + (org-map-entries): Fix docstring. + (org-at-clock-log-p): Delete. + + * org-clock.el (org-at-clock-log-p): Move here. + + * org.el (org-tsr-regexp-both): Don't activate dates in links. + (org-activate-dates): Change match boundaries according to the new + value of `org-tsr-regexp-both'. + + * org-agenda.el (org-agenda-to-appt): Fix typos. + + * org-agenda.el (org-agenda-local-vars): Don't include + `org-agenda-show-window' as it needs to be checked outside of the + agenda window. + + * org.el (org-set-tags-command): Fix bug when setting tags for + multiple headlines in an active region. + + * org-mobile.el (org-mobile-edit): DTRT when inserting a heading + in an invisible region. + + * org.el (org-insert-heading-respect-content): New `invisible-ok' + parameter. Add docstring. + (org-insert-todo-heading-respect-content): Add docstring. + + * ob-tangle.el (org-babel-tangle-collect-blocks): Bugfix: remove + code references from blocks. + + * org-agenda.el (org-agenda-schedule, org-agenda-deadline): + Cosmetic changes. + (org-agenda-show-new-time): Fix bug when displaying a temporary + overlay with the scheduled/deadline information. + + * org.el (org-fill-paragraph-with-timestamp-nobreak-p): New + function. + (org-setup-filling): Use it to prevent breaking a timestamp when + filling a paragraph. + + * org-id.el (org-id-get-with-outline-path-completion): Fix + docstring. + +2013-02-28 Tim Burt (tiny change) + + * org-datetree.el (org-datetree-find-year-create): Match headlines + with tags. + 2013-02-07 Bastien Guerry * org-agenda.el (org-agenda-get-deadlines) diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el index 89457f19141..c3b6a483ee6 100644 --- a/lisp/org/ob-tangle.el +++ b/lisp/org/ob-tangle.el @@ -371,6 +371,10 @@ code blocks by language." (unless (and language (not (string= language src-lang))) (let* ((info (org-babel-get-src-block-info)) (params (nth 2 info)) + (extra (nth 3 info)) + (cref-fmt (or (and (string-match "-l \"\\(.+\\)\"" extra) + (match-string 1 extra)) + org-coderef-label-format)) (link ((lambda (link) (and (string-match org-bracket-link-regexp link) (match-string 1 link))) @@ -388,6 +392,11 @@ code blocks by language." ((lambda (body) ;; run the tangle-body-hook (with-temp-buffer (insert body) + (when (string-match "-r" extra) + (goto-char (point-min)) + (while (re-search-forward + (replace-regexp-in-string "%s" ".+" cref-fmt) nil t) + (replace-match ""))) (run-hooks 'org-babel-tangle-body-hook) (buffer-string))) ((lambda (body) ;; expand the body in language specific manner diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el index 9b6dcaed8c2..79217b6a6e6 100644 --- a/lisp/org/org-agenda.el +++ b/lisp/org/org-agenda.el @@ -1934,11 +1934,6 @@ When nil, `q' will kill the single agenda buffer." (message "Sticky agenda was %s" (if org-agenda-sticky "enabled" "disabled")))))) -(autoload 'org-toggle-sticky-agenda "org-agenda" "\ -Toggle `org-agenda-sticky'. - -\(fn &optional ARG)" t nil) - (defvar org-agenda-buffer nil "Agenda buffer currently being generated.") @@ -1971,7 +1966,6 @@ Toggle `org-agenda-sticky'. org-agenda-last-search-view-search-was-boolean org-agenda-filtered-by-category org-agenda-filter-form - org-agenda-show-window org-agenda-cycle-counter org-agenda-last-prefix-arg) "Variables that must be local in agenda buffers to allow multiple buffers.") @@ -2615,43 +2609,6 @@ Pressing `<' twice means to restrict to the current subtree or region ((equal org-keys "!") (customize-variable 'org-stuck-projects)) (t (error "Invalid agenda key")))))) -(autoload 'org-agenda "org-agenda" "\ -Dispatch agenda commands to collect entries to the agenda buffer. -Prompts for a command to execute. Any prefix arg will be passed -on to the selected command. The default selections are: - -a Call `org-agenda-list' to display the agenda for current day or week. -t Call `org-todo-list' to display the global todo list. -T Call `org-todo-list' to display the global todo list, select only - entries with a specific TODO keyword (the user gets a prompt). -m Call `org-tags-view' to display headlines with tags matching - a condition (the user is prompted for the condition). -M Like `m', but select only TODO entries, no ordinary headlines. -L Create a timeline for the current buffer. -e Export views to associated files. -s Search entries for keywords. -S Search entries for keywords, only with TODO keywords. -/ Multi occur across all agenda files and also files listed - in `org-agenda-text-search-extra-files'. -< Restrict agenda commands to buffer, subtree, or region. - Press several times to get the desired effect. -> Remove a previous restriction. -# List \"stuck\" projects. -! Configure what \"stuck\" means. -C Configure custom agenda commands. - -More commands can be added by configuring the variable -`org-agenda-custom-commands'. In particular, specific tags and TODO keyword -searches can be pre-defined in this way. - -If the current buffer is in Org-mode and visiting a file, you can also -first press `<' once to indicate that the agenda should be temporarily -\(until the next use of \\[org-agenda]) restricted to the current file. -Pressing `<' twice means to restrict to the current subtree or region -\(if active). - -\(fn &optional ARG ORG-KEYS RESTRICTION)" t nil) - (defun org-agenda-append-agenda () "Append another agenda view to the current one. This function allows interactive building of block agendas. @@ -2947,17 +2904,6 @@ before running the agenda command." (set-buffer org-agenda-buffer-name) (princ (buffer-string))) -(autoload 'org-batch-agenda "org-agenda" "\ -Run an agenda command in batch mode and send the result to STDOUT. -If CMD-KEY is a string of length 1, it is used as a key in -`org-agenda-custom-commands' and triggers this command. If it is a -longer string it is used as a tags/todo match string. -Parameters are alternating variable names and values that will be bound -before running the agenda command. - -\(fn CMD-KEY &rest PARAMETERS)" nil t) -(def-edebug-spec org-batch-agenda (form &rest sexp)) - (defvar org-agenda-info nil) ;;;###autoload @@ -3015,44 +2961,6 @@ agenda-day The day in the agenda where this is listed" ",")) (princ "\n"))))) -(autoload 'org-batch-agenda-csv "org-agenda" "\ -Run an agenda command in batch mode and send the result to STDOUT. -If CMD-KEY is a string of length 1, it is used as a key in -`org-agenda-custom-commands' and triggers this command. If it is a -longer string it is used as a tags/todo match string. -Parameters are alternating variable names and values that will be bound -before running the agenda command. - -The output gives a line for each selected agenda item. Each -item is a list of comma-separated values, like this: - -category,head,type,todo,tags,date,time,extra,priority-l,priority-n - -category The category of the item -head The headline, without TODO kwd, TAGS and PRIORITY -type The type of the agenda entry, can be - todo selected in TODO match - tagsmatch selected in tags match - diary imported from diary - deadline a deadline on given date - scheduled scheduled on given date - timestamp entry has timestamp on given date - closed entry was closed on given date - upcoming-deadline warning about deadline - past-scheduled forwarded scheduled item - block entry has date block including g. date -todo The todo keyword, if any -tags All tags including inherited ones, separated by colons -date The relevant date, like 2007-2-14 -time The time, like 15:00-16:50 -extra Sting with extra planning info -priority-l The priority letter if any was given -priority-n The computed numerical priority -agenda-day The day in the agenda where this is listed - -\(fn CMD-KEY &rest PARAMETERS)" nil t) -(def-edebug-spec org-batch-agenda-csv (form &rest sexp)) - (defun org-fix-agenda-info (props) "Make sure all properties on an agenda item have a canonical form. This ensures the export commands can easily use it." @@ -3100,11 +3008,6 @@ This ensures the export commands can easily use it." (interactive) (eval (list 'org-batch-store-agenda-views))) -(autoload 'org-store-agenda-views "org-agenda" "\ - - -\(fn &rest PARAMETERS)" t nil) - ;;;###autoload (defmacro org-batch-store-agenda-views (&rest parameters) "Run all custom agenda commands that have a file argument." @@ -3140,12 +3043,6 @@ This ensures the export commands can easily use it." (and (get-buffer bufname) (kill-buffer bufname))))))) -(autoload 'org-batch-store-agenda-views "org-agenda" "\ -Run all custom agenda commands that have a file argument. - -\(fn &rest PARAMETERS)" nil t) -(def-edebug-spec org-batch-store-agenda-views (&rest sexp)) - (defvar org-agenda-current-span nil "The current span used in the agenda view.") ; local variable in the agenda buffer (defun org-agenda-mark-header-line (pos) @@ -4204,20 +4101,6 @@ given in `org-agenda-start-on-weekday'." (setq buffer-read-only t) (message "")))) -(autoload 'org-agenda-list "org-agenda" "\ -Produce a daily/weekly view from all files in variable `org-agenda-files'. -The view will be for the current day or week, but from the overview buffer -you will be able to go to other days/weeks. - -With a numeric prefix argument in an interactive call, the agenda will -span ARG days. Lisp programs should instead specify SPAN to change -the number of days. SPAN defaults to `org-agenda-span'. - -START-DAY defaults to TODAY, or to the most recent match for the weekday -given in `org-agenda-start-on-weekday'. - -\(fn &optional ARG START-DAY SPAN)" t nil) - (defun org-agenda-ndays-to-span (n) "Return a span symbol for a span of N days, or N if none matches." (cond ((symbolp n) n) @@ -4527,52 +4410,6 @@ in `org-agenda-text-search-extra-files'." (org-agenda-finalize) (setq buffer-read-only t)))) -(autoload 'org-search-view "org-agenda" "\ -Show all entries that contain a phrase or words or regular expressions. - -With optional prefix argument TODO-ONLY, only consider entries that are -TODO entries. The argument STRING can be used to pass a default search -string into this function. If EDIT-AT is non-nil, it means that the -user should get a chance to edit this string, with cursor at position -EDIT-AT. - -The search string can be viewed either as a phrase that should be found as -is, or it can be broken into a number of snippets, each of which must match -in a Boolean way to select an entry. The default depends on the variable -`org-agenda-search-view-always-boolean'. -Even if this is turned off (the default) you can always switch to -Boolean search dynamically by preceding the first word with \"+\" or \"-\". - -The default is a direct search of the whole phrase, where each space in -the search string can expand to an arbitrary amount of whitespace, -including newlines. - -If using a Boolean search, the search string is split on whitespace and -each snippet is searched separately, with logical AND to select an entry. -Words prefixed with a minus must *not* occur in the entry. Words without -a prefix or prefixed with a plus must occur in the entry. Matching is -case-insensitive. Words are enclosed by word delimiters (i.e. they must -match whole words, not parts of a word) if -`org-agenda-search-view-force-full-words' is set (default is nil). - -Boolean search snippets enclosed by curly braces are interpreted as -regular expressions that must or (when preceded with \"-\") must not -match in the entry. Snippets enclosed into double quotes will be taken -as a whole, to include whitespace. - -- If the search string starts with an asterisk, search only in headlines. -- If (possibly after the leading star) the search string starts with an - exclamation mark, this also means to look at TODO entries only, an effect - that can also be achieved with a prefix argument. -- If (possibly after star and exclamation mark) the search string starts - with a colon, this will mean that the (non-regexp) snippets of the - Boolean search must match as full words. - -This command searches the agenda files, and in addition the files listed -in `org-agenda-text-search-extra-files'. - -\(fn &optional TODO-ONLY STRING EDIT-AT)" t nil) - ;;; Agenda TODO list (defvar org-select-this-todo-keyword nil) @@ -4663,15 +4500,6 @@ for a keyword. A numeric prefix directly selects the Nth keyword in (org-agenda-finalize) (setq buffer-read-only t)))) -(autoload 'org-todo-list "org-agenda" "\ -Show all (not done) TODO entries from all agenda file in a single list. -The prefix arg can be used to select a specific TODO keyword and limit -the list to these. When using \\[universal-argument], you will be prompted -for a keyword. A numeric prefix directly selects the Nth keyword in -`org-todo-keywords-1'. - -\(fn &optional ARG)" t nil) - ;;; Agenda tags match ;;;###autoload @@ -4757,12 +4585,6 @@ The prefix arg TODO-ONLY limits the search to TODO entries." (org-agenda-finalize) (setq buffer-read-only t)))) -(autoload 'org-tags-view "org-agenda" "\ -Show all headlines for all `org-agenda-files' matching a TAGS criterion. -The prefix arg TODO-ONLY limits the search to TODO entries. - -\(fn &optional TODO-ONLY MATCH)" t nil) - ;;; Agenda Finding stuck projects (defvar org-agenda-skip-regexp nil @@ -4991,14 +4813,6 @@ of what a project is and how to check if it stuck, customize the variable (setq org-agenda-redo-command `(org-agenda-list-stuck-projects ,current-prefix-arg))))) -(autoload 'org-agenda-list-stuck-projects "org-agenda" "\ -Create agenda view for projects that are stuck. -Stuck projects are project that have no next actions. For the definitions -of what a project is and how to check if it stuck, customize the variable -`org-stuck-projects'. - -\(fn &rest IGNORE)" t nil) - ;;; Diary integration (defvar org-disable-agenda-to-diary nil) ;Dynamically-scoped param. @@ -5177,35 +4991,6 @@ function from a program - use `org-agenda-get-day-entries' instead." (if results (concat (org-agenda-finalize-entries results) "\n")))) -(autoload 'org-diary "org-agenda" "\ -Return diary information from org files. -This function can be used in a \"sexp\" diary entry in the Emacs calendar. -It accesses org files and extracts information from those files to be -listed in the diary. The function accepts arguments specifying what -items should be listed. For a list of arguments allowed here, see the -variable `org-agenda-entry-types'. - -The call in the diary file should look like this: - - &%%(org-diary) ~/path/to/some/orgfile.org - -Use a separate line for each org file to check. Or, if you omit the file name, -all files listed in `org-agenda-files' will be checked automatically: - - &%%(org-diary) - -If you don't give any arguments (as in the example above), the default -arguments (:deadline :scheduled :timestamp :sexp) are used. -So the example above may also be written as - - &%%(org-diary :deadline :timestamp :sexp :scheduled) - -The function expects the lisp variables `entry' and `date' to be provided -by the caller, because this is how the calendar works. Don't use this -function from a program - use `org-agenda-get-day-entries' instead. - -\(fn &rest ARGS)" nil nil) - ;;; Agenda entry finders (defun org-agenda-get-day-entries (file date &rest args) @@ -5401,11 +5186,6 @@ This function is invoked if `org-agenda-todo-ignore-deadlines', (match-string 1) org-agenda-todo-ignore-timestamp)) (t)))))))))) -(autoload 'org-agenda-check-for-timestamp-as-reason-to-ignore-todo-item "org-agenda" "\ -Do we have a reason to ignore this TODO entry because it has a time stamp? - -\(fn &optional END)" nil nil) - (defun org-agenda-get-timestamps (&optional deadline-results) "Return the date stamp information for agenda display." (let* ((props (list 'face 'org-agenda-calendar-event @@ -8686,9 +8466,8 @@ Called with a universal prefix arg, show the priority instead of setting it." (defun org-agenda-show-new-time (marker stamp &optional prefix) "Show new date stamp via text properties." ;; We use text properties to make this undoable - (let ((inhibit-read-only t) - (buffer-invisibility-spec)) - (setq stamp (concat " " prefix " => " stamp)) + (let ((inhibit-read-only t)) + (setq stamp (concat prefix " => " stamp " ")) (save-excursion (goto-char (point-max)) (while (not (bobp)) @@ -8750,7 +8529,7 @@ ARG is passed through to `org-schedule'." (widen) (goto-char pos) (setq ts (org-schedule arg time))) - (org-agenda-show-new-time marker ts "S")) + (org-agenda-show-new-time marker ts " S")) (message "%s" ts))) (defun org-agenda-deadline (arg &optional time) @@ -8770,7 +8549,7 @@ ARG is passed through to `org-deadline'." (widen) (goto-char pos) (setq ts (org-deadline arg time))) - (org-agenda-show-new-time marker ts "D")) + (org-agenda-show-new-time marker ts " D")) (message "%s" ts))) (defun org-agenda-clock-in (&optional arg) @@ -9131,12 +8910,6 @@ This is a command that has to be installed in `calendar-mode-map'." (calendar-cursor-to-date)) nil)) -(autoload 'org-calendar-goto-agenda "org-agenda" "\ -Compute the Org-mode agenda for the calendar date displayed at the cursor. -This is a command that has to be installed in `calendar-mode-map'. - -\(fn)" t nil) - (defun org-agenda-convert-date () (interactive) (org-agenda-check-type t 'agenda 'timeline) @@ -9519,7 +9292,7 @@ By default `org-agenda-to-appt' will use :deadline, :scheduled and :timestamp entries. See the docstring of `org-diary' for details and examples. -If an entry as a APPT_WARNTIME property, its value will be used +If an entry has a APPT_WARNTIME property, its value will be used to override `appt-message-warning-time'." (interactive "P") (if refresh (setq appt-time-msg-list nil)) @@ -9579,40 +9352,6 @@ to override `appt-message-warning-time'." (message "No event to add") (message "Added %d event%s for today" cnt (if (> cnt 1) "s" ""))))) -(autoload 'org-agenda-to-appt "org-agenda" "\ -Activate appointments found in `org-agenda-files'. -With a \\[universal-argument] prefix, refresh the list of -appointments. - -If FILTER is t, interactively prompt the user for a regular -expression, and filter out entries that don't match it. - -If FILTER is a string, use this string as a regular expression -for filtering entries out. - -If FILTER is a function, filter out entries against which -calling the function returns nil. This function takes one -argument: an entry from `org-agenda-get-day-entries'. - -FILTER can also be an alist with the car of each cell being -either 'headline or 'category. For example: - - '((headline \"IMPORTANT\") - (category \"Work\")) - -will only add headlines containing IMPORTANT or headlines -belonging to the \"Work\" category. - -ARGS are symbols indicating what kind of entries to consider. -By default `org-agenda-to-appt' will use :deadline, :scheduled -and :timestamp entries. See the docstring of `org-diary' for -details and examples. - -If an entry as a APPT_WARNTIME property, its value will be used -to override `appt-message-warning-time'. - -\(fn &optional REFRESH FILTER &rest ARGS)" t nil) - (defun org-agenda-todayp (date) "Does DATE mean today, when considering `org-extend-today-until'?" (let ((today (org-today)) diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el index bc0c431ddd3..a536d025c04 100644 --- a/lisp/org/org-clock.el +++ b/lisp/org/org-clock.el @@ -1545,12 +1545,6 @@ to, overriding the existing value of `org-clock-out-switch-to-state'." (org-remove-empty-drawer-at clock-drawer (point)) (forward-line 1)))))) -(defun org-at-clock-log-p nil - "Is the cursor on the clock log line?" - (save-excursion - (move-beginning-of-line 1) - (looking-at "^[ \t]*CLOCK:"))) - (defun org-clock-timestamps-up nil "Increase CLOCK timestamps at cursor." (interactive) diff --git a/lisp/org/org-datetree.el b/lisp/org/org-datetree.el index f2e35fa2dfd..e0f4d10bc2d 100644 --- a/lisp/org/org-datetree.el +++ b/lisp/org/org-datetree.el @@ -72,7 +72,7 @@ tree can be found." (goto-char (prog1 (point) (widen)))))) (defun org-datetree-find-year-create (year) - (let ((re "^\\*+[ \t]+\\([12][0-9][0-9][0-9]\\)\\s-*$") + (let ((re "^\\*+[ \t]+\\([12][0-9]\\{3\\}\\)\\(.*?\\([ \t]:[[:alnum:]:_@#%]+:\\)?\\s-*$\\)") match) (goto-char (point-min)) (while (and (setq match (re-search-forward re nil t)) diff --git a/lisp/org/org-docview.el b/lisp/org/org-docview.el index 64c215d8db5..be99ad99a69 100644 --- a/lisp/org/org-docview.el +++ b/lisp/org/org-docview.el @@ -49,7 +49,7 @@ (declare-function image-mode-window-get "ext:image-mode" (prop &optional winprops)) -(autoload 'doc-view-goto-page "doc-view") +(org-autoload "doc-view" '(doc-view-goto-page)) (org-add-link-type "docview" 'org-docview-open) (add-hook 'org-store-link-functions 'org-docview-store-link) diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el index 6e865b50c2c..ecf67f72f3a 100644 --- a/lisp/org/org-id.el +++ b/lisp/org/org-id.el @@ -259,11 +259,11 @@ In any case, the ID of the entry is returned." id))))) (defun org-id-get-with-outline-path-completion (&optional targets) - "Use outline-path-completion to retrieve the ID of an entry. -TARGETS may be a setting for `org-refile-targets' to define the eligible -headlines. When omitted, all headlines in all agenda files are -eligible. -It returns the ID of the entry. If necessary, the ID is created." + "Use `outline-path-completion' to retrieve the ID of an entry. +TARGETS may be a setting for `org-refile-targets' to define +eligible headlines. When omitted, all headlines in the current +file are eligible. This function returns the ID of the entry. +If necessary, the ID is created." (let* ((org-refile-targets (or targets '((nil . (:maxlevel . 10))))) (org-refile-use-outline-path (if (caar org-refile-targets) 'file t)) diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el index d5f17b2cb69..6e6f2bf1589 100644 --- a/lisp/org/org-indent.el +++ b/lisp/org/org-indent.el @@ -328,7 +328,7 @@ stopped." ;; inline task or not. (let* ((case-fold-search t) (limited-re (org-get-limited-outline-regexp)) - (added-ind-per-lvl (1- org-indent-indentation-per-level)) + (added-ind-per-lvl (abs (1- org-indent-indentation-per-level))) (pf (save-excursion (and (ignore-errors (let ((outline-regexp limited-re)) (org-back-to-heading t))) diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el index ceee30601bd..57b2d8a577e 100644 --- a/lisp/org/org-macs.el +++ b/lisp/org/org-macs.el @@ -263,7 +263,8 @@ in `org-rm-props'." (cond ((eq key t) t) ((eq option t) t) ((assoc key option) (cdr (assoc key option))) - (t (cdr (assq 'default option))))) + (t (let ((r (cdr (assq 'default option)))) + (if (listp r) (delq nil r) r))))) (defsubst org-check-external-command (cmd &optional use no-error) "Check if external program CMD for USE exists, error if not. diff --git a/lisp/org/org-mobile.el b/lisp/org/org-mobile.el index a410de0d775..293d2a000c0 100644 --- a/lisp/org/org-mobile.el +++ b/lisp/org/org-mobile.el @@ -1064,7 +1064,7 @@ be returned that indicates what went wrong." (if (org-on-heading-p) ; if false we are in top-level of file (progn (end-of-line 1) - (org-insert-heading-respect-content) + (org-insert-heading-respect-content t) (org-demote)) (beginning-of-line) (insert "* ")) diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el index 1910d3f7b4f..4fa865308e9 100644 --- a/lisp/org/org-version.el +++ b/lisp/org/org-version.el @@ -5,13 +5,13 @@ (defun org-release () "The release version of org-mode. Inserted by installing org-mode or when a release is made." - (let ((org-release "7.9.3e")) + (let ((org-release "7.9.3f")) org-release)) ;;;###autoload (defun org-git-version () "The Git version of org-mode. Inserted by installing org-mode or when a release is made." - (let ((org-git-version "7.9.3e-3-gb07a9b")) + (let ((org-git-version "release_7.9.3f-17-g7524ef")) org-git-version)) ;;;###autoload (defvar org-odt-data-dir "/usr/share/emacs/etc/org" diff --git a/lisp/org/org.el b/lisp/org/org.el index ede633a0a93..cc4c93f22eb 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -114,7 +114,6 @@ Stars are put in group 1 and the trimmed body in group 2.") (declare-function org-inlinetask-outline-regexp "org-inlinetask" ()) (declare-function org-inlinetask-toggle-visibility "org-inlinetask" ()) (declare-function org-pop-to-buffer-same-window "org-compat" (&optional buffer-or-name norecord label)) -(declare-function org-at-clock-log-p "org-clock" ()) (declare-function org-clock-timestamps-up "org-clock" ()) (declare-function org-clock-timestamps-down "org-clock" ()) (declare-function org-clock-sum-current-item "org-clock" (&optional tstart)) @@ -467,7 +466,11 @@ the following lines anywhere in the buffer: #+STARTUP: fold (or `overview', this is equivalent) #+STARTUP: nofold (or `showall', this is equivalent) #+STARTUP: content - #+STARTUP: showeverything" + #+STARTUP: showeverything + +By default, this option is ignored when Org opens agenda files +for the first time. If you want the agenda to honor the startup +option, set `org-agenda-inhibit-startup' to nil." :group 'org-startup :type '(choice (const :tag "nofold: show all" nil) @@ -3913,6 +3916,7 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables." (save-excursion (goto-char (org-table-begin 'any)) (looking-at org-table1-hline-regexp)))) + (defun org-table-recognize-table.el () "If there is a table.el table nearby, recognize it and move into it." (if org-table-tab-recognizes-table.el @@ -3948,7 +3952,6 @@ If TABLE-TYPE is non-nil, also check for table.el-type tables." nil)) (defvar org-table-clean-did-remove-column nil) - (defun org-table-map-tables (function &optional quietly) "Apply FUNCTION to the start of all tables in the buffer." (save-excursion @@ -4969,7 +4972,8 @@ The following commands are available: (org-add-hook 'isearch-mode-end-hook 'org-isearch-end 'append 'local) ;; Emacs 22 deals with this through a special variable (org-set-local 'outline-isearch-open-invisible-function - (lambda (&rest ignore) (org-show-context 'isearch)))) + (lambda (&rest ignore) (org-show-context 'isearch))) + (org-add-hook 'isearch-mode-end-hook 'org-fix-ellipsis-at-bol 'append 'local)) ;; Setup the pcomplete hooks (set (make-local-variable 'pcomplete-command-completion-function) @@ -5008,6 +5012,8 @@ The following commands are available: (put 'org-mode 'flyspell-mode-predicate 'org-mode-flyspell-verify) +(defsubst org-fix-ellipsis-at-bol () + (save-excursion (goto-char (window-start)) (recenter 0))) (defun org-find-invisible-foreground () (let ((candidates (remove @@ -5205,8 +5211,9 @@ on a string that terminates immediately after the date.") (defconst org-tsr-regexp (concat org-ts-regexp "\\(--?-?" org-ts-regexp "\\)?") "Regular expression matching a time stamp or time stamp range.") -(defconst org-tsr-regexp-both (concat org-ts-regexp-both "\\(--?-?" - org-ts-regexp-both "\\)?") +(defconst org-tsr-regexp-both + (concat org-ts-regexp-both "\\(--?-?" + org-ts-regexp-both "\\)?") "Regular expression matching a time stamp or time stamp range. The time stamps may be either active or inactive.") @@ -5298,21 +5305,20 @@ will be prompted for." (defun org-activate-plain-links (limit) "Run through the buffer and add overlays to links." - (catch 'exit - (let (f) - (when (and (re-search-forward (concat org-plain-link-re) limit t) - (not (org-in-src-block-p))) - (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) - (setq f (get-text-property (match-beginning 0) 'face)) - (unless (or (org-in-src-block-p) - (eq f 'org-tag) - (and (listp f) (memq 'org-tag f))) - (add-text-properties (match-beginning 0) (match-end 0) - (list 'mouse-face 'highlight - 'face 'org-link - 'keymap org-mouse-map)) - (org-rear-nonsticky-at (match-end 0))) - t)))) + (let (f) + (when (and (re-search-forward (concat org-plain-link-re) limit t) + (not (org-in-src-block-p))) + (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) + (setq f (get-text-property (match-beginning 0) 'face)) + (unless (or (org-in-src-block-p) + (eq f 'org-tag) + (and (listp f) (memq 'org-tag f))) + (add-text-properties (match-beginning 0) (match-end 0) + (list 'mouse-face 'highlight + 'face 'org-link + 'keymap org-mouse-map)) + (org-rear-nonsticky-at (match-end 0))) + t))) (defun org-activate-code (limit) (if (re-search-forward "^[ \t]*\\(:\\(?: .*\\|$\\)\n?\\)" limit t) @@ -5510,7 +5516,8 @@ by a #." (defun org-activate-dates (limit) "Run through the buffer and add overlays to dates." - (if (re-search-forward org-tsr-regexp-both limit t) + (if (and (re-search-forward org-tsr-regexp-both limit t) + (not (equal (char-before (match-beginning 0)) 91))) (progn (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) (add-text-properties (match-beginning 0) (match-end 0) @@ -6431,13 +6438,16 @@ of the first headline in the buffer. This is important, because if the first headline is not level one, then (hide-sublevels 1) gives confusing results." (interactive) - (let ((level (save-excursion + (let ((l (org-current-line)) + (level (save-excursion (goto-char (point-min)) (if (re-search-forward (concat "^" outline-regexp) nil t) (progn (goto-char (match-beginning 0)) (funcall outline-level)))))) - (and level (hide-sublevels level)))) + (and level (hide-sublevels level)) + (recenter '(4)) + (org-goto-line l))) (defun org-content (&optional arg) "Show all headlines in the buffer, like a table of contents. @@ -7231,12 +7241,14 @@ This is a list with the following elements: (org-move-subtree-down) (end-of-line 1)) -(defun org-insert-heading-respect-content () - (interactive) +(defun org-insert-heading-respect-content (invisible-ok) + "Insert heading with `org-insert-heading-respect-content' set to t." + (interactive "P") (let ((org-insert-heading-respect-content t)) - (org-insert-heading t))) + (org-insert-heading t invisible-ok))) (defun org-insert-todo-heading-respect-content (&optional force-state) + "Insert TODO heading with `org-insert-heading-respect-content' set to t." (interactive "P") (let ((org-insert-heading-respect-content t)) (org-insert-todo-heading force-state t))) @@ -12835,27 +12847,27 @@ How much context is shown depends upon the variables (following-p (org-get-alist-option org-show-following-heading key)) (entry-p (org-get-alist-option org-show-entry-below key)) (siblings-p (org-get-alist-option org-show-siblings key))) - (catch 'exit - ;; Show heading or entry text - (if (and heading-p (not entry-p)) - (org-flag-heading nil) ; only show the heading - (and (or entry-p (outline-invisible-p) (org-invisible-p2)) - (org-show-hidden-entry))) ; show entire entry - (when following-p - ;; Show next sibling, or heading below text - (save-excursion - (and (if heading-p (org-goto-sibling) (outline-next-heading)) - (org-flag-heading nil)))) - (when siblings-p (org-show-siblings)) - (when hierarchy-p - ;; show all higher headings, possibly with siblings - (save-excursion - (while (and (condition-case nil - (progn (org-up-heading-all 1) t) - (error nil)) - (not (bobp))) - (org-flag-heading nil) - (when siblings-p (org-show-siblings)))))))) + ;; Show heading or entry text + (if (and heading-p (not entry-p)) + (org-flag-heading nil) ; only show the heading + (and (or entry-p (outline-invisible-p) (org-invisible-p2)) + (org-show-hidden-entry))) ; show entire entry + (when following-p + ;; Show next sibling, or heading below text + (save-excursion + (and (if heading-p (org-goto-sibling) (outline-next-heading)) + (org-flag-heading nil)))) + (when siblings-p (org-show-siblings)) + (when hierarchy-p + ;; show all higher headings, possibly with siblings + (save-excursion + (while (and (condition-case nil + (progn (org-up-heading-all 1) t) + (error nil)) + (not (bobp))) + (org-flag-heading nil) + (when siblings-p (org-show-siblings))))) + (org-fix-ellipsis-at-bol))) (defvar org-reveal-start-hook nil "Hook run before revealing a location.") @@ -13597,7 +13609,9 @@ If ONOFF is `on' or `off', don't toggle but set to this state." (if (or (org-at-heading-p) (and arg (org-before-first-heading-p))) (org-set-tags arg just-align) (save-excursion - (org-back-to-heading t) + (unless (and (org-region-active-p) + org-loop-over-headlines-in-active-region) + (org-back-to-heading t)) (org-set-tags arg just-align)))) (defun org-set-tags-to (data) @@ -14101,13 +14115,13 @@ agenda-with-archives The remaining args are treated as settings for the skipping facilities of the scanner. The following items can be given here: - archive skip trees with the archive tag. + archive skip trees with the archive tag comment skip trees with the COMMENT keyword function or Emacs Lisp form: - will be used as value for `org-agenda-skip-function', so whenever - the function returns t, FUNC will not be called for that - entry and search will continue from the point where the - function leaves it. + will be used as value for `org-agenda-skip-function', so + whenever the function returns a position, FUNC will not be + called for that entry and search will continue from the + position returned If your function needs to retrieve the tags including inherited tags at the *current* entry, you can use the value of the variable @@ -16401,6 +16415,12 @@ With prefix ARG, change that many days." (message "Timestamp is now %sactive" (if (equal (char-after beg) ?<) "" "in"))))) +(defun org-at-clock-log-p nil + "Is the cursor on the clock log line?" + (save-excursion + (move-beginning-of-line 1) + (looking-at "^[ \t]*CLOCK:"))) + (defvar org-clock-history) ; defined in org-clock.el (defvar org-clock-adjust-closest nil) ; defined in org-clock.el (defun org-timestamp-change (n &optional what updown) @@ -18737,8 +18757,7 @@ this function returns t, nil otherwise." (throw 'exit t)))) nil)))) -(autoload 'org-element-at-point "org-element") -(autoload 'org-element-type "org-element") +(org-autoload "org-element" '(org-element-at-point org-element-type)) (declare-function org-element-at-point "org-element" (&optional keep-trail)) (declare-function org-element-type "org-element" (element)) @@ -19840,7 +19859,7 @@ See the individual commands for more information." ("Refresh/Reload" ["Refresh setup current buffer" org-mode-restart t] ["Reload Org (after update)" org-reload t] - ["Reload Org uncompiled" (org-reload t) :active t :keys "C-u C-c C-x r"]) + ["Reload Org uncompiled" (org-reload t) :active t :keys "C-u C-c C-x !"]) )) (defun org-info (&optional node) @@ -20970,7 +20989,8 @@ hierarchy of headlines by UP levels before marking the subtree." (org-uniquify (append fill-nobreak-predicate '(org-fill-paragraph-separate-nobreak-p - org-fill-line-break-nobreak-p))))) + org-fill-line-break-nobreak-p + org-fill-paragraph-with-timestamp-nobreak-p))))) (org-set-local 'fill-paragraph-function 'org-fill-paragraph) (org-set-local 'auto-fill-inhibit-regexp nil) (org-set-local 'adaptive-fill-function 'org-adaptive-fill-function) @@ -20989,6 +21009,11 @@ hierarchy of headlines by UP levels before marking the subtree." (skip-chars-backward "\\\\") (looking-at "\\\\\\\\\\($\\|[^\\\\]\\)"))) +(defun org-fill-paragraph-with-timestamp-nobreak-p () + "Non-nil when a line break at point would insert a new item." + (and (org-at-timestamp-p t) + (not (looking-at org-ts-regexp-both)))) + (declare-function message-in-body-p "message" ()) (defvar org-element--affiliated-re) ; From org-element.el (defvar orgtbl-line-start-regexp) ; From org-table.el @@ -22159,7 +22184,8 @@ Show the heading too, if it is currently invisible." isearch-mode-end-hook-quit) ;; Only when the isearch was not quitted. (org-add-hook 'post-command-hook 'org-isearch-post-command - 'append 'local))))) + 'append 'local))) + (org-fix-ellipsis-at-bol))) (defun org-isearch-post-command () "Remove self from hook, and show context." @@ -22190,7 +22216,7 @@ Show the heading too, if it is currently invisible." (re (concat "^" (org-get-limited-outline-regexp))) (subs (make-vector (1+ n) nil)) (last-level 0) - m level head) + m level head0 head) (save-excursion (save-restriction (widen) @@ -22198,9 +22224,9 @@ Show the heading too, if it is currently invisible." (while (re-search-backward re nil t) (setq level (org-reduced-level (funcall outline-level))) (when (and (<= level n) - (looking-at org-complex-heading-regexp)) - (setq head (org-link-display-format - (org-match-string-no-properties 4)) + (looking-at org-complex-heading-regexp) + (setq head0 (org-match-string-no-properties 4))) + (setq head (org-link-display-format head0) m (org-imenu-new-marker)) (org-add-props head nil 'org-imenu-marker m 'org-imenu t) (if (>= level last-level) -- 2.39.2