forked from mirrors/org-mode
Adding release tag
-----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEG+FaXQip1ZWVgUdrFDesAvc/kaIFAlz/wNAACgkQFDesAvc/ kaJS5ggAp5ArbjubQMR4/7T4efdzRpiEaq1znSQYOAReTuB42e7Tqgw1UPAvliAs X17y+To3Rulok5RPGn1V3GyxteYXN6E9LXUTgQj77AEE4DbhTgR+kFR4XN8RudNP EBzoiQSiRwfNS1f8+vYoaxWOCV/5NkdY/x8ZUNekYy9POfdiPm9Ukq+kdn2uP2ni dntyfCS1/NDNS/1HR+pSn4/AyWXnJ6OrjIdsAP0zWRoxQK5QpwstE3LIA027IZLw +9pJbJN7+nAO37o9NegEzvuJ06VtihaGm84U0iR30Z/tPbDJLlbT+60rXdMoQWP1 VDdBkHIUe0kB7GpQd+zC0Ba60FAMKA== =Klcl -----END PGP SIGNATURE----- Merge tag 'release_9.2.4' into emacs-sync Adding release tag # gpg: Signature made Tue 11 Jun 2019 10:55:12 AM EDT # gpg: using RSA key 1BE15A5D08A9D5959581476B1437AC02F73F91A2 # gpg: Can't check signature: No public key
This commit is contained in:
commit
7d77083db0
|
@ -241,10 +241,9 @@ the hidden cloze during a test.")
|
|||
|
||||
(defun org-drill--compute-cloze-keywords ()
|
||||
(list (list (org-drill--compute-cloze-regexp)
|
||||
(copy-list '(1 'org-drill-visible-cloze-face nil))
|
||||
(copy-list '(2 'org-drill-visible-cloze-hint-face t))
|
||||
(copy-list '(3 'org-drill-visible-cloze-face nil))
|
||||
)))
|
||||
(list 1 'org-drill-visible-cloze-face nil)
|
||||
(list 2 'org-drill-visible-cloze-hint-face t)
|
||||
(list 3 'org-drill-visible-cloze-face nil))))
|
||||
|
||||
(defvar-local org-drill-cloze-regexp
|
||||
(org-drill--compute-cloze-regexp))
|
||||
|
@ -1011,7 +1010,7 @@ in the matrix."
|
|||
(learn-str
|
||||
(let ((learn-data (or (and learn-str
|
||||
(read learn-str))
|
||||
(copy-list initial-repetition-state))))
|
||||
(copy-sequence initial-repetition-state))))
|
||||
(list (nth 0 learn-data) ; last interval
|
||||
(nth 1 learn-data) ; repetitions
|
||||
(org-drill-entry-failure-count)
|
||||
|
@ -1026,7 +1025,7 @@ in the matrix."
|
|||
(org-drill-entry-total-repeats)
|
||||
(org-drill-entry-average-quality)
|
||||
(org-drill-entry-ease)))
|
||||
(t ; virgin item
|
||||
(t ; virgin item
|
||||
(list 0 0 0 0 nil nil)))))
|
||||
|
||||
|
||||
|
|
|
@ -604,28 +604,28 @@ invisible edits and process them.
|
|||
|
||||
The following commands jump to other headlines in the buffer.
|
||||
|
||||
- {{{kbd(C-c C-n)}}} (~outline-next-visible-heading~) ::
|
||||
- {{{kbd(C-c C-n)}}} (~org-next-visible-heading~) ::
|
||||
|
||||
#+kindex: C-c C-n
|
||||
#+findex: outline-next-visible-heading
|
||||
#+findex: org-next-visible-heading
|
||||
Next heading.
|
||||
|
||||
- {{{kbd(C-c C-p)}}} (~outline-previous-visible-heading~) ::
|
||||
- {{{kbd(C-c C-p)}}} (~org-previous-visible-heading~) ::
|
||||
|
||||
#+kindex: C-c C-p
|
||||
#+findex: outline-previous-visible-heading
|
||||
#+findex: org-previous-visible-heading
|
||||
Previous heading.
|
||||
|
||||
- {{{kbd(C-c C-f)}}} (~org-forward-same-level~) ::
|
||||
- {{{kbd(C-c C-f)}}} (~org-forward-heading-same-level~) ::
|
||||
|
||||
#+kindex: C-c C-f
|
||||
#+findex: org-forward-same-level
|
||||
#+findex: org-forward-heading-same-level
|
||||
Next heading same level.
|
||||
|
||||
- {{{kbd(C-c C-b)}}} (~org-backward-same-level~) ::
|
||||
- {{{kbd(C-c C-b)}}} (~org-backward-heading-same-level~) ::
|
||||
|
||||
#+kindex: C-c C-b
|
||||
#+findex: org-backward-same-level
|
||||
#+findex: org-backward-heading-same-level
|
||||
Previous heading same level.
|
||||
|
||||
- {{{kbd(C-c C-u)}}} (~outline-up-heading~) ::
|
||||
|
@ -3252,12 +3252,12 @@ current buffer:
|
|||
points to the target. Otherwise it points to the current
|
||||
headline, which is also the description[fn:30].
|
||||
|
||||
#+vindex: org-link-to-org-use-id
|
||||
#+vindex: org-id-link-to-org-use-id
|
||||
#+cindex: @samp{CUSTOM_ID}, property
|
||||
#+cindex: @samp{ID}, property
|
||||
If the headline has a =CUSTOM_ID= property, store a link to this
|
||||
custom ID. In addition or alternatively, depending on the value
|
||||
of ~org-link-to-org-use-id~, create and/or use a globally unique
|
||||
of ~org-id-link-to-org-use-id~, create and/or use a globally unique
|
||||
=ID= property for the link[fn:31]. So using this command in Org
|
||||
buffers potentially creates two links: a human-readable link from
|
||||
the custom ID, and one that is globally unique and works even if
|
||||
|
@ -3494,7 +3494,7 @@ replacement text. Here is an example:
|
|||
("google" . "http://www.google.com/search?q=")
|
||||
("gmap" . "http://maps.google.com/maps?q=%s")
|
||||
("omap" . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1")
|
||||
("ads" . "http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?author=%s&db_key=AST")))
|
||||
("ads" . "https://ui.adsabs.harvard.edu/search/q=%20author%3A\"%s\"")))
|
||||
#+end_src
|
||||
|
||||
If the replacement text contains the string =%s=, it is replaced with
|
||||
|
@ -6153,17 +6153,6 @@ schedule an item:[fn:67]
|
|||
variable ~org-log-reschedule~, take a note when changing an
|
||||
existing scheduling time[fn:69].
|
||||
|
||||
- {{{kbd(C-c C-x C-k)}}} (~org-mark-entry-for-agenda-action~) ::
|
||||
|
||||
#+kindex: C-c C-x C-k
|
||||
#+kindex: k a
|
||||
#+kindex: k s
|
||||
#+findex: org-mark-entry-for-agenda-action
|
||||
Mark the current entry for agenda action. After you have marked
|
||||
the entry like this, you can open the agenda or the calendar to
|
||||
find an appropriate date. With point on the selected date, press
|
||||
{{{kbd(k s)}}} or {{{kbd(k d)}}} to schedule the marked item.
|
||||
|
||||
- {{{kbd(C-c / d)}}} (~org-check-deadlines~) ::
|
||||
|
||||
#+kindex: C-c / d
|
||||
|
@ -21313,8 +21302,8 @@ information attached to them, like a time-stamp, a scheduled or
|
|||
a deadline string. See ~org-agenda-entry-types~ on how to set what
|
||||
planning information is taken into account.
|
||||
|
||||
[fn:104] For HTML you need to install Hrvoje Niksic's =htmlize.el=
|
||||
from [[https://github.com/hniksic/emacs-htmlize][Hrvoje Niksic's repository]].
|
||||
[fn:104] For HTML you need to install Hrvoje Nikšić's =htmlize.el=
|
||||
from [[https://github.com/hniksic/emacs-htmlize][Hrvoje Nikšić's repository]].
|
||||
|
||||
[fn:105] To create PDF output, the Ghostscript ps2pdf utility must be
|
||||
installed on the system. Selecting a PDF file also creates the
|
||||
|
@ -21487,7 +21476,7 @@ through ~word-wrap~.
|
|||
|
||||
[fn:149] Also see the variable ~org-adapt-indentation~.
|
||||
|
||||
[fn:150] Because =LEVEL=2= has 3 stars, =LEVEL=3= has 4 stars, and so
|
||||
[fn:150] Because =LEVEL=2= has 3 stars, =LEVEL=3= has 5 stars, and so
|
||||
on.
|
||||
|
||||
[fn:151] For a server to host files, consider using a WebDAV server,
|
||||
|
|
|
@ -60,8 +60,7 @@
|
|||
% dvips -t landscape refcard.dvi
|
||||
%
|
||||
% Author:
|
||||
% Stephen Gildea
|
||||
% Internet: gildea@stop.mail-abuse.org
|
||||
% Stephen Gildea <stepheng+emacs@gildea.com>
|
||||
%
|
||||
% Thanks to Paul Rubin, Bob Chassell, Len Tower, and Richard Mlynarik
|
||||
% for their many good ideas.
|
||||
|
|
|
@ -1187,8 +1187,14 @@ may have been stored before."
|
|||
item))
|
||||
(throw :found t)))
|
||||
;; No list found. Move to the location when to insert
|
||||
;; template.
|
||||
(goto-char (if prepend? beg end)))))
|
||||
;; template. Skip planning info and properties drawers, if
|
||||
;; any.
|
||||
(goto-char (cond ((not prepend?) end)
|
||||
((org-before-first-heading-p) beg)
|
||||
(t (max (save-excursion
|
||||
(org-end-of-meta-data)
|
||||
(point))
|
||||
beg)))))))
|
||||
;; Insert template.
|
||||
(let ((origin (point)))
|
||||
(unless (bolp) (insert "\n"))
|
||||
|
@ -1608,10 +1614,8 @@ The template may still contain \"%?\" for cursor positioning."
|
|||
(org-get-x-clipboard 'CLIPBOARD)
|
||||
(org-get-x-clipboard 'SECONDARY)
|
||||
v-c))))
|
||||
|
||||
(setq org-store-link-plist (plist-put org-store-link-plist :annotation v-a))
|
||||
(setq org-store-link-plist (plist-put org-store-link-plist :initial v-i))
|
||||
|
||||
(unless template
|
||||
(setq template "")
|
||||
(message "no template") (ding)
|
||||
|
@ -1623,7 +1627,6 @@ The template may still contain \"%?\" for cursor positioning."
|
|||
(setq mark-active nil)
|
||||
(insert template)
|
||||
(goto-char (point-min))
|
||||
|
||||
;; %[] insert contents of a file.
|
||||
(save-excursion
|
||||
(while (re-search-forward "%\\[\\(.+\\)\\]" nil t)
|
||||
|
@ -1640,10 +1643,8 @@ The template may still contain \"%?\" for cursor positioning."
|
|||
(insert (format "%%![couldn not insert %s: %s]"
|
||||
filename
|
||||
error))))))))
|
||||
|
||||
;; Mark %() embedded elisp for later evaluation.
|
||||
(org-capture-expand-embedded-elisp 'mark)
|
||||
|
||||
;; Expand non-interactive templates.
|
||||
(let ((regexp "%\\(:[-a-za-z]+\\|<\\([^>\n]+\\)>\\|[aAcfFikKlntTuUx]\\)"))
|
||||
(save-excursion
|
||||
|
@ -1693,10 +1694,8 @@ The template may still contain \"%?\" for cursor positioning."
|
|||
;; Escape sensitive characters.
|
||||
(replace-regexp-in-string "[\\\"]" "\\\\\\&" replacement)
|
||||
replacement))))))))
|
||||
|
||||
;; Expand %() embedded Elisp. Limit to Sexp originally marked.
|
||||
(org-capture-expand-embedded-elisp)
|
||||
|
||||
;; Expand interactive templates. This is the last step so that
|
||||
;; template is mostly expanded when prompting happens. Turn on
|
||||
;; Org mode and set local variables. This is to support
|
||||
|
@ -1814,7 +1813,6 @@ The template may still contain \"%?\" for cursor positioning."
|
|||
(_
|
||||
(error "Unknown template placeholder: \"%%^%s\""
|
||||
key))))))))
|
||||
|
||||
;; Replace %n escapes with nth %^{...} string.
|
||||
(setq strings (nreverse strings))
|
||||
(save-excursion
|
||||
|
@ -1823,16 +1821,16 @@ The template may still contain \"%?\" for cursor positioning."
|
|||
(replace-match
|
||||
(nth (1- (string-to-number (match-string 1))) strings)
|
||||
nil t)))))
|
||||
|
||||
;; Make sure there are no empty lines before the text, and that
|
||||
;; it ends with a newline character or it is empty.
|
||||
(skip-chars-forward " \t\n")
|
||||
(delete-region (point-min) (line-beginning-position))
|
||||
(goto-char (point-max))
|
||||
(skip-chars-backward " \t\n")
|
||||
(delete-region (point) (point-max))
|
||||
(unless (bobp) (insert "\n"))
|
||||
|
||||
(if (bobp) (delete-region (point) (line-end-position))
|
||||
(end-of-line)
|
||||
(delete-region (point) (point-max))
|
||||
(insert "\n"))
|
||||
;; Return the expanded template and kill the capture buffer.
|
||||
(untabify (point-min) (point-max))
|
||||
(set-buffer-modified-p nil)
|
||||
|
|
|
@ -84,8 +84,7 @@
|
|||
|
||||
(defcustom org-id-link-to-org-use-id nil
|
||||
"Non-nil means storing a link to an Org file will use entry IDs.
|
||||
\\<org-mode-map>\
|
||||
|
||||
\\<org-mode-map>
|
||||
The variable can have the following values:
|
||||
|
||||
t Create an ID if needed to make a link to the current entry.
|
||||
|
|
|
@ -83,51 +83,61 @@ directly, use instead:
|
|||
|
||||
;;; Functions
|
||||
|
||||
(defun org-macro--collect-macros ()
|
||||
(defun org-macro--set-template (name value templates)
|
||||
"Set template for the macro NAME.
|
||||
VALUE is the template of the macro. The new value override the
|
||||
previous one, unless VALUE is nil. TEMPLATES is the list of
|
||||
templates. Return the updated list."
|
||||
(when value
|
||||
(let ((old-definition (assoc name templates)))
|
||||
(if old-definition
|
||||
(setcdr old-definition value)
|
||||
(push (cons name value) templates))))
|
||||
templates)
|
||||
|
||||
(defun org-macro--collect-macros (&optional files templates)
|
||||
"Collect macro definitions in current buffer and setup files.
|
||||
Return an alist containing all macro templates found."
|
||||
(letrec ((collect-macros
|
||||
(lambda (files templates)
|
||||
;; Return an alist of macro templates. FILES is a list
|
||||
;; of setup files names read so far, used to avoid
|
||||
;; circular dependencies. TEMPLATES is the alist
|
||||
;; collected so far.
|
||||
(let ((case-fold-search t))
|
||||
(org-with-wide-buffer
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward
|
||||
"^[ \t]*#\\+\\(MACRO\\|SETUPFILE\\):" nil t)
|
||||
(let ((element (org-element-at-point)))
|
||||
(when (eq (org-element-type element) 'keyword)
|
||||
(let ((val (org-element-property :value element)))
|
||||
(if (equal (org-element-property :key element) "MACRO")
|
||||
;; Install macro in TEMPLATES.
|
||||
(when (string-match
|
||||
"^\\(.*?\\)\\(?:\\s-+\\(.*\\)\\)?\\s-*$" val)
|
||||
(let* ((name (match-string 1 val))
|
||||
(template (or (match-string 2 val) ""))
|
||||
(old-cell (assoc name templates)))
|
||||
(if old-cell (setcdr old-cell template)
|
||||
(push (cons name template) templates))))
|
||||
;; Enter setup file.
|
||||
(let* ((uri (org-strip-quotes (org-trim val)))
|
||||
(uri-is-url (org-file-url-p uri))
|
||||
(uri (if uri-is-url
|
||||
uri
|
||||
(expand-file-name uri))))
|
||||
;; Avoid circular dependencies.
|
||||
(unless (member uri files)
|
||||
(with-temp-buffer
|
||||
(unless uri-is-url
|
||||
(setq default-directory
|
||||
(file-name-directory uri)))
|
||||
(org-mode)
|
||||
(insert (org-file-contents uri 'noerror))
|
||||
(setq templates
|
||||
(funcall collect-macros (cons uri files)
|
||||
templates)))))))))))
|
||||
templates))))
|
||||
(funcall collect-macros nil nil)))
|
||||
Return an alist containing all macro templates found.
|
||||
|
||||
FILES is a list of setup files names read so far, used to avoid
|
||||
circular dependencies. TEMPLATES is the alist collected so far.
|
||||
The two arguments are used in recursive calls."
|
||||
(let ((case-fold-search t))
|
||||
(org-with-point-at 1
|
||||
(while (re-search-forward "^[ \t]*#\\+\\(MACRO\\|SETUPFILE\\):" nil t)
|
||||
(let ((element (org-element-at-point)))
|
||||
(when (eq (org-element-type element) 'keyword)
|
||||
(let ((val (org-element-property :value element)))
|
||||
(if (equal "MACRO" (org-element-property :key element))
|
||||
;; Install macro in TEMPLATES.
|
||||
(when (string-match "^\\(\\S-+\\)[ \t]*" val)
|
||||
(let ((name (match-string 1 val))
|
||||
(value (substring val (match-end 0))))
|
||||
(setq templates
|
||||
(org-macro--set-template name value templates))))
|
||||
;; Enter setup file.
|
||||
(let* ((uri (org-strip-quotes val))
|
||||
(uri-is-url (org-file-url-p uri))
|
||||
(uri (if uri-is-url
|
||||
uri
|
||||
(expand-file-name uri))))
|
||||
;; Avoid circular dependencies.
|
||||
(unless (member uri files)
|
||||
(with-temp-buffer
|
||||
(unless uri-is-url
|
||||
(setq default-directory (file-name-directory uri)))
|
||||
(org-mode)
|
||||
(insert (org-file-contents uri 'noerror))
|
||||
(setq templates
|
||||
(org-macro--collect-macros
|
||||
(cons uri files) templates)))))))))))
|
||||
(let ((macros `(("author" . ,(org-macro--find-keyword-value "AUTHOR"))
|
||||
("email" . ,(org-macro--find-keyword-value "EMAIL"))
|
||||
("title" . ,(org-macro--find-keyword-value "TITLE" t))
|
||||
("date" . ,(org-macro--find-date)))))
|
||||
(pcase-dolist (`(,name . ,value) macros)
|
||||
(setq templates (org-macro--set-template name value templates))))
|
||||
templates))
|
||||
|
||||
(defun org-macro-initialize-templates ()
|
||||
"Collect macro templates defined in current buffer.
|
||||
|
@ -160,27 +170,12 @@ a file, \"input-file\" and \"modification-time\"."
|
|||
(prin1-to-string
|
||||
(file-attribute-modification-time
|
||||
(file-attributes visited-file))))))))
|
||||
;; Install built-in macros.
|
||||
;; Install generic macros.
|
||||
(list
|
||||
'("n" . "(eval (org-macro--counter-increment $1 $2))")
|
||||
`("author" . ,(org-macro--find-keyword-value "AUTHOR"))
|
||||
`("email" . ,(org-macro--find-keyword-value "EMAIL"))
|
||||
'("keyword" . "(eval (org-macro--find-keyword-value $1))")
|
||||
'("time" . "(eval (format-time-string $1))")
|
||||
`("title" . ,(org-macro--find-keyword-value "TITLE"))
|
||||
'("property" . "(eval (org-macro--get-property $1 $2))")
|
||||
`("date" .
|
||||
,(let* ((value (org-macro--find-keyword-value "DATE"))
|
||||
(date (org-element-parse-secondary-string
|
||||
value (org-element-restriction 'keyword))))
|
||||
(if (and (consp date)
|
||||
(not (cdr date))
|
||||
(eq 'timestamp (org-element-type (car date))))
|
||||
(format "(eval (if (org-string-nw-p $1) %s %S))"
|
||||
(format "(org-timestamp-format '%S $1)"
|
||||
(org-element-copy (car date)))
|
||||
value)
|
||||
value)))))))
|
||||
'("property" . "(eval (org-macro--get-property $1 $2))")))))
|
||||
|
||||
(defun org-macro-expand (macro templates)
|
||||
"Return expanded MACRO, as a string.
|
||||
|
@ -331,21 +326,39 @@ by `org-link-search', or the empty string."
|
|||
(error "Macro property failed: cannot find location %s" location))))
|
||||
(org-entry-get nil property 'selective)))
|
||||
|
||||
(defun org-macro--find-keyword-value (name)
|
||||
(defun org-macro--find-keyword-value (name &optional collect)
|
||||
"Find value for keyword NAME in current buffer.
|
||||
KEYWORD is a string. Return value associated to the keywords
|
||||
named after NAME, as a string, or nil."
|
||||
Return value associated to the keywords named after NAME, as
|
||||
a string, or nil. When optional argument COLLECT is non-nil,
|
||||
concatenate values, separated with a space, from various keywords
|
||||
in the buffer."
|
||||
(org-with-point-at 1
|
||||
(let ((regexp (format "^[ \t]*#\\+%s:" (regexp-quote name)))
|
||||
(case-fold-search t)
|
||||
(result nil))
|
||||
(while (re-search-forward regexp nil t)
|
||||
(let ((element (org-element-at-point)))
|
||||
(when (eq 'keyword (org-element-type element))
|
||||
(setq result (concat result
|
||||
" "
|
||||
(org-element-property :value element))))))
|
||||
(and result (org-trim result)))))
|
||||
(catch :exit
|
||||
(while (re-search-forward regexp nil t)
|
||||
(let ((element (org-element-at-point)))
|
||||
(when (eq 'keyword (org-element-type element))
|
||||
(let ((value (org-element-property :value element)))
|
||||
(if (not collect) (throw :exit value)
|
||||
(setq result (concat result " " value)))))))
|
||||
(and result (org-trim result))))))
|
||||
|
||||
(defun org-macro--find-date ()
|
||||
"Find value for DATE in current buffer.
|
||||
Return value as a string."
|
||||
(let* ((value (org-macro--find-keyword-value "DATE"))
|
||||
(date (org-element-parse-secondary-string
|
||||
value (org-element-restriction 'keyword))))
|
||||
(if (and (consp date)
|
||||
(not (cdr date))
|
||||
(eq 'timestamp (org-element-type (car date))))
|
||||
(format "(eval (if (org-string-nw-p $1) %s %S))"
|
||||
(format "(org-timestamp-format '%S $1)"
|
||||
(org-element-copy (car date)))
|
||||
value)
|
||||
value)))
|
||||
|
||||
(defun org-macro--vc-modified-time (file)
|
||||
(save-window-excursion
|
||||
|
|
|
@ -489,8 +489,8 @@ Line numbers are counted from the beginning of the table. This
|
|||
variable is initialized with `org-table-analyze'.")
|
||||
|
||||
(defconst org-table-range-regexp
|
||||
"@\\([-+]?I*[-+]?[0-9]*\\)?\\(\\$[-+]?[0-9]+\\)?\\(\\.\\.@?\\([-+]?I*[-+]?[0-9]*\\)?\\(\\$[-+]?[0-9]+\\)?\\)?"
|
||||
;; 1 2 3 4 5
|
||||
"@\\([-+]?I*[-+]?[0-9]*\\)\\(\\$[-+]?[0-9]+\\)?\\(\\.\\.@?\\([-+]?I*[-+]?[0-9]*\\)\\(\\$[-+]?[0-9]+\\)?\\)?"
|
||||
;; 1 2 3 4 5
|
||||
"Regular expression for matching ranges in formulas.")
|
||||
|
||||
(defconst org-table-range-regexp2
|
||||
|
@ -3224,139 +3224,140 @@ known that the table will be realigned a little later anyway."
|
|||
beg end eqlcol eqlfield)
|
||||
;; Insert constants in all formulas.
|
||||
(when eqlist
|
||||
(org-table-save-field
|
||||
;; Expand equations, then split the equation list between
|
||||
;; column formulas and field formulas.
|
||||
(dolist (eq eqlist)
|
||||
(let* ((rhs (org-table-formula-substitute-names
|
||||
(org-table-formula-handle-first/last-rc (cdr eq))))
|
||||
(old-lhs (car eq))
|
||||
(lhs
|
||||
(org-table-formula-handle-first/last-rc
|
||||
(cond
|
||||
((string-match "\\`@-?I+" old-lhs)
|
||||
(user-error "Can't assign to hline relative reference"))
|
||||
((string-match "\\`\\$[<>]" old-lhs)
|
||||
(let ((new (org-table-formula-handle-first/last-rc
|
||||
old-lhs)))
|
||||
(when (assoc new eqlist)
|
||||
(user-error "\"%s=\" formula tries to overwrite \
|
||||
(org-table-with-shrunk-columns
|
||||
(org-table-save-field
|
||||
;; Expand equations, then split the equation list between
|
||||
;; column formulas and field formulas.
|
||||
(dolist (eq eqlist)
|
||||
(let* ((rhs (org-table-formula-substitute-names
|
||||
(org-table-formula-handle-first/last-rc (cdr eq))))
|
||||
(old-lhs (car eq))
|
||||
(lhs
|
||||
(org-table-formula-handle-first/last-rc
|
||||
(cond
|
||||
((string-match "\\`@-?I+" old-lhs)
|
||||
(user-error "Can't assign to hline relative reference"))
|
||||
((string-match "\\`\\$[<>]" old-lhs)
|
||||
(let ((new (org-table-formula-handle-first/last-rc
|
||||
old-lhs)))
|
||||
(when (assoc new eqlist)
|
||||
(user-error "\"%s=\" formula tries to overwrite \
|
||||
existing formula for column %s"
|
||||
old-lhs
|
||||
new))
|
||||
new))
|
||||
(t old-lhs)))))
|
||||
(if (string-match-p "\\`\\$[0-9]+\\'" lhs)
|
||||
(push (cons lhs rhs) eqlcol)
|
||||
(push (cons lhs rhs) eqlfield))))
|
||||
(setq eqlcol (nreverse eqlcol))
|
||||
;; Expand ranges in lhs of formulas
|
||||
(setq eqlfield (org-table-expand-lhs-ranges (nreverse eqlfield)))
|
||||
;; Get the correct line range to process.
|
||||
(if all
|
||||
(progn
|
||||
(setq end (copy-marker (org-table-end)))
|
||||
(goto-char (setq beg org-table-current-begin-pos))
|
||||
(cond
|
||||
((re-search-forward org-table-calculate-mark-regexp end t)
|
||||
;; This is a table with marked lines, compute selected
|
||||
;; lines.
|
||||
(setq line-re org-table-recalculate-regexp))
|
||||
;; Move forward to the first non-header line.
|
||||
((and (re-search-forward org-table-dataline-regexp end t)
|
||||
(re-search-forward org-table-hline-regexp end t)
|
||||
(re-search-forward org-table-dataline-regexp end t))
|
||||
(setq beg (match-beginning 0)))
|
||||
;; Just leave BEG at the start of the table.
|
||||
(t nil)))
|
||||
(setq beg (line-beginning-position)
|
||||
end (copy-marker (line-beginning-position 2))))
|
||||
(goto-char beg)
|
||||
;; Mark named fields untouchable. Also check if several
|
||||
;; field/range formulas try to set the same field.
|
||||
(remove-text-properties beg end '(:org-untouchable t))
|
||||
(let ((current-line (count-lines org-table-current-begin-pos
|
||||
(line-beginning-position)))
|
||||
seen-fields)
|
||||
(dolist (eq eqlfield)
|
||||
(let* ((name (car eq))
|
||||
(location (assoc name org-table-named-field-locations))
|
||||
(eq-line (or (nth 1 location)
|
||||
(and (string-match "\\`@\\([0-9]+\\)" name)
|
||||
(aref org-table-dlines
|
||||
(string-to-number
|
||||
(match-string 1 name))))))
|
||||
(reference
|
||||
(if location
|
||||
;; Turn field coordinates associated to NAME
|
||||
;; into an absolute reference.
|
||||
(format "@%d$%d"
|
||||
(org-table-line-to-dline eq-line)
|
||||
(nth 2 location))
|
||||
name)))
|
||||
(when (member reference seen-fields)
|
||||
(user-error "Several field/range formulas try to set %s"
|
||||
reference))
|
||||
(push reference seen-fields)
|
||||
(when (or all (eq eq-line current-line))
|
||||
(org-table-goto-field name)
|
||||
(org-table-put-field-property :org-untouchable t)))))
|
||||
;; Evaluate the column formulas, but skip fields covered by
|
||||
;; field formulas.
|
||||
(goto-char beg)
|
||||
(while (re-search-forward line-re end t)
|
||||
(unless (string-match "\\` *[_^!$/] *\\'" (org-table-get-field 1))
|
||||
;; Unprotected line, recalculate.
|
||||
(cl-incf cnt)
|
||||
(when all
|
||||
(setq log-last-time
|
||||
(org-table-message-once-per-second
|
||||
log-last-time
|
||||
"Re-applying formulas to full table...(line %d)" cnt)))
|
||||
(if (markerp org-last-recalc-line)
|
||||
(move-marker org-last-recalc-line (line-beginning-position))
|
||||
(setq org-last-recalc-line
|
||||
(copy-marker (line-beginning-position))))
|
||||
(dolist (entry eqlcol)
|
||||
(goto-char org-last-recalc-line)
|
||||
(org-table-goto-column
|
||||
(string-to-number (substring (car entry) 1)) nil 'force)
|
||||
(unless (get-text-property (point) :org-untouchable)
|
||||
(org-table-eval-formula
|
||||
nil (cdr entry) 'noalign 'nocst 'nostore 'noanalysis)))))
|
||||
;; Evaluate the field formulas.
|
||||
(dolist (eq eqlfield)
|
||||
(let ((reference (car eq))
|
||||
(formula (cdr eq)))
|
||||
(setq log-last-time
|
||||
(org-table-message-once-per-second
|
||||
(and all log-last-time)
|
||||
"Re-applying formula to field: %s" (car eq)))
|
||||
(org-table-goto-field
|
||||
reference
|
||||
;; Possibly create a new column, as long as
|
||||
;; `org-table-formula-create-columns' allows it.
|
||||
(let ((column-count (progn (end-of-line)
|
||||
(1- (org-table-current-column)))))
|
||||
(lambda (column)
|
||||
(when (> column 1000)
|
||||
(user-error "Formula column target too large"))
|
||||
(and (> column column-count)
|
||||
(or (eq org-table-formula-create-columns t)
|
||||
(and (eq org-table-formula-create-columns 'warn)
|
||||
(progn
|
||||
(org-display-warning
|
||||
"Out-of-bounds formula added columns")
|
||||
t))
|
||||
(and (eq org-table-formula-create-columns 'prompt)
|
||||
(yes-or-no-p
|
||||
"Out-of-bounds formula. Add columns? "))
|
||||
(user-error
|
||||
"Missing columns in the table. Aborting"))))))
|
||||
(org-table-eval-formula nil formula t t t t))))
|
||||
;; Clean up markers and internal text property.
|
||||
(remove-text-properties (point-min) (point-max) '(org-untouchable t))
|
||||
(set-marker end nil)
|
||||
old-lhs
|
||||
new))
|
||||
new))
|
||||
(t old-lhs)))))
|
||||
(if (string-match-p "\\`\\$[0-9]+\\'" lhs)
|
||||
(push (cons lhs rhs) eqlcol)
|
||||
(push (cons lhs rhs) eqlfield))))
|
||||
(setq eqlcol (nreverse eqlcol))
|
||||
;; Expand ranges in lhs of formulas
|
||||
(setq eqlfield (org-table-expand-lhs-ranges (nreverse eqlfield)))
|
||||
;; Get the correct line range to process.
|
||||
(if all
|
||||
(progn
|
||||
(setq end (copy-marker (org-table-end)))
|
||||
(goto-char (setq beg org-table-current-begin-pos))
|
||||
(cond
|
||||
((re-search-forward org-table-calculate-mark-regexp end t)
|
||||
;; This is a table with marked lines, compute selected
|
||||
;; lines.
|
||||
(setq line-re org-table-recalculate-regexp))
|
||||
;; Move forward to the first non-header line.
|
||||
((and (re-search-forward org-table-dataline-regexp end t)
|
||||
(re-search-forward org-table-hline-regexp end t)
|
||||
(re-search-forward org-table-dataline-regexp end t))
|
||||
(setq beg (match-beginning 0)))
|
||||
;; Just leave BEG at the start of the table.
|
||||
(t nil)))
|
||||
(setq beg (line-beginning-position)
|
||||
end (copy-marker (line-beginning-position 2))))
|
||||
(goto-char beg)
|
||||
;; Mark named fields untouchable. Also check if several
|
||||
;; field/range formulas try to set the same field.
|
||||
(remove-text-properties beg end '(:org-untouchable t))
|
||||
(let ((current-line (count-lines org-table-current-begin-pos
|
||||
(line-beginning-position)))
|
||||
seen-fields)
|
||||
(dolist (eq eqlfield)
|
||||
(let* ((name (car eq))
|
||||
(location (assoc name org-table-named-field-locations))
|
||||
(eq-line (or (nth 1 location)
|
||||
(and (string-match "\\`@\\([0-9]+\\)" name)
|
||||
(aref org-table-dlines
|
||||
(string-to-number
|
||||
(match-string 1 name))))))
|
||||
(reference
|
||||
(if location
|
||||
;; Turn field coordinates associated to NAME
|
||||
;; into an absolute reference.
|
||||
(format "@%d$%d"
|
||||
(org-table-line-to-dline eq-line)
|
||||
(nth 2 location))
|
||||
name)))
|
||||
(when (member reference seen-fields)
|
||||
(user-error "Several field/range formulas try to set %s"
|
||||
reference))
|
||||
(push reference seen-fields)
|
||||
(when (or all (eq eq-line current-line))
|
||||
(org-table-goto-field name)
|
||||
(org-table-put-field-property :org-untouchable t)))))
|
||||
;; Evaluate the column formulas, but skip fields covered by
|
||||
;; field formulas.
|
||||
(goto-char beg)
|
||||
(while (re-search-forward line-re end t)
|
||||
(unless (string-match "\\` *[_^!$/] *\\'" (org-table-get-field 1))
|
||||
;; Unprotected line, recalculate.
|
||||
(cl-incf cnt)
|
||||
(when all
|
||||
(setq log-last-time
|
||||
(org-table-message-once-per-second
|
||||
log-last-time
|
||||
"Re-applying formulas to full table...(line %d)" cnt)))
|
||||
(if (markerp org-last-recalc-line)
|
||||
(move-marker org-last-recalc-line (line-beginning-position))
|
||||
(setq org-last-recalc-line
|
||||
(copy-marker (line-beginning-position))))
|
||||
(dolist (entry eqlcol)
|
||||
(goto-char org-last-recalc-line)
|
||||
(org-table-goto-column
|
||||
(string-to-number (substring (car entry) 1)) nil 'force)
|
||||
(unless (get-text-property (point) :org-untouchable)
|
||||
(org-table-eval-formula
|
||||
nil (cdr entry) 'noalign 'nocst 'nostore 'noanalysis)))))
|
||||
;; Evaluate the field formulas.
|
||||
(dolist (eq eqlfield)
|
||||
(let ((reference (car eq))
|
||||
(formula (cdr eq)))
|
||||
(setq log-last-time
|
||||
(org-table-message-once-per-second
|
||||
(and all log-last-time)
|
||||
"Re-applying formula to field: %s" (car eq)))
|
||||
(org-table-goto-field
|
||||
reference
|
||||
;; Possibly create a new column, as long as
|
||||
;; `org-table-formula-create-columns' allows it.
|
||||
(let ((column-count (progn (end-of-line)
|
||||
(1- (org-table-current-column)))))
|
||||
(lambda (column)
|
||||
(when (> column 1000)
|
||||
(user-error "Formula column target too large"))
|
||||
(and (> column column-count)
|
||||
(or (eq org-table-formula-create-columns t)
|
||||
(and (eq org-table-formula-create-columns 'warn)
|
||||
(progn
|
||||
(org-display-warning
|
||||
"Out-of-bounds formula added columns")
|
||||
t))
|
||||
(and (eq org-table-formula-create-columns 'prompt)
|
||||
(yes-or-no-p
|
||||
"Out-of-bounds formula. Add columns? "))
|
||||
(user-error
|
||||
"Missing columns in the table. Aborting"))))))
|
||||
(org-table-eval-formula nil formula t t t t)))
|
||||
;; Clean up markers and internal text property.
|
||||
(remove-text-properties (point-min) (point-max) '(:org-untouchable t))
|
||||
(set-marker end nil)))
|
||||
(unless noalign
|
||||
(when org-table-may-need-update (org-table-align))
|
||||
(when all
|
||||
|
|
340
lisp/org.el
340
lisp/org.el
|
@ -4,7 +4,6 @@
|
|||
;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
|
||||
;;
|
||||
;; Author: Carsten Dominik <carsten at orgmode dot org>
|
||||
;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
|
||||
;; Keywords: outlines, hypermedia, calendar, wp
|
||||
;; Homepage: https://orgmode.org
|
||||
;; Version: 9.2.3
|
||||
|
@ -907,8 +906,7 @@ depends on, if any."
|
|||
|
||||
(defcustom org-support-shift-select nil
|
||||
"Non-nil means make shift-cursor commands select text when possible.
|
||||
\\<org-mode-map>\
|
||||
|
||||
\\<org-mode-map>
|
||||
In Emacs 23, when `shift-select-mode' is on, shifted cursor keys
|
||||
start selecting a region, or enlarge regions started in this way.
|
||||
In Org mode, in special contexts, these same keys are used for
|
||||
|
@ -2284,8 +2282,7 @@ See `org-file-apps'.")
|
|||
("\\.x?html?\\'" . default)
|
||||
("\\.pdf\\'" . default))
|
||||
"External applications for opening `file:path' items in a document.
|
||||
\\<org-mode-map>\
|
||||
|
||||
\\<org-mode-map>
|
||||
Org mode uses system defaults for different file types, but
|
||||
you can use this variable to set the application for a given file
|
||||
extension. The entries in this list are cons cells where the car identifies
|
||||
|
@ -4181,7 +4178,7 @@ Each element is either a cell or a string.
|
|||
|
||||
A cell is of the format:
|
||||
|
||||
(\"options\" \"package\" SNIPPET-FLAG)
|
||||
(\"options\" \"package\" SNIPPET-FLAG COMPILERS)
|
||||
|
||||
SNIPPET-FLAG, when non-nil, indicates that this package is also
|
||||
needed when turning LaTeX snippets into images for inclusion into
|
||||
|
@ -14564,168 +14561,169 @@ Returns the new tags string, or nil to not change the current settings."
|
|||
" "
|
||||
(make-string (- org-tags-column (current-column)) ?\ ))))))
|
||||
(move-overlay org-tags-overlay ov-start ov-end)
|
||||
(save-window-excursion
|
||||
(if expert
|
||||
(set-buffer (get-buffer-create " *Org tags*"))
|
||||
(delete-other-windows)
|
||||
(set-window-buffer (split-window-vertically) (get-buffer-create " *Org tags*"))
|
||||
(org-switch-to-buffer-other-window " *Org tags*"))
|
||||
(erase-buffer)
|
||||
(setq-local org-done-keywords done-keywords)
|
||||
(org-fast-tag-insert "Inherited" inherited i-face "\n")
|
||||
(org-fast-tag-insert "Current" current c-face "\n\n")
|
||||
(org-fast-tag-show-exit exit-after-next)
|
||||
(org-set-current-tags-overlay current ov-prefix)
|
||||
(setq tbl fulltable char ?a cnt 0)
|
||||
(while (setq e (pop tbl))
|
||||
(cond
|
||||
((eq (car e) :startgroup)
|
||||
(push '() groups) (setq ingroup t)
|
||||
(unless (zerop cnt)
|
||||
(setq cnt 0)
|
||||
(insert "\n"))
|
||||
(insert (if (cdr e) (format "%s: " (cdr e)) "") "{ "))
|
||||
((eq (car e) :endgroup)
|
||||
(setq ingroup nil cnt 0)
|
||||
(insert "}" (if (cdr e) (format " (%s) " (cdr e)) "") "\n"))
|
||||
((eq (car e) :startgrouptag)
|
||||
(setq intaggroup t)
|
||||
(unless (zerop cnt)
|
||||
(setq cnt 0)
|
||||
(insert "\n"))
|
||||
(insert "[ "))
|
||||
((eq (car e) :endgrouptag)
|
||||
(setq intaggroup nil cnt 0)
|
||||
(insert "]\n"))
|
||||
((equal e '(:newline))
|
||||
(unless (zerop cnt)
|
||||
(setq cnt 0)
|
||||
(insert "\n")
|
||||
(setq e (car tbl))
|
||||
(while (equal (car tbl) '(:newline))
|
||||
(save-excursion
|
||||
(save-window-excursion
|
||||
(if expert
|
||||
(set-buffer (get-buffer-create " *Org tags*"))
|
||||
(delete-other-windows)
|
||||
(set-window-buffer (split-window-vertically) (get-buffer-create " *Org tags*"))
|
||||
(org-switch-to-buffer-other-window " *Org tags*"))
|
||||
(erase-buffer)
|
||||
(setq-local org-done-keywords done-keywords)
|
||||
(org-fast-tag-insert "Inherited" inherited i-face "\n")
|
||||
(org-fast-tag-insert "Current" current c-face "\n\n")
|
||||
(org-fast-tag-show-exit exit-after-next)
|
||||
(org-set-current-tags-overlay current ov-prefix)
|
||||
(setq tbl fulltable char ?a cnt 0)
|
||||
(while (setq e (pop tbl))
|
||||
(cond
|
||||
((eq (car e) :startgroup)
|
||||
(push '() groups) (setq ingroup t)
|
||||
(unless (zerop cnt)
|
||||
(setq cnt 0)
|
||||
(insert "\n"))
|
||||
(insert (if (cdr e) (format "%s: " (cdr e)) "") "{ "))
|
||||
((eq (car e) :endgroup)
|
||||
(setq ingroup nil cnt 0)
|
||||
(insert "}" (if (cdr e) (format " (%s) " (cdr e)) "") "\n"))
|
||||
((eq (car e) :startgrouptag)
|
||||
(setq intaggroup t)
|
||||
(unless (zerop cnt)
|
||||
(setq cnt 0)
|
||||
(insert "\n"))
|
||||
(insert "[ "))
|
||||
((eq (car e) :endgrouptag)
|
||||
(setq intaggroup nil cnt 0)
|
||||
(insert "]\n"))
|
||||
((equal e '(:newline))
|
||||
(unless (zerop cnt)
|
||||
(setq cnt 0)
|
||||
(insert "\n")
|
||||
(setq tbl (cdr tbl)))))
|
||||
((equal e '(:grouptags)) (insert " : "))
|
||||
(t
|
||||
(setq tg (copy-sequence (car e)) c2 nil)
|
||||
(if (cdr e)
|
||||
(setq c (cdr e))
|
||||
;; automatically assign a character.
|
||||
(setq c1 (string-to-char
|
||||
(downcase (substring
|
||||
tg (if (= (string-to-char tg) ?@) 1 0)))))
|
||||
(if (or (rassoc c1 ntable) (rassoc c1 table))
|
||||
(while (or (rassoc char ntable) (rassoc char table))
|
||||
(setq char (1+ char)))
|
||||
(setq c2 c1))
|
||||
(setq c (or c2 char)))
|
||||
(when ingroup (push tg (car groups)))
|
||||
(setq tg (org-add-props tg nil 'face
|
||||
(cond
|
||||
((not (assoc tg table))
|
||||
(org-get-todo-face tg))
|
||||
((member tg current) c-face)
|
||||
((member tg inherited) i-face))))
|
||||
(when (equal (caar tbl) :grouptags)
|
||||
(org-add-props tg nil 'face 'org-tag-group))
|
||||
(when (and (zerop cnt) (not ingroup) (not intaggroup)) (insert " "))
|
||||
(insert "[" c "] " tg (make-string
|
||||
(- fwidth 4 (length tg)) ?\ ))
|
||||
(push (cons tg c) ntable)
|
||||
(when (= (cl-incf cnt) ncol)
|
||||
(unless (memq (caar tbl) '(:endgroup :endgrouptag))
|
||||
(insert "\n")
|
||||
(when (or ingroup intaggroup) (insert " ")))
|
||||
(setq cnt 0)))))
|
||||
(setq ntable (nreverse ntable))
|
||||
(insert "\n")
|
||||
(goto-char (point-min))
|
||||
(unless expert (org-fit-window-to-buffer))
|
||||
(setq rtn
|
||||
(catch 'exit
|
||||
(while t
|
||||
(message "[a-z..]:toggle [SPC]:clear [RET]:accept [TAB]:edit [!] %sgroups%s"
|
||||
(if (not groups) "no " "")
|
||||
(if expert " [C-c]:window" (if exit-after-next " [C-c]:single" " [C-c]:multi")))
|
||||
(setq c (let ((inhibit-quit t)) (read-char-exclusive)))
|
||||
(setq org-last-tag-selection-key c)
|
||||
(cond
|
||||
((= c ?\r) (throw 'exit t))
|
||||
((= c ?!)
|
||||
(setq groups (not groups))
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "[{}]" nil t) (replace-match " ")))
|
||||
((= c ?\C-c)
|
||||
(if (not expert)
|
||||
(org-fast-tag-show-exit
|
||||
(setq exit-after-next (not exit-after-next)))
|
||||
(setq expert nil)
|
||||
(delete-other-windows)
|
||||
(set-window-buffer (split-window-vertically) " *Org tags*")
|
||||
(org-switch-to-buffer-other-window " *Org tags*")
|
||||
(org-fit-window-to-buffer)))
|
||||
((or (= c ?\C-g)
|
||||
(and (= c ?q) (not (rassoc c ntable))))
|
||||
(delete-overlay org-tags-overlay)
|
||||
(setq quit-flag t))
|
||||
((= c ?\ )
|
||||
(setq current nil)
|
||||
(when exit-after-next (setq exit-after-next 'now)))
|
||||
((= c ?\t)
|
||||
(condition-case nil
|
||||
(setq tg (completing-read
|
||||
"Tag: "
|
||||
(or buffer-tags
|
||||
(with-current-buffer buf
|
||||
(setq buffer-tags
|
||||
(org-get-buffer-tags))))))
|
||||
(quit (setq tg "")))
|
||||
(when (string-match "\\S-" tg)
|
||||
(cl-pushnew (list tg) buffer-tags :test #'equal)
|
||||
(setq e (car tbl))
|
||||
(while (equal (car tbl) '(:newline))
|
||||
(insert "\n")
|
||||
(setq tbl (cdr tbl)))))
|
||||
((equal e '(:grouptags)) (insert " : "))
|
||||
(t
|
||||
(setq tg (copy-sequence (car e)) c2 nil)
|
||||
(if (cdr e)
|
||||
(setq c (cdr e))
|
||||
;; automatically assign a character.
|
||||
(setq c1 (string-to-char
|
||||
(downcase (substring
|
||||
tg (if (= (string-to-char tg) ?@) 1 0)))))
|
||||
(if (or (rassoc c1 ntable) (rassoc c1 table))
|
||||
(while (or (rassoc char ntable) (rassoc char table))
|
||||
(setq char (1+ char)))
|
||||
(setq c2 c1))
|
||||
(setq c (or c2 char)))
|
||||
(when ingroup (push tg (car groups)))
|
||||
(setq tg (org-add-props tg nil 'face
|
||||
(cond
|
||||
((not (assoc tg table))
|
||||
(org-get-todo-face tg))
|
||||
((member tg current) c-face)
|
||||
((member tg inherited) i-face))))
|
||||
(when (equal (caar tbl) :grouptags)
|
||||
(org-add-props tg nil 'face 'org-tag-group))
|
||||
(when (and (zerop cnt) (not ingroup) (not intaggroup)) (insert " "))
|
||||
(insert "[" c "] " tg (make-string
|
||||
(- fwidth 4 (length tg)) ?\ ))
|
||||
(push (cons tg c) ntable)
|
||||
(when (= (cl-incf cnt) ncol)
|
||||
(unless (memq (caar tbl) '(:endgroup :endgrouptag))
|
||||
(insert "\n")
|
||||
(when (or ingroup intaggroup) (insert " ")))
|
||||
(setq cnt 0)))))
|
||||
(setq ntable (nreverse ntable))
|
||||
(insert "\n")
|
||||
(goto-char (point-min))
|
||||
(unless expert (org-fit-window-to-buffer))
|
||||
(setq rtn
|
||||
(catch 'exit
|
||||
(while t
|
||||
(message "[a-z..]:toggle [SPC]:clear [RET]:accept [TAB]:edit [!] %sgroups%s"
|
||||
(if (not groups) "no " "")
|
||||
(if expert " [C-c]:window" (if exit-after-next " [C-c]:single" " [C-c]:multi")))
|
||||
(setq c (let ((inhibit-quit t)) (read-char-exclusive)))
|
||||
(setq org-last-tag-selection-key c)
|
||||
(cond
|
||||
((= c ?\r) (throw 'exit t))
|
||||
((= c ?!)
|
||||
(setq groups (not groups))
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward "[{}]" nil t) (replace-match " ")))
|
||||
((= c ?\C-c)
|
||||
(if (not expert)
|
||||
(org-fast-tag-show-exit
|
||||
(setq exit-after-next (not exit-after-next)))
|
||||
(setq expert nil)
|
||||
(delete-other-windows)
|
||||
(set-window-buffer (split-window-vertically) " *Org tags*")
|
||||
(org-switch-to-buffer-other-window " *Org tags*")
|
||||
(org-fit-window-to-buffer)))
|
||||
((or (= c ?\C-g)
|
||||
(and (= c ?q) (not (rassoc c ntable))))
|
||||
(delete-overlay org-tags-overlay)
|
||||
(setq quit-flag t))
|
||||
((= c ?\ )
|
||||
(setq current nil)
|
||||
(when exit-after-next (setq exit-after-next 'now)))
|
||||
((= c ?\t)
|
||||
(condition-case nil
|
||||
(setq tg (completing-read
|
||||
"Tag: "
|
||||
(or buffer-tags
|
||||
(with-current-buffer buf
|
||||
(setq buffer-tags
|
||||
(org-get-buffer-tags))))))
|
||||
(quit (setq tg "")))
|
||||
(when (string-match "\\S-" tg)
|
||||
(cl-pushnew (list tg) buffer-tags :test #'equal)
|
||||
(if (member tg current)
|
||||
(setq current (delete tg current))
|
||||
(push tg current)))
|
||||
(when exit-after-next (setq exit-after-next 'now)))
|
||||
((setq e (rassoc c todo-table) tg (car e))
|
||||
(with-current-buffer buf
|
||||
(save-excursion (org-todo tg)))
|
||||
(when exit-after-next (setq exit-after-next 'now)))
|
||||
((setq e (rassoc c ntable) tg (car e))
|
||||
(if (member tg current)
|
||||
(setq current (delete tg current))
|
||||
(push tg current)))
|
||||
(when exit-after-next (setq exit-after-next 'now)))
|
||||
((setq e (rassoc c todo-table) tg (car e))
|
||||
(with-current-buffer buf
|
||||
(save-excursion (org-todo tg)))
|
||||
(when exit-after-next (setq exit-after-next 'now)))
|
||||
((setq e (rassoc c ntable) tg (car e))
|
||||
(if (member tg current)
|
||||
(setq current (delete tg current))
|
||||
(cl-loop for g in groups do
|
||||
(when (member tg g)
|
||||
(dolist (x g) (setq current (delete x current)))))
|
||||
(push tg current))
|
||||
(when exit-after-next (setq exit-after-next 'now))))
|
||||
(cl-loop for g in groups do
|
||||
(when (member tg g)
|
||||
(dolist (x g) (setq current (delete x current)))))
|
||||
(push tg current))
|
||||
(when exit-after-next (setq exit-after-next 'now))))
|
||||
|
||||
;; Create a sorted list
|
||||
(setq current
|
||||
(sort current
|
||||
(lambda (a b)
|
||||
(assoc b (cdr (memq (assoc a ntable) ntable))))))
|
||||
(when (eq exit-after-next 'now) (throw 'exit t))
|
||||
(goto-char (point-min))
|
||||
(beginning-of-line 2)
|
||||
(delete-region (point) (point-at-eol))
|
||||
(org-fast-tag-insert "Current" current c-face)
|
||||
(org-set-current-tags-overlay current ov-prefix)
|
||||
(let ((tag-re (concat "\\[.\\] \\(" org-tag-re "\\)")))
|
||||
(while (re-search-forward tag-re nil t)
|
||||
(let ((tag (match-string 1)))
|
||||
(add-text-properties
|
||||
(match-beginning 1) (match-end 1)
|
||||
(list 'face
|
||||
(cond
|
||||
((member tag current) c-face)
|
||||
((member tag inherited) i-face)
|
||||
(t (get-text-property (match-beginning 1) '
|
||||
face))))))))
|
||||
(goto-char (point-min)))))
|
||||
(delete-overlay org-tags-overlay)
|
||||
(if rtn
|
||||
(mapconcat 'identity current ":")
|
||||
nil))))
|
||||
;; Create a sorted list
|
||||
(setq current
|
||||
(sort current
|
||||
(lambda (a b)
|
||||
(assoc b (cdr (memq (assoc a ntable) ntable))))))
|
||||
(when (eq exit-after-next 'now) (throw 'exit t))
|
||||
(goto-char (point-min))
|
||||
(beginning-of-line 2)
|
||||
(delete-region (point) (point-at-eol))
|
||||
(org-fast-tag-insert "Current" current c-face)
|
||||
(org-set-current-tags-overlay current ov-prefix)
|
||||
(let ((tag-re (concat "\\[.\\] \\(" org-tag-re "\\)")))
|
||||
(while (re-search-forward tag-re nil t)
|
||||
(let ((tag (match-string 1)))
|
||||
(add-text-properties
|
||||
(match-beginning 1) (match-end 1)
|
||||
(list 'face
|
||||
(cond
|
||||
((member tag current) c-face)
|
||||
((member tag inherited) i-face)
|
||||
(t (get-text-property (match-beginning 1) '
|
||||
face))))))))
|
||||
(goto-char (point-min)))))
|
||||
(delete-overlay org-tags-overlay)
|
||||
(if rtn
|
||||
(mapconcat 'identity current ":")
|
||||
nil)))))
|
||||
|
||||
(defun org-make-tag-string (tags)
|
||||
"Return string associated to TAGS.
|
||||
|
@ -17377,10 +17375,16 @@ When matching, the match groups are the following:
|
|||
(defvar org-clock-adjust-closest nil) ; defined in org-clock.el
|
||||
(defun org-timestamp-change (n &optional what updown suppress-tmp-delay)
|
||||
"Change the date in the time stamp at point.
|
||||
The date will be changed by N times WHAT. WHAT can be `day', `month',
|
||||
`year', `minute', `second'. If WHAT is not given, the cursor position
|
||||
in the timestamp determines what will be changed.
|
||||
When SUPPRESS-TMP-DELAY is non-nil, suppress delays like \"--2d\"."
|
||||
|
||||
The date is changed by N times WHAT. WHAT can be `day', `month',
|
||||
`year', `hour', or `minute'. If WHAT is not given, the cursor
|
||||
position in the timestamp determines what is changed.
|
||||
|
||||
When optional argument UPDOWN is non-nil, minutes are rounded
|
||||
according to `org-time-stamp-rounding-minutes'.
|
||||
|
||||
When SUPPRESS-TMP-DELAY is non-nil, suppress delays like
|
||||
\"--2d\"."
|
||||
(let ((origin (point))
|
||||
(timestamp? (org-at-timestamp-p 'lax))
|
||||
origin-cat
|
||||
|
|
|
@ -1998,8 +1998,9 @@ communication channel."
|
|||
(plist-get info :html-metadata-timestamp-format))))
|
||||
(when (plist-get info :with-creator)
|
||||
(format "<p class=\"creator\">%s</p>\n" creator))
|
||||
(format "<p class=\"validation\">%s</p>\n"
|
||||
validation-link))))
|
||||
(when (org-string-nw-p validation-link)
|
||||
(format "<p class=\"validation\">%s</p>\n"
|
||||
validation-link)))))
|
||||
(t
|
||||
(let ((formats (plist-get info (if (eq type 'preamble)
|
||||
:html-preamble-format
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
|
||||
|
||||
;; Author: David O'Toole <dto@gnu.org>
|
||||
;; Maintainer: Carsten Dominik <carsten DOT dominik AT gmail DOT com>
|
||||
;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
|
||||
;; Keywords: hypermedia, outlines, wp
|
||||
|
||||
;; This file is part of GNU Emacs.
|
||||
|
|
46
lisp/ox.el
46
lisp/ox.el
|
@ -4916,26 +4916,32 @@ same column as TABLE-CELL, or nil."
|
|||
(plist-put info :table-cell-width-cache table)
|
||||
table)))
|
||||
(width-vector (or (gethash table cache)
|
||||
(puthash table (make-vector columns 'empty) cache)))
|
||||
(value (aref width-vector column)))
|
||||
(if (not (eq value 'empty)) value
|
||||
(let (cookie-width)
|
||||
(dolist (row (org-element-contents table)
|
||||
(aset width-vector column cookie-width))
|
||||
(when (org-export-table-row-is-special-p row info)
|
||||
;; In a special row, try to find a width cookie at COLUMN.
|
||||
(let* ((value (org-element-contents
|
||||
(elt (org-element-contents row) column)))
|
||||
(cookie (car value)))
|
||||
;; The following checks avoid expanding unnecessarily
|
||||
;; the cell with `org-export-data'.
|
||||
(when (and value
|
||||
(not (cdr value))
|
||||
(stringp cookie)
|
||||
(string-match "\\`<[lrc]?\\([0-9]+\\)?>\\'" cookie)
|
||||
(match-string 1 cookie))
|
||||
(setq cookie-width
|
||||
(string-to-number (match-string 1 cookie)))))))))))
|
||||
(puthash table (make-vector columns 'empty) cache))))
|
||||
;; Table may not have the same number of rows. Extend
|
||||
;; WIDTH-VECTOR appropriately if we encounter a row larger than
|
||||
;; expected.
|
||||
(when (>= column (length width-vector))
|
||||
(setq width-vector
|
||||
(vconcat width-vector
|
||||
(make-list (- (1+ column) (length width-vector))
|
||||
'empty)))
|
||||
(puthash table width-vector cache))
|
||||
(pcase (aref width-vector column)
|
||||
(`empty
|
||||
(catch 'found
|
||||
(dolist (row (org-element-contents table))
|
||||
(when (org-export-table-row-is-special-p row info)
|
||||
;; In a special row, try to find a width cookie at
|
||||
;; COLUMN. The following checks avoid expanding
|
||||
;; unnecessarily the cell with `org-export-data'.
|
||||
(pcase (org-element-contents
|
||||
(elt (org-element-contents row) column))
|
||||
(`(,(and (pred stringp) cookie))
|
||||
(when (string-match "\\`<[lrc]?\\([0-9]+\\)>\\'" cookie)
|
||||
(let ((w (string-to-number (match-string 1 cookie))))
|
||||
(throw 'found (aset width-vector column w))))))))
|
||||
(aset width-vector column nil)))
|
||||
(value value))))
|
||||
|
||||
(defun org-export-table-cell-alignment (table-cell info)
|
||||
"Return TABLE-CELL contents alignment.
|
||||
|
|
|
@ -22,57 +22,58 @@
|
|||
(signal 'missing-test-dependency "Support for Ruby code blocks"))
|
||||
|
||||
(ert-deftest test-ob-ruby/session-output-1 ()
|
||||
(should (equal (org-test-with-temp-text "#+begin_src ruby :session :results output
|
||||
(should (equal (org-test-with-temp-text "#+begin_src ruby :session org-test-ruby :results output
|
||||
s = \"1\"
|
||||
s = \"2\"
|
||||
s = \"3\"
|
||||
puts s
|
||||
s = \"4\"
|
||||
#+end_src"
|
||||
(org-babel-execute-maybe)
|
||||
(substring-no-properties
|
||||
(buffer-string)))
|
||||
"#+begin_src ruby :session :results output
|
||||
"#+begin_src ruby :session org-test-ruby :results output
|
||||
s = \"1\"
|
||||
s = \"2\"
|
||||
s = \"3\"
|
||||
puts s
|
||||
s = \"4\"
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: 3
|
||||
|
||||
")))
|
||||
(ert-deftest test-ob-ruby/session-output-2 ()
|
||||
(should (equal (org-test-with-temp-text "#+begin_src ruby :session :results output
|
||||
s = \"5\"
|
||||
(should (equal (org-test-with-temp-text "#+begin_src ruby :session org-test-ruby :results output
|
||||
puts s
|
||||
s = \"5\"
|
||||
#+end_src"
|
||||
(org-babel-execute-maybe)
|
||||
(substring-no-properties
|
||||
(buffer-string)))
|
||||
"#+begin_src ruby :session :results output
|
||||
s = \"5\"
|
||||
"#+begin_src ruby :session org-test-ruby :results output
|
||||
puts s
|
||||
s = \"5\"
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: 5
|
||||
|
||||
: 4
|
||||
")))
|
||||
(ert-deftest test-ob-ruby/session-output-3 ()
|
||||
(should (equal (org-test-with-temp-text "#+begin_src ruby :session :results output
|
||||
(should (equal (org-test-with-temp-text "#+begin_src ruby :session org-test-ruby :results output
|
||||
puts s
|
||||
s = \"6\"
|
||||
#+end_src"
|
||||
(org-babel-execute-maybe)
|
||||
(substring-no-properties
|
||||
(buffer-string)))
|
||||
"#+begin_src ruby :session :results output
|
||||
"#+begin_src ruby :session org-test-ruby :results output
|
||||
puts s
|
||||
s = \"6\"
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: 5
|
||||
|
||||
")))
|
||||
|
||||
(provide 'test-ob-ruby)
|
||||
|
|
|
@ -223,7 +223,16 @@
|
|||
:immediate-finish t))))
|
||||
(org-capture nil "t")
|
||||
(org-capture '(16))
|
||||
(buffer-substring (point) (line-end-position)))))))
|
||||
(buffer-substring (point) (line-end-position))))))
|
||||
;; Do not raise an error on empty entries.
|
||||
(should
|
||||
(org-test-with-temp-text-in-file ""
|
||||
(let* ((file (buffer-file-name))
|
||||
(org-capture-templates
|
||||
`(("t" "Test" entry (file+headline ,file "A") "** "
|
||||
:immediate-finish t))))
|
||||
(org-capture nil "t")
|
||||
(buffer-string)))))
|
||||
|
||||
(ert-deftest test-org-capture/item ()
|
||||
"Test `item' type in capture template."
|
||||
|
@ -283,6 +292,41 @@
|
|||
(org-capture nil "t")
|
||||
(org-capture-finalize))
|
||||
(buffer-string))))
|
||||
;; If there is no list and `:prepend' is non-nil, insert list at the
|
||||
;; beginning of the entry, or the beginning of the buffer. However,
|
||||
;; preserve properties drawer and planning info, if any.
|
||||
(should
|
||||
(equal
|
||||
"* A\n- X\nSome text\n"
|
||||
(org-test-with-temp-text-in-file "* A\nSome text"
|
||||
(let* ((file (buffer-file-name))
|
||||
(org-capture-templates
|
||||
`(("t" "Item" item (file+headline ,file "A") "- X"
|
||||
:prepend t))))
|
||||
(org-capture nil "t")
|
||||
(org-capture-finalize))
|
||||
(buffer-string))))
|
||||
(should
|
||||
(equal
|
||||
"- X\nText\n"
|
||||
(org-test-with-temp-text-in-file "Text"
|
||||
(let* ((file (buffer-file-name))
|
||||
(org-capture-templates
|
||||
`(("t" "Item" item (file ,file) "- X" :prepend t))))
|
||||
(org-capture nil "t")
|
||||
(org-capture-finalize))
|
||||
(buffer-string))))
|
||||
(should
|
||||
(equal
|
||||
"* A\nSCHEDULED: <2012-03-29 Thu>\n- X\nText\n"
|
||||
(org-test-with-temp-text-in-file "* A\nSCHEDULED: <2012-03-29 Thu>\nText"
|
||||
(let* ((file (buffer-file-name))
|
||||
(org-capture-templates
|
||||
`(("t" "Item" item (file+headline ,file "A") "- X"
|
||||
:prepend t))))
|
||||
(org-capture nil "t")
|
||||
(org-capture-finalize))
|
||||
(buffer-string))))
|
||||
;; When `:prepend' is nil, insert new item as the last top-level
|
||||
;; item.
|
||||
(should
|
||||
|
|
|
@ -103,18 +103,7 @@
|
|||
"#+MACRO: macro expansion\n* COMMENT H1\n** H2\n<point>{{{macro}}}"
|
||||
(org-macro-initialize-templates)
|
||||
(org-macro-replace-all org-macro-templates)
|
||||
(org-with-wide-buffer (buffer-string)))))
|
||||
;; User-defined macros take precedence over built-in macros.
|
||||
(should
|
||||
(equal
|
||||
"foo"
|
||||
(org-test-with-temp-text
|
||||
"#+MACRO: title foo\n#+TITLE: bar\n<point>{{{title}}}"
|
||||
(org-macro-initialize-templates)
|
||||
(org-macro-replace-all org-macro-templates)
|
||||
(goto-char (point-max))
|
||||
(buffer-substring-no-properties (line-beginning-position)
|
||||
(line-end-position))))))
|
||||
(org-with-wide-buffer (buffer-string))))))
|
||||
|
||||
(ert-deftest test-org-macro/property ()
|
||||
"Test {{{property}}} macro."
|
||||
|
@ -312,16 +301,6 @@
|
|||
"#+keyword: value\n<point>{{{keyword(KEYWORD)}}}"
|
||||
(org-macro-initialize-templates)
|
||||
(org-macro-replace-all org-macro-templates)
|
||||
(buffer-substring-no-properties
|
||||
(line-beginning-position) (point-max)))))
|
||||
;; Replace macro with keyword's value.
|
||||
(should
|
||||
(equal
|
||||
"value value2"
|
||||
(org-test-with-temp-text
|
||||
"#+keyword: value\n#+keyword: value2\n<point>{{{keyword(KEYWORD)}}}"
|
||||
(org-macro-initialize-templates)
|
||||
(org-macro-replace-all org-macro-templates)
|
||||
(buffer-substring-no-properties
|
||||
(line-beginning-position) (point-max))))))
|
||||
|
||||
|
|
|
@ -2640,7 +2640,14 @@ See also `test-org-table/copy-field'."
|
|||
(org-table-toggle-column-width)
|
||||
(org-table-align)
|
||||
(mapcar (lambda (o) (overlay-get o 'help-echo))
|
||||
(overlays-in (line-beginning-position) (line-end-position)))))))
|
||||
(overlays-in (line-beginning-position) (line-end-position))))))
|
||||
;; Recalculating formulas doesn't change shrunk state.
|
||||
(should
|
||||
(equal "2"
|
||||
(org-test-with-temp-text "| 1 | <point>0 |\n#+TBLFM: $2=$1+1\n"
|
||||
(org-table-toggle-column-width)
|
||||
(org-table-recalculate)
|
||||
(overlay-get (car (overlays-at (point))) 'help-echo)))))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -4148,33 +4148,28 @@ Another text. (ref:text)
|
|||
|
||||
(ert-deftest test-org-export/table-cell-width ()
|
||||
"Test `org-export-table-cell-width' specifications."
|
||||
;; 1. Width is primarily determined by width cookies. If no cookie
|
||||
;; is found, cell's width is nil.
|
||||
(org-test-with-parsed-data "
|
||||
;; Width is primarily determined by width cookies. If no cookie is
|
||||
;; found, cell's width is nil.
|
||||
(should
|
||||
(equal '(nil 6 7)
|
||||
(org-test-with-parsed-data "
|
||||
| / | <l> | <6> | <l7> |
|
||||
| | a | b | c |"
|
||||
(should
|
||||
(equal
|
||||
'(nil 6 7)
|
||||
(mapcar (lambda (cell) (org-export-table-cell-width cell info))
|
||||
(org-element-map tree 'table-cell 'identity info)))))
|
||||
;; 2. The last width cookie has precedence.
|
||||
(org-test-with-parsed-data "
|
||||
| <6> |
|
||||
| <7> |
|
||||
| a |"
|
||||
(should
|
||||
(equal
|
||||
'(7)
|
||||
(mapcar (lambda (cell) (org-export-table-cell-width cell info))
|
||||
(org-element-map tree 'table-cell 'identity info)))))
|
||||
;; 3. Valid width cookies must have a specific row.
|
||||
(org-test-with-parsed-data "| <6> | cell |"
|
||||
(should
|
||||
(equal
|
||||
'(nil nil)
|
||||
(mapcar (lambda (cell) (org-export-table-cell-width cell info))
|
||||
(org-element-map tree 'table-cell 'identity))))))
|
||||
(mapcar (lambda (cell) (org-export-table-cell-width cell info))
|
||||
(org-element-map tree 'table-cell 'identity info)))))
|
||||
;; Valid width cookies must have a specific row.
|
||||
(should
|
||||
(equal '(nil nil)
|
||||
(org-test-with-parsed-data "| <6> | cell |"
|
||||
(mapcar (lambda (cell) (org-export-table-cell-width cell info))
|
||||
(org-element-map tree 'table-cell 'identity)))))
|
||||
;; Do not error on malformed tables.
|
||||
(should
|
||||
(org-test-with-parsed-data "
|
||||
| a |
|
||||
| b | c |"
|
||||
(mapcar (lambda (cell) (org-export-table-cell-width cell info))
|
||||
(org-element-map tree 'table-cell 'identity info)))))
|
||||
|
||||
(ert-deftest test-org-export/table-cell-alignment ()
|
||||
"Test `org-export-table-cell-alignment' specifications."
|
||||
|
|
Loading…
Reference in New Issue