Merge branch 'maint' into emacs-sync

This commit is contained in:
Kyle Meyer 2018-03-22 08:40:08 -04:00
commit bd3b72669a
13 changed files with 307 additions and 183 deletions

View File

@ -18,17 +18,12 @@ development.
patches that can easily and consistently be applied to the
main repository.
2. There is a mirror hosted publicly at repo.or.cz. Anyone can
get a clone of the current repository state using the command
git clone git://repo.or.cz/org-mode.git
3. People who are interested in participating to the Org mode
2. People who are interested in participating to the Org mode
development can do so by sending patches to this address:
[[mailto:emacs-orgmode@gnu.org][emacs-orgmode@gnu.org]]
4. An interested developer can also request push access to the
3. An interested developer can also request push access to the
central repository by creating an account on code.orgmode.org
and by sending her/his user info to the maintainer.

View File

@ -231,7 +231,7 @@ Do not forget to activate Org as described in the following section.
#+findex: org-agenda
#+findex: org-capture
#+findex: org-store-link
#+findex: org-iswitchb
#+findex: org-switchb
Since Emacs 22.2, files with the {{{file(.org)}}} extension use Org mode by
default. If you are using an earlier version of Emacs, add this line to your
@ -251,7 +251,7 @@ packages, please take the time to check the list (see [[Conflicts]]).
The four Org commands {{{command(org-store-link)}}},
{{{command(org-capture)}}}, {{{command(org-agenda)}}}, and
{{{command(org-iswitchb)}}} should be accessible through global keys
{{{command(org-switchb)}}} should be accessible through global keys
(i.e., anywhere in Emacs, not just in Org buffers). Here are
suggested bindings for these keys, please modify the keys to your own
liking.
@ -262,7 +262,7 @@ liking.
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
(global-set-key "\C-cb" 'org-switchb)
#+end_src
#+cindex: Org mode, turning on
@ -7631,8 +7631,8 @@ the easiest way to maintain it is through the following commands
Cycle through agenda file list, visiting one file after the other.
- {{{kbd(M-x org-iswitchb)}}} ::
#+findex: org-iswitchb
- {{{kbd(M-x org-switchb)}}} ::
#+findex: org-switchb
Command to use an ~iswitchb~-like interface to switch to and between
Org buffers.

View File

@ -952,7 +952,7 @@ Worg}.
@findex org-agenda
@findex org-capture
@findex org-store-link
@findex org-iswitchb
@findex org-switchb
Org mode buffers need font-lock to be turned on: this is the default in
Emacs@footnote{If you don't use font-lock globally, turn it on in Org buffer
@ -962,7 +962,7 @@ There are compatibility issues between Org mode and some other Elisp
packages, please take the time to check the list (@pxref{Conflicts}).
The four Org commands @command{org-store-link}, @command{org-capture},
@command{org-agenda}, and @command{org-iswitchb} should be accessible through
@command{org-agenda}, and @command{org-switchb} should be accessible through
global keys (i.e., anywhere in Emacs, not just in Org buffers). Here are
suggested bindings for these keys, please modify the keys to your own
liking.
@ -970,7 +970,7 @@ liking.
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-iswitchb)
(global-set-key "\C-cb" 'org-switchb)
@end lisp
@cindex Org mode, turning on
@ -8014,7 +8014,7 @@ Remove current file from the list of agenda files.
@orgcmd{C-',org-cycle-agenda-files}
@itemx C-,
Cycle through agenda file list, visiting one file after the other.
@item M-x org-iswitchb @key{RET}
@item M-x org-switchb @key{RET}
Command to use an @code{iswitchb}-like interface to switch to and between Org
buffers.
@end table
@ -9974,7 +9974,7 @@ To turn off fontification for marked up text, you can set
available markup syntax, you can customize @code{org-emphasis-alist}. To fine
tune what characters are allowed before and after the markup characters, you
can tweak @code{org-emphasis-regexp-components}. Beware that changing one of
the above variables will no take effect until you reload Org, for which you
the above variables will not take effect until you reload Org, for which you
may need to restart Emacs.
@node Horizontal rules

View File

@ -283,7 +283,7 @@ yourself.
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cc" 'org-capture)
(global-set-key "\C-cb" 'org-iswitchb)
(global-set-key "\C-cb" 'org-switchb)
@end smalllisp
Files with extension @samp{.org} will be put into Org mode automatically.
@ -562,7 +562,7 @@ Jump between definition and reference.
@end table
@seealso{
@uref{https://orgmode.org/manual/Document-Structure.html#Document-Structure,
@uref{https://orgmode.org/manual/Document-structure.html#Document-structure,
Chapter 2 of the manual}@*
@uref{http://sachachua.com/wp/2008/01/outlining-your-notes-with-org/,
Sacha Chua's tutorial}}
@ -687,11 +687,11 @@ between the nearest horizontal separator lines, or the entire table.
@seealso{
@uref{https://orgmode.org/manual/Tables.html#Tables, Chapter 3 of the
manual}@*
@uref{https://orgmode.org/worg/org-tutorials/tables.php, Bastien's
@uref{https://orgmode.org/worg/org-tutorials/tables.html, Bastien's
table tutorial}@*
@uref{https://orgmode.org/worg/org-tutorials/org-spreadsheet-intro.php,
@uref{https://orgmode.org/worg/org-tutorials/org-spreadsheet-intro.html,
Bastien's spreadsheet tutorial}@*
@uref{https://orgmode.org/worg/org-tutorials/org-plot.php, Eric's plotting tutorial}}
@uref{https://orgmode.org/worg/org-tutorials/org-plot.html, Eric's plotting tutorial}}
@node Hyperlinks, TODO Items, Tables, Top
@chapter Hyperlinks
@ -846,7 +846,7 @@ come up while taking notes! With Org mode, simply mark any entry in a tree
as being a TODO item. In this way, information is not duplicated, and TODO
items remain in the context from which they emerged.
Org mode providing methods to give you an overview of all the things that you
Org mode provides methods to give you an overview of all the things that you
have to do, collected from many files.
@menu
@ -1086,8 +1086,8 @@ This works only if the cursor is already in a plain list item
@end table
@seealso{
@uref{https://orgmode.org/manual/TODO-Items.html#TODO-Items, Chapter 5 of the manual}@*
@uref{https://orgmode.org/worg/org-tutorials/orgtutorial_dto.php, David
@uref{https://orgmode.org/manual/TODO-items.html#TODO-items, Chapter 5 of the manual}@*
@uref{https://orgmode.org/worg/org-tutorials/orgtutorial_dto.html, David
O'Toole's introductory tutorial}@*
@uref{http://members.optusnet.com.au/~charles57/GTD/gtd_workflow.html,
Charles Cave's GTD setup}}
@ -1309,10 +1309,10 @@ properties}.
@end table
@seealso{
@uref{https://orgmode.org/manual/Properties-and-Columns.html#Properties-and-Columns,
Chapter 7 of the manual}@*
@uref{https://orgmode.org/worg/org-tutorials/org-column-view-tutorial.php,Bastien
Guerry's column view tutorial}}
@uref{https://orgmode.org/manual/Properties-and-columns.html#Properties-and-columns,Chapter
7 of the manual}@*
@uref{https://orgmode.org/worg/org-tutorials/org-column-view-tutorial.html,Bastien's
column view tutorial}}
@node Dates and Times, Capture - Refile - Archive, Properties, Top
@chapter Dates and Times
@ -1538,7 +1538,7 @@ The @kbd{l} key may be used in the agenda (@pxref{Weekly/daily agenda}) to
show which tasks have been worked on or closed during a day.
@seealso{
@uref{https://orgmode.org/manual/Dates-and-Times.html#Dates-and-Times,
@uref{https://orgmode.org/manual/Dates-and-times.html#Dates-and-times,
Chapter 8 of the manual}@*
@uref{http://members.optusnet.com.au/~charles57/GTD/org_dates/, Charles
Cave's Date and Time tutorial}@*
@ -1701,7 +1701,7 @@ setting this variable, for example
@seealso{
@uref{https://orgmode.org/manual/Capture-_002d-Refile-_002d-Archive.html#Capture-_002d-Refile-_002d-Archive,
Chapter 9 of the manual}@*
@uref{https://orgmode.org/worg/org-tutorials/org-protocol-custom-handler.php,
@uref{https://orgmode.org/worg/org-tutorials/org-protocol-custom-handler.html,
Sebastian Rose's tutorial for capturing from a web browser}}@uref{}@*
@node Agenda Views, Markup, Capture - Refile - Archive, Top
@ -2043,9 +2043,9 @@ headlines that are also TODO items
@end table
@seealso{
@uref{https://orgmode.org/manual/Agenda-Views.html#Agenda-Views, Chapter 10 of
@uref{https://orgmode.org/manual/Agenda-views.html#Agenda-views, Chapter 10 of
the manual}@*
@uref{https://orgmode.org/worg/org-tutorials/org-custom-agenda-commands.php,
@uref{https://orgmode.org/worg/org-tutorials/org-custom-agenda-commands.html,
Mat Lundin's tutorial about custom agenda commands}@*
@uref{http://www.newartisans.com/2007/08/using-org-mode-as-a-day-planner.html,
John Wiegley's setup}}
@ -2422,11 +2422,11 @@ Create a single large iCalendar file from all files in
@seealso{
@uref{https://orgmode.org/manual/Exporting.html#Exporting, Chapter 12 of the manual}@*
@uref{https://orgmode.org/worg/org-tutorials/images-and-xhtml-export.php,
@uref{https://orgmode.org/worg/org-tutorials/images-and-xhtml-export.html,
Sebastian Rose's image handling tutorial}@*
@uref{https://orgmode.org/worg/org-tutorials/org-latex-export.php, Thomas
@uref{https://orgmode.org/worg/org-tutorials/org-latex-export.html, Thomas
Dye's LaTeX export tutorial}
@uref{https://orgmode.org/worg/org-tutorials/org-beamer/tutorial.php, Eric
@uref{https://orgmode.org/worg/exporters/beamer/tutorial.html, Eric
Fraga's BEAMER presentation tutorial}}
@node Publishing, Working With Source Code, Exporting, Top
@ -2471,9 +2471,9 @@ above.
@seealso{
@uref{https://orgmode.org/manual/Publishing.html#Publishing, Chapter 13 of the
manual}@*
@uref{https://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.php,
@uref{https://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html,
Sebastian Rose's publishing tutorial}@*
@uref{https://orgmode.org/worg/org-tutorials/org-jekyll.php, Ian Barton's
@uref{https://orgmode.org/worg/org-tutorials/org-jekyll.html, Ian Barton's
Jekyll/blogging setup}}
@node Working With Source Code, Miscellaneous, Publishing, Top
@ -2589,8 +2589,8 @@ Org-mode buffer.
@seealso{
@uref{https://orgmode.org/manual/Literal-examples.html#Literal-examples,
Chapter 11.3 of the manual}@*
@uref{https://orgmode.org/worg/org-contrib/babel/index.php,
Chapter 11 and section 5 of the manual}@*
@uref{https://orgmode.org/worg/org-contrib/babel/,
The Babel site on Worg}}
@node Miscellaneous, GNU Free Documentation License, Working With Source Code, Top

View File

@ -89,6 +89,8 @@ NOTE: By default, string variable names are interpreted as
references to source-code blocks, to force interpretation of a
cell's value as a string, prefix the identifier a \"$\" (e.g.,
\"$$2\" instead of \"$2\" or \"$@2$2\" instead of \"@2$2\").
This will not work with a range; instead, pass it as a list,
e.g. (org-sbe fun (r (list $1..$2))).
NOTE: It is also possible to pass header arguments to the code
block. In this case a table cell should hold the string value of
@ -112,7 +114,7 @@ as shown in the example below.
(prog1 nil (setq quote t))
(prog1
(cond
(quote (format "\"%s\"" el))
(quote (format "%S" el))
((stringp el) (org-no-properties el))
(t el))
(setq quote nil))))
@ -132,12 +134,17 @@ as shown in the example below.
"("
(mapconcat
(lambda (var-spec)
(if (> (length (cdr var-spec)) 1)
(format "%S='%S"
(car var-spec)
(mapcar #'read (cdr var-spec)))
(format "%S=%s"
(car var-spec) (cadr var-spec))))
(cond
((> (length (cdr var-spec)) 1)
(format "%S='%S"
(car var-spec)
(mapcar #'read (cdr var-spec))))
((stringp (cadr var-spec))
(format "%S=%s"
(car var-spec) (cadr var-spec)))
(t
(format "%S=%S"
(car var-spec) (cadr var-spec)))))
',variables ", ")
")")))))
(org-babel-execute-src-block

View File

@ -9897,32 +9897,33 @@ The prefix arg is passed through to the command if possible."
(org-agenda-set-tags ,tag
,(if (eq action ?+) ''on ''off))))))
(?s
(let ((time
(and (not arg)
(org-read-date nil nil nil "(Re)Schedule to"
org-overriding-default-time))))
((and (or ?s ?d) c)
(let* ((schedule? (eq c ?s))
(prompt (if schedule? "(Re)Schedule to" "(Re)Set Deadline to"))
(time
(and (not arg)
(let ((new (org-read-date
nil nil nil prompt org-overriding-default-time)))
;; A "double plus" answer applies to every
;; scheduled time. Do not turn it into
;; a fixed date yet.
(if (string-match-p "\\`[ \t]*\\+\\+"
org-read-date-final-answer)
org-read-date-final-answer
new)))))
;; Make sure to not prompt for a note when bulk
;; rescheduling as Org cannot cope with simultaneous notes.
;; Besides, it could be annoying depending on the number of
;; items re-scheduled.
;; rescheduling/resetting deadline as Org cannot cope with
;; simultaneous notes. Besides, it could be annoying
;; depending on the number of marked items.
(setq cmd
`(lambda ()
(let ((org-log-reschedule (and org-log-reschedule 'time)))
(org-agenda-schedule arg ,time))))))
(?d
(let ((time
(and (not arg)
(org-read-date nil nil nil "(Re)Set Deadline to"
org-overriding-default-time))))
;; Make sure to not prompt for a note when bulk
;; rescheduling as Org cannot cope with simultaneous
;; notes. Besides, it could be annoying depending on the
;; number of items re-scheduled.
(setq cmd
`(lambda ()
(let ((org-log-redeadline (and org-log-redeadline 'time)))
(org-agenda-deadline arg ,time))))))
(if schedule?
`(lambda ()
(let ((org-log-reschedule
(and org-log-reschedule 'time)))
(org-agenda-schedule arg ,time)))
`(lambda ()
(let ((org-log-redeadline (and org-log-redeadline 'time)))
(org-agenda-deadline arg ,time)))))))
(?S
(unless (org-agenda-check-type nil 'agenda 'todo)

View File

@ -541,8 +541,8 @@ not-in-buffer: command not displayed in matching buffers
If you define several checks, the agenda command will be
accessible if there is at least one valid check.
You can also bind a key to another agenda custom command
depending on contextual rules.
You can also bind a key to another capture template depending on
contextual rules.
\\='((\"c\" \"d\" ((in-mode . \"message-mode\"))))
@ -1121,7 +1121,7 @@ may have been stored before."
(setq level (org-get-valid-level
(if (org-at-heading-p) (org-outline-level) 1)
1))
(if reversed? (outline-next-heading) (org-end-of-subtree t)))
(if reversed? (outline-next-heading) (org-end-of-subtree t t)))
;; Insert as a top-level entry at the beginning of the file.
(reversed?
(goto-char (point-min))

View File

@ -518,7 +518,9 @@ cannot be translated."
(cond ((functionp org-clock-heading-function)
(funcall org-clock-heading-function))
((org-before-first-heading-p) "???")
(t (org-get-heading t t t t))))
(t (replace-regexp-in-string
org-bracket-link-analytic-regexp "\\5"
(org-no-properties (org-get-heading t t t t))))))
(defun org-clock-menu ()
(interactive)
@ -665,22 +667,21 @@ If an effort estimate was defined for the current item, use
01:30/01:50 format (clocked/estimated).
If not, show simply the clocked time like 01:50."
(let ((clocked-time (org-clock-get-clocked-time)))
(propertize
(if org-clock-effort
(let* ((effort-in-minutes (org-duration-to-minutes org-clock-effort))
(work-done-str
(propertize (org-duration-from-minutes clocked-time)
'face
(if (and org-clock-task-overrun
(not org-clock-task-overrun-text))
'org-mode-line-clock-overrun
'org-mode-line-clock)))
(effort-str (org-duration-from-minutes effort-in-minutes)))
(format " [%s/%s] (%s)" work-done-str effort-str org-clock-heading))
(format " [%s] (%s)"
(org-duration-from-minutes clocked-time)
org-clock-heading))
'face 'org-mode-line-clock)))
(if org-clock-effort
(let* ((effort-in-minutes (org-duration-to-minutes org-clock-effort))
(work-done-str
(propertize (org-duration-from-minutes clocked-time)
'face
(if (and org-clock-task-overrun
(not org-clock-task-overrun-text))
'org-mode-line-clock-overrun
'org-mode-line-clock)))
(effort-str (org-duration-from-minutes effort-in-minutes)))
(format (propertize " [%s/%s] (%s)" 'face 'org-mode-line-clock)
work-done-str effort-str org-clock-heading))
(format (propertize " [%s] (%s)" 'face 'org-mode-line-clock)
(org-duration-from-minutes clocked-time)
org-clock-heading))))
(defun org-clock-get-last-clock-out-time ()
"Get the last clock-out time for the current subtree."

View File

@ -42,6 +42,7 @@
(declare-function gnus-activate-group "gnus-start" (group &optional scan dont-check method dont-sub-check))
(declare-function gnus-find-method-for-group "gnus" (group &optional info))
(declare-function gnus-article-show-summary "gnus-art" ())
(declare-function gnus-group-group-name "gnus-group")
(declare-function gnus-group-jump-to-group "gnus-group" (group &optional prompt))
(declare-function gnus-group-read-group "gnus-group" (&optional all no-article group select-articles))
@ -142,7 +143,14 @@ If `org-store-link' was called with a prefix arg the meaning of
(save-excursion
(nnir-article-group (gnus-summary-article-number))))
(_ gnus-newsgroup-name)))
(header (with-current-buffer gnus-summary-buffer
(header (if (eq major-mode 'gnus-article-mode)
;; When in an article, first move to summary
;; buffer, with point on the summary of the
;; current article before extracting headers.
(save-window-excursion
(save-excursion
(gnus-article-show-summary)
(gnus-summary-article-header)))
(gnus-summary-article-header)))
(from (mail-header-from header))
(message-id (org-unbracket-string "<" ">" (mail-header-id header)))

View File

@ -2648,8 +2648,8 @@ Return t if successful."
(= top (point-at-bol))
(cdr (assq 'indent org-list-automatic-rules))
(if no-subtree
(error
"First item of list cannot move without its subtree")
(user-error
"At first item: use S-M-<left/right> to move the whole list")
t))))
;; Determine begin and end points of zone to indent. If moving
;; more than one item, save them for subsequent moves.

View File

@ -4903,6 +4903,18 @@ Support for group tags is controlled by the option
(message "Groups tags support has been turned %s"
(if org-group-tags "on" "off")))
(defun org-tag-add-to-alist (alist1 alist2)
"Append ALIST1 elements to ALIST2 if they are not there yet."
(cond
((null alist2) alist1)
((null alist1) alist2)
(t (let ((alist2-cars (mapcar (lambda (x) (car-safe x)) alist2))
to-add)
(dolist (i alist1)
(unless (member (car-safe i) alist2-cars)
(push i to-add)))
(append to-add alist2)))))
(defun org-set-regexps-and-options (&optional tags-only)
"Precompute regular expressions used in the current buffer.
When optional argument TAGS-ONLY is non-nil, only compute tags
@ -4931,10 +4943,11 @@ related expressions."
(mapcar #'org-add-prop-inherited
(cdr (assq 'filetags alist))))
(setq org-current-tag-alist
(append org-tag-persistent-alist
(let ((tags (cdr (assq 'tags alist))))
(if tags (org-tag-string-to-alist tags)
org-tag-alist))))
(org-tag-add-to-alist
org-tag-persistent-alist
(let ((tags (cdr (assq 'tags alist))))
(if tags (org-tag-string-to-alist tags)
org-tag-alist))))
(setq org-tag-groups-alist
(org-tag-alist-to-groups org-current-tag-alist))
(unless tags-only
@ -5249,7 +5262,7 @@ a string, summarizing TAGS, as a list of strings."
(`(,(or :endgroup :endgrouptag))
(when (eq group-status 'append)
(push (nreverse current-group) groups))
(setq group-status nil))
(setq group-status nil current-group nil))
(`(:grouptags) (setq group-status 'append))
((and `(,tag . ,_) (guard group-status))
(if (eq group-status 'append) (push tag current-group)
@ -8536,7 +8549,6 @@ When REMOVE is non-nil, remove the subtree from the clipboard."
(org-with-limited-levels
(let* ((visp (not (org-invisible-p)))
(txt tree)
(^re_ "\\(\\*+\\)[ \t]*")
(old-level (if (string-match org-outline-regexp-bol txt)
(- (match-end 0) (match-beginning 0) 1)
-1))
@ -8553,7 +8565,7 @@ When REMOVE is non-nil, remove the subtree from the clipboard."
(condition-case nil
(progn
(outline-previous-visible-heading 1)
(if (looking-at ^re_)
(if (looking-at org-outline-regexp-bol)
(- (match-end 0) (match-beginning 0) 1)
1))
(error 1))))
@ -8562,7 +8574,7 @@ When REMOVE is non-nil, remove the subtree from the clipboard."
(progn
(or (looking-at org-outline-regexp)
(outline-next-visible-heading 1))
(if (looking-at ^re_)
(if (looking-at org-outline-regexp-bol)
(- (match-end 0) (match-beginning 0) 1)
1))
(error 1))))
@ -14325,10 +14337,12 @@ instead of the agenda files."
(mapcar
(lambda (file)
(set-buffer (find-file-noselect file))
(mapcar (lambda (x)
(and (stringp (car-safe x))
(list (car-safe x))))
(or org-current-tag-alist (org-get-buffer-tags))))
(org-tag-add-to-alist
(org-get-buffer-tags)
(mapcar (lambda (x)
(and (stringp (car-safe x))
(list (car-safe x))))
org-current-tag-alist)))
(if (car-safe files) files
(org-agenda-files))))))))
@ -14355,9 +14369,9 @@ See also `org-scan-tags'."
;; Get a new match request, with completion against the global
;; tags table and the local tags in current buffer.
(let ((org-last-tags-completion-table
(org-uniquify
(delq nil (append (org-get-buffer-tags)
(org-global-tags-completion-table))))))
(org-tag-add-to-alist
(org-get-buffer-tags)
(org-global-tags-completion-table))))
(setq match
(completing-read
"Match: "
@ -14539,7 +14553,7 @@ When DOWNCASE is non-nil, expand downcased TAGS."
(tag (match-string 2 return-match))
(tag (if downcased (downcase tag) tag)))
(unless (or (get-text-property 0 'grouptag (match-string 2 return-match))
(member tag work-already-expanded))
(member tag tags-already-expanded))
(setq tags-in-group (assoc tag taggroups))
(push tag work-already-expanded)
;; Recursively expand each tag in the group, if the tag hasn't
@ -14807,36 +14821,28 @@ Assume point is on a headline."
(org-set-tags arg just-align))))
(defun org-set-tags-to (data)
"Set the tags of the current entry to DATA, replacing the current tags.
DATA may be a tags string like :aa:bb:cc:, or a list of tags.
If DATA is nil or the empty string, any tags will be removed."
"Set the tags of the current entry to DATA, replacing current tags.
DATA may be a tags string like \":aa:bb:cc:\", or a list of tags.
If DATA is nil or the empty string, all tags are removed."
(interactive "sTags: ")
(setq data
(cond
((eq data nil) "")
((equal data "") "")
((stringp data)
(concat ":" (mapconcat 'identity (org-split-string data ":+") ":")
":"))
((listp data)
(concat ":" (mapconcat 'identity data ":") ":"))))
(when data
(save-excursion
(org-back-to-heading t)
(when (let ((case-fold-search nil))
(looking-at org-complex-heading-regexp))
(if (match-end 5)
(progn
(goto-char (match-beginning 5))
(insert data)
(delete-region (point) (point-at-eol))
(org-set-tags nil 'align))
(goto-char (point-at-eol))
(insert " " data)
(org-set-tags nil 'align)))
(beginning-of-line 1)
(when (looking-at ".*?\\([ \t]+\\)$")
(delete-region (match-beginning 1) (match-end 1))))))
(let ((data
(pcase (if (stringp data) (org-trim data) data)
((or `nil "") nil)
((pred listp) (format ":%s:" (mapconcat #'identity data ":")))
((pred stringp)
(format ":%s:"
(mapconcat #'identity (org-split-string data ":+") ":")))
(_ (error "Invalid tag specification: %S" data)))))
(org-with-wide-buffer
(org-back-to-heading t)
(let ((case-fold-search nil)) (looking-at org-complex-heading-regexp))
(when (or (match-end 5) data)
(goto-char (or (match-beginning 5) (line-end-position)))
(skip-chars-backward " \t")
(delete-region (point) (line-end-position))
(when data
(insert " " data)
(org-set-tags nil 'align))))))
(defun org-align-all-tags ()
"Align the tags in all headings."
@ -14879,27 +14885,16 @@ When JUST-ALIGN is non-nil, only align tags."
(if just-align current
;; Get a new set of tags from the user.
(save-excursion
(let* ((seen)
(table
(let* ((table
(setq
org-last-tags-completion-table
;; Uniquify tags in alists, yet preserve
;; structure (i.e., keywords).
(delq nil
(mapcar
(lambda (pair)
(let ((head (car pair)))
(cond ((symbolp head) pair)
((member head seen) nil)
(t (push head seen)
pair))))
(append
(or org-current-tag-alist
(org-get-buffer-tags))
(and
org-complete-tags-always-offer-all-agenda-tags
(org-global-tags-completion-table
(org-agenda-files))))))))
(org-tag-add-to-alist
(and
org-complete-tags-always-offer-all-agenda-tags
(org-global-tags-completion-table
(org-agenda-files)))
(or org-current-tag-alist
(org-get-buffer-tags)))))
(current-tags (org-split-string current ":"))
(inherited-tags
(nreverse (nthcdr (length current-tags)
@ -14978,9 +14973,9 @@ This works in the agenda, and also in an Org buffer."
(list (region-beginning) (region-end)
(let ((org-last-tags-completion-table
(if (derived-mode-p 'org-mode)
(org-uniquify
(delq nil (append (org-get-buffer-tags)
(org-global-tags-completion-table))))
(org-tag-add-to-alist
(org-get-buffer-tags)
(org-global-tags-completion-table))
(org-global-tags-completion-table))))
(completing-read
"Tag: " 'org-tags-completion-function nil nil nil
@ -16638,10 +16633,18 @@ non-nil."
(defun org-time-stamp-inactive (&optional arg)
"Insert an inactive time stamp.
An inactive time stamp is enclosed in square brackets instead of angle
brackets. It is inactive in the sense that it does not trigger agenda entries,
does not link to the calendar and cannot be changed with the S-cursor keys.
So these are more for recording a certain time/date."
So these are more for recording a certain time/date.
If the user specifies a time like HH:MM or if this command is called with
at least one prefix argument, the time stamp contains the date and the time.
Otherwise, only the date is included.
When called with two universal prefix arguments, insert an active time stamp
with the current time without prompting the user."
(interactive "P")
(org-time-stamp arg 'inactive))
@ -18557,9 +18560,9 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
(setq org-todo-keyword-alist-for-agenda
(append org-todo-keyword-alist-for-agenda org-todo-key-alist))
(setq org-tag-alist-for-agenda
(org-uniquify
(append org-tag-alist-for-agenda
org-current-tag-alist)))
(org-tag-add-to-alist
org-tag-alist-for-agenda
org-current-tag-alist))
;; Merge current file's tag groups into global
;; `org-tag-groups-alist-for-agenda'.
(when org-group-tags

View File

@ -30,6 +30,51 @@
;; (org-test-at-id "6d2ff4ce-4489-4e2a-9c65-e3f71f77d975"
;; (should (= 2 (sbe take-sqrt (n "4"))))))
(ert-deftest test-ob-table/sbe-quote ()
"Test that `org-sbe' can correctly handle cell values containing quotes."
(org-test-table-target-expect
"
#+name: identity
#+begin_src emacs-lisp :eval yes
x
#+end_src
| a\"b\"c | replace |
"
"
#+name: identity
#+begin_src emacs-lisp :eval yes
x
#+end_src
| a\"b\"c | a\"b\"c |
"
1
"#+TBLFM: $2 = '(org-sbe identity (x $$1))"))
(ert-deftest test-ob-table/sbe-list ()
"Test that `org-sbe' can correctly handle ranges as lists."
(org-test-table-target-expect
"
#+name: concat
#+begin_src emacs-lisp :eval yes
(mapconcat #'identity x \"\")
#+end_src
| foo | bar | replace |
"
"
#+name: concat
#+begin_src emacs-lisp :eval yes
(mapconcat #'identity x \"\")
#+end_src
| foo | bar | foobar |
"
1
"#+TBLFM: $3 = '(org-sbe concat (x (list $1..$2)))"
"#+TBLFM: $3 = '(org-sbe concat (x $ (list $1..$2)))"))
(provide 'test-ob-table)
;;; test-ob-table.el ends here

View File

@ -5953,6 +5953,88 @@ Paragraph<point>"
"* T<point>est :foo:bar:"
(org-get-tags-at)))))
(ert-deftest test-org/set-tags ()
"Test `org-set-tags' specifications."
;; Tags set via fast-tag-selection should be visible afterwards
(should
(let ((org-tag-alist '(("NEXT" . ?n)))
(org-fast-tag-selection-single-key t))
(cl-letf (((symbol-function 'read-char-exclusive) (lambda () ?n))
((symbol-function 'window-width) (lambda (&rest args) 100)))
(org-test-with-temp-text "<point>* Headline\nAnd its content\n* And another headline\n\nWith some content"
;; Show only headlines
(org-content)
;; Set NEXT tag on current entry
(org-set-tags nil nil)
;; Move point to that NEXT tag
(search-forward "NEXT") (backward-word)
;; And it should be visible (i.e. no overlays)
(not (overlays-at (point))))))))
(ert-deftest test-org/set-tags-to ()
"Test `org-set-tags-to' specifications."
;; Throw an error on invalid data.
(should-error
(org-test-with-temp-text "* H"
(org-set-tags-to 'foo)))
;; `nil', an empty, and a blank string remove all tags.
(should
(equal "* H"
(org-test-with-temp-text "* H :tag1:tag2:"
(org-set-tags-to nil)
(buffer-string))))
(should
(equal "* H"
(org-test-with-temp-text "* H :tag1:tag2:"
(org-set-tags-to "")
(buffer-string))))
(should
(equal "* H"
(org-test-with-temp-text "* H :tag1:tag2:"
(org-set-tags-to " ")
(buffer-string))))
;; If there's nothing to remove, just bail out.
(should
(equal "* H"
(org-test-with-temp-text "* H"
(org-set-tags-to nil)
(buffer-string))))
(should
(equal "* "
(org-test-with-temp-text "* "
(org-set-tags-to nil)
(buffer-string))))
;; If DATA is a tag string, set current tags to it, even if it means
;; replacing old tags.
(should
(equal "* H :tag0:"
(org-test-with-temp-text "* H :tag1:tag2:"
(org-set-tags-to ":tag0:")
(buffer-string))))
(should
(equal "* H :tag0:"
(org-test-with-temp-text "* H"
(org-set-tags-to ":tag0:")
(buffer-string))))
;; If DATA is a list, set tags to this list, even if it means
;; replacing old tags.
(should
(equal "* H :tag0:"
(org-test-with-temp-text "* H :tag1:tag2:"
(org-set-tags-to '("tag0"))
(buffer-string))))
(should
(equal "* H :tag0:"
(org-test-with-temp-text "* H"
(org-set-tags-to '("tag0"))
(buffer-string))))
;; Special case: handle empty headlines.
(should
(equal "* :tag0:"
(org-test-with-temp-text "* "
(org-set-tags-to '("tag0"))
(buffer-string)))))
;;; TODO keywords
@ -6573,24 +6655,6 @@ CLOCK: [2012-03-29 Thu 10:00]--[2012-03-29 Thu 16:40] => 6:40"
(should-not
(org-test-with-temp-text "Paragraph" (org-hide-block-toggle-maybe))))
(ert-deftest test-org/set-tags ()
"Test `org-set-tags' specifications."
;; Tags set via fast-tag-selection should be visible afterwards
(should
(let ((org-tag-alist '(("NEXT" . ?n)))
(org-fast-tag-selection-single-key t))
(cl-letf (((symbol-function 'read-char-exclusive) (lambda () ?n))
((symbol-function 'window-width) (lambda (&rest args) 100)))
(org-test-with-temp-text "<point>* Headline\nAnd its content\n* And another headline\n\nWith some content"
;; Show only headlines
(org-content)
;; Set NEXT tag on current entry
(org-set-tags nil nil)
;; Move point to that NEXT tag
(search-forward "NEXT") (backward-word)
;; And it should be visible (i.e. no overlays)
(not (overlays-at (point))))))))
(ert-deftest test-org/show-set-visibility ()
"Test `org-show-set-visibility' specifications."
;; Do not throw an error before first heading.