Merge branch 'maint' into emacs-sync

This commit is contained in:
Kyle Meyer 2018-04-22 11:04:26 -04:00
commit cbe154c27c
13 changed files with 117 additions and 57 deletions

View File

@ -137,15 +137,16 @@ simple timestamp string."
"Create the todo-list for one org-agenda file."
(let* ((files (org-agenda-files 'unrestricted))
(max (1- (length files))))
(setq org-notify-parse-file
(if (or (not org-notify-parse-file) (>= org-notify-parse-file max))
0
(1+ org-notify-parse-file)))
(save-excursion
(with-current-buffer (find-file-noselect
(nth org-notify-parse-file files))
(org-element-map (org-element-parse-buffer 'headline)
'headline 'org-notify-make-todo)))))
(when files
(setq org-notify-parse-file
(if (or (not org-notify-parse-file) (>= org-notify-parse-file max))
0
(1+ org-notify-parse-file)))
(save-excursion
(with-current-buffer (find-file-noselect
(nth org-notify-parse-file files))
(org-element-map (org-element-parse-buffer 'headline)
'headline 'org-notify-make-todo))))))
(defun org-notify-maybe-too-late (diff period heading)
"Print warning message, when notified significantly later than defined by

View File

@ -924,6 +924,7 @@ You can clone Org's repository and install Org like this:
@example
$ cd ~/src/
$ git clone https://code.orgmode.org/bzg/org-mode.git
$ cd org-mode/
$ make autoloads
@end example
@ -7594,7 +7595,7 @@ To use this feature, add a bookmark with an arbitrary name, e.g. @samp{Org:
capture} and enter this as @samp{Location}:
@example
javascript:location.href='org-protocol://template=x'+
javascript:location.href='org-protocol://capture?template=x'+
'&url='+encodeURIComponent(window.location.href)+
'&title='+encodeURIComponent(document.title)+
'&body='+encodeURIComponent(window.getSelection());
@ -12670,12 +12671,12 @@ The @LaTeX{} export back-end converts horizontal rules by the specified
@section Markdown export
@cindex Markdown export
The Markdown export back-end, @code{md}, converts an Org file to a Markdown
The Markdown export back-end, @code{md}, converts an Org file to Markdown
format, as defined at @url{http://daringfireball.net/projects/markdown/}.
Since @code{md} is built on top of the HTML back-end, any Org constructs not
supported by Markdown, such as tables, the underlying @code{html} back-end
(@pxref{HTML export}) converts them.
The @code{md} back-end is built on top of the HTML back-end (@pxref{HTML
export}). As a consequence, it converts every Org construct not supported by
Markdown syntax, such as tables, to HTML.
@subheading Markdown export commands

View File

@ -308,9 +308,21 @@ last statement in BODY, as elisp."
(list (format "open('%s', 'w').write(str(_))"
(org-babel-process-file-name tmp-file
'noquote)))))))
(last-indent 0)
(input-body (lambda (body)
(mapc (lambda (line) (insert line) (funcall send-wait))
(split-string body "[\r\n]"))
(dolist (line (split-string body "[\r\n]"))
;; Insert a blank line to end an indent
;; block.
(let ((curr-indent (string-match "\\S-" line)))
(if curr-indent
(progn
(when (< curr-indent last-indent)
(insert "")
(funcall send-wait))
(setq last-indent curr-indent))
(setq last-indent 0)))
(insert line)
(funcall send-wait))
(funcall send-wait)))
(results
(pcase result-type

View File

@ -4,7 +4,7 @@
;; Author: Bjarte Johansen
;; Keywords: literate programming, reproducible research
;; Version: 0.1.0
;; Version: 0.1.1
;; This file is part of GNU Emacs.
@ -79,7 +79,7 @@ function is called by `org-babel-execute-src-block'."
(cmd (mapconcat #'identity
(remq nil
(list org-babel-sed-command
(format "--file=\"%s\"" code-file)
(format "-f \"%s\"" code-file)
cmd-line
in-file))
" ")))

View File

@ -4261,8 +4261,9 @@ items if they have an hour specification like [h]h:mm."
(insert tbl)))
(goto-char (point-min))
(or org-agenda-multi (org-agenda-fit-window-to-buffer))
(unless (and (pos-visible-in-window-p (point-min))
(pos-visible-in-window-p (point-max)))
(unless (or (not (get-buffer-window))
(and (pos-visible-in-window-p (point-min))
(pos-visible-in-window-p (point-max))))
(goto-char (1- (point-max)))
(recenter -1)
(if (not (pos-visible-in-window-p (or start-pos 1)))

View File

@ -1010,7 +1010,7 @@ Store them in the capture property list."
;; Use 00:00 when no time is given for another
;; date than today?
(apply #'encode-time
(append '(0 0 0)
(append `(0 0 ,org-extend-today-until)
(cl-cdddr (decode-time prompt-time)))))
((string-match "\\([^ ]+\\)--?[^ ]+[ ]+\\(.*\\)"
org-read-date-final-answer)

View File

@ -140,13 +140,13 @@ the structure of the Org file."
;; concat `org-mode' style url to `return-content'.
(setq return-content
(concat return-content
(if (stringp link-location)
;; hint: link-location is different for form-elements.
(if (org-string-nw-p link-location)
;; Hint: link-location is different
;; for form-elements.
(org-make-link-string link-location link-title)
link-title))))
(goto-char temp-position) ; reset point before jump next anchor
(setq out-bound t) ; for break out `while' loop
))
(setq out-bound t))) ; for break out `while' loop
;; Add the rest until end of the region to be copied.
(when (< (point) transform-end)
(setq return-content

View File

@ -152,24 +152,24 @@ The number of levels is controlled by `org-inlinetask-min-level'."
org-inlinetask-min-level)))
(format "^\\(\\*\\{%d,\\}\\)[ \t]+" nstars)))
(defun org-inlinetask-end-p ()
"Return a non-nil value if point is on inline task's END part."
(let ((case-fold-search t))
(org-match-line (concat (org-inlinetask-outline-regexp) "END[ \t]*$"))))
(defun org-inlinetask-at-task-p ()
"Return true if point is at beginning of an inline task."
(save-excursion
(beginning-of-line)
(and (looking-at (concat (org-inlinetask-outline-regexp) "\\(.*\\)"))
(not (string-match "^end[ \t]*$" (downcase (match-string 2)))))))
"Return non-nil if point is at beginning of an inline task."
(and (org-match-line (concat (org-inlinetask-outline-regexp) "\\(.*\\)"))
(not (org-inlinetask-end-p))))
(defun org-inlinetask-in-task-p ()
"Return true if point is inside an inline task."
(save-excursion
(beginning-of-line)
(let* ((case-fold-search t)
(stars-re (org-inlinetask-outline-regexp))
(task-beg-re (concat stars-re "\\(?:.*\\)"))
(task-end-re (concat stars-re "END[ \t]*$")))
(or (looking-at-p task-beg-re)
(let ((case-fold-search t))
(or (looking-at-p (concat (org-inlinetask-outline-regexp) "\\(?:.*\\)"))
(and (re-search-forward "^\\*+[ \t]+" nil t)
(progn (beginning-of-line) (looking-at-p task-end-re)))))))
(org-inlinetask-end-p))))))
(defun org-inlinetask-goto-beginning ()
"Go to the beginning of the inline task at point."
@ -177,7 +177,7 @@ The number of levels is controlled by `org-inlinetask-min-level'."
(let ((case-fold-search t)
(inlinetask-re (org-inlinetask-outline-regexp)))
(re-search-backward inlinetask-re nil t)
(when (looking-at-p (concat inlinetask-re "END[ \t]*$"))
(when (org-inlinetask-end-p)
(re-search-backward inlinetask-re nil t))))
(defun org-inlinetask-goto-end ()
@ -185,16 +185,15 @@ The number of levels is controlled by `org-inlinetask-min-level'."
Return point."
(save-match-data
(beginning-of-line)
(let* ((case-fold-search t)
(inlinetask-re (org-inlinetask-outline-regexp))
(task-end-re (concat inlinetask-re "END[ \t]*$")))
(let ((case-fold-search t)
(inlinetask-re (org-inlinetask-outline-regexp)))
(cond
((looking-at-p task-end-re)
((org-inlinetask-end-p)
(forward-line))
((looking-at-p inlinetask-re)
(forward-line)
(cond
((looking-at-p task-end-re) (forward-line))
((org-inlinetask-end-p) (forward-line))
((looking-at-p inlinetask-re))
((org-inlinetask-in-task-p)
(re-search-forward inlinetask-re nil t)

View File

@ -824,7 +824,7 @@ When nil, simply write \"#ERROR\" in corrupted fields.")
;; Find fields that are wider than FMAX, and shorten them.
(when fmax
(dolist (x column)
(when (> (string-width x) fmax)
(when (> (org-string-width x) fmax)
(org-add-props x nil
'help-echo
(concat

View File

@ -76,13 +76,13 @@ so that it can be yanked into an Org buffer with links working correctly."
(message "Transforming links...")
(save-excursion
(goto-char transform-start)
(while (and (not out-bound) ; still inside region to copy
(while (and (not out-bound) ; still inside region to copy
(not (org-w3m-no-next-link-p))) ; no next link current buffer
;; store current point before jump next anchor
(setq temp-position (point))
;; move to next anchor when current point is not at anchor
(or (get-text-property (point) 'w3m-href-anchor) (org-w3m-get-next-link-start))
(if (<= (point) transform-end) ; if point is inside transform bound
(if (<= (point) transform-end) ; if point is inside transform bound
(progn
;; get content between two links.
(if (> (point) temp-position)
@ -95,12 +95,13 @@ so that it can be yanked into an Org buffer with links working correctly."
(setq link-title (buffer-substring (point)
(org-w3m-get-anchor-end)))
;; concat Org style url to `return-content'.
(setq return-content (concat return-content
(org-make-link-string
link-location link-title))))
(goto-char temp-position) ; reset point before jump next anchor
(setq out-bound t) ; for break out `while' loop
))
(setq return-content
(concat return-content
(if (org-string-nw-p link-location)
(org-make-link-string link-location link-title)
link-title))))
(goto-char temp-position) ; reset point before jump next anchor
(setq out-bound t))) ; for break out `while' loop
;; add the rest until end of the region to be copied
(if (< (point) transform-end)
(setq return-content

View File

@ -7,7 +7,7 @@
;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
;; Keywords: outlines, hypermedia, calendar, wp
;; Homepage: https://orgmode.org
;; Version: 9.1.9
;; Version: 9.1.10
;;
;; This file is part of GNU Emacs.
;;
@ -2294,7 +2294,7 @@ Possible values for the file identifier are:
In a custom function, you can access the group matches with
(match-string n link).
Example: (\"\\\\.pdf::\\\\(\\\\d+\\\\)\\\\\\='\" . \
Example: (\"\\\\.pdf::\\\\([0-9]+\\\\)\\\\\\='\" . \
\"evince -p %1 %s\")
to open [[file:document.pdf::5]] with evince at page 5.
@ -14162,6 +14162,9 @@ headlines matching this string."
(re-search-forward re nil t))
(setq org-map-continue-from nil)
(catch :skip
;; Ignore closing parts of inline tasks.
(when (and (fboundp 'org-inlinetask-end-p) (org-inlinetask-end-p))
(throw :skip t))
(setq todo
;; TODO: is the 1-2 difference a bug?
(when (match-end 1) (match-string-no-properties 2))
@ -17799,7 +17802,8 @@ NODEFAULT, hour and minute fields will be nil if not given."
(defun org-timestamp-up (&optional arg)
"Increase the date item at the cursor by one.
If the cursor is on the year, change the year. If it is on the month,
the day or the time, change that.
the day or the time, change that. If the cursor is on the enclosing
bracket, change the timestamp type.
With prefix ARG, change by that many units."
(interactive "p")
(org-timestamp-change (prefix-numeric-value arg) nil 'updown))
@ -17807,7 +17811,8 @@ With prefix ARG, change by that many units."
(defun org-timestamp-down (&optional arg)
"Decrease the date item at the cursor by one.
If the cursor is on the year, change the year. If it is on the month,
the day or the time, change that.
the day or the time, change that. If the cursor is on the enclosing
bracket, change the timestamp type.
With prefix ARG, change by that many units."
(interactive "p")
(org-timestamp-change (- (prefix-numeric-value arg)) nil 'updown))
@ -21080,7 +21085,14 @@ object (e.g., within a comment). In these case, you need to use
;; `org-return-follows-link' allows it. Tolerate fuzzy
;; locations, e.g., in a comment, as `org-open-at-point'.
((and org-return-follows-link
(or (org-in-regexp org-ts-regexp-both nil t)
(or (and (eq 'link (org-element-type context))
;; Ensure point is not on the white spaces after
;; the link.
(let ((origin (point)))
(org-with-point-at (org-element-property :end context)
(skip-chars-backward " \t")
(> (point) origin))))
(org-in-regexp org-ts-regexp-both nil t)
(org-in-regexp org-tsr-regexp-both nil t)
(org-in-regexp org-any-link-re nil t)))
(call-interactively #'org-open-at-point))
@ -23684,7 +23696,9 @@ depending on context."
org-ctrl-k-protect-subtree
(or (eq org-ctrl-k-protect-subtree 'error)
(not (y-or-n-p "Kill hidden subtree along with headline? "))))
(user-error "C-k aborted as it would kill a hidden subtree"))
(user-error
(substitute-command-keys
"`\\[org-kill-line]' aborted as it would kill a hidden subtree")))
(call-interactively
(if (bound-and-true-p visual-line-mode) 'kill-visual-line 'kill-line)))
((looking-at ".*?\\S-\\([ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)[ \t]*$")

View File

@ -118,6 +118,22 @@ return x
(org-babel-next-src-block)
(should (equal "20" (org-babel-execute-src-block)))))
(ert-deftest test-ob-python/insert-necessary-blank-line-when-sending-code-to-interpreter ()
(org-test-with-temp-text "#+begin_src python :session :results value
if True:
1
2
#+end_src"
;; Previously, while adding `:session' to a normal code block, also need to add extra blank lines
;; to end indent block or indicate logical sections. Now, the `org-babel-python-evaluate-session'
;; can do it automatically:
;; >>> if True:
;; >>> 1
;; >>> <insert_blank_line_here>
;; >>> 2
(org-babel-execute-maybe)
(should (equal 2 (org-babel-execute-src-block)))))
(provide 'test-ob-python)
;;; test-ob-python.el ends here

View File

@ -1121,6 +1121,21 @@
(org-link-search-must-match-exact-headline nil))
(org-return))
(looking-at-p "<<target>>")))
;; `org-return-follows-link' handle multi-line lines.
(should
(org-test-with-temp-text
"[[target][This is a very\n long description<point>]]\n <<target>>"
(let ((org-return-follows-link t)
(org-link-search-must-match-exact-headline nil))
(org-return))
(looking-at-p "<<target>>")))
(should-not
(org-test-with-temp-text
"[[target][This is a very\n long description]]<point>\n <<target>>"
(let ((org-return-follows-link t)
(org-link-search-must-match-exact-headline nil))
(org-return))
(looking-at-p "<<target>>")))
;; However, do not open link when point is in a table.
(should
(org-test-with-temp-text "| [[target<point>]] |\n| between |\n| <<target>> |"