Commit Graph

4206 Commits

Author SHA1 Message Date
Nicolas Goaziou e7147682f3 Merge branch 'maint' 2017-06-05 23:40:48 +02:00
Nicolas Goaziou 439fcfbbf2 Fix link fontification
* lisp/org.el (org-activate-links): Delegate to
  `org-element-link-parser' to handle blanks and link expansion.
2017-06-05 23:39:42 +02:00
Nicolas Goaziou 6059fd9f34 Merge branch 'maint' 2017-06-04 09:17:39 +02:00
Nicolas Goaziou faace6f05d Fix last commit
* lisp/org-agenda.el (org-agenda-mode):
* lisp/org.el (org-clone-local-variables): Fix match pattern.
2017-06-04 09:17:07 +02:00
Nicolas Goaziou 1a69d99ce1 Merge branch 'maint' 2017-06-03 22:45:14 +02:00
Nicolas Goaziou 355b0012d1 Fix local variable handling
* lisp/org.el (org-clone-local-variables):
* lisp/org-agenda.el (org-agenda-mode): Do not assume
  `buffer-local-variables' returns only cons cells.

Reported-by: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/113793>
2017-06-03 22:43:35 +02:00
Kyle Meyer 0d25d2b061 Silence byte-compiler under "make single"
* lisp/org.el (org-comment-string): Wrap definition in an
eval-and-compile because this variable is used within the body of
eval-when-compile, leading to an error under "make single".
(org-at-timestamp-p): Use bound-and-true-p to check
org-agenda-include-inactive-timestamps because org-agenda may not be
loaded yet.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
<https://lists.gnu.org/archive/html/emacs-orgmode/2017-05/msg00326.html>
2017-05-31 20:45:34 -04:00
Nicolas Goaziou 82a50381a1 Merge branch 'maint' 2017-05-28 09:40:39 +02:00
Chunyang Xu 1afcf2c9aa Exclude '[' and ']' in `org-plain-link-re'
* lisp/org.el (org-make-link-regexps): Do it.

TINYCHANGE
2017-05-28 09:39:29 +02:00
Nicolas Goaziou 49b3d67ec3 Merge branch 'maint' 2017-05-26 11:58:25 +02:00
Nicolas Goaziou 2d29269bb1 Fix link fontification
* lisp/org.el (org-activate-links): New function.
(org-set-font-lock-defaults): Use new function.
(org-activate-angle-links):
(org-activate-bracket-links):
(org-activate-plain-links): Remove functions.
* lisp/org-agenda.el (org-agenda-get-some-entry-text):
(org-agenda-finalize): Use new function.

Reported-by: 林镇国 <mistkafka@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113485>
2017-05-26 11:56:53 +02:00
Kyle Meyer b92eb81731 Merge branch 'maint' 2017-05-26 00:21:14 -04:00
Kyle Meyer 6d4c188e3e Silence byte-compiler under "make single" 2017-05-26 00:03:29 -04:00
Nicolas Goaziou 957850043a Prevent filling before a "n" macro where it could create list items
* lisp/org.el (org-fill-n-macro-as-item-nobreak-p): New function.
(org-setup-filling): Use new function.

* testing/lisp/test-org.el (test-org/fill-element): Add tests.

Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113587>
2017-05-25 12:33:16 +02:00
Nicolas Goaziou c2f4eec5dc `org-fill-paragraph' handles region
* lisp/org.el (org-fill-element): New function.
(org-fill-paragraph): Use new function.  Also handle region, when
called interactively.

* testing/lisp/test-org.el (test-org/fill-element): Renamed from
  test-org/fill-paragraph.  Update tests.

Reported-by: Oskar Kvist <oskar.kvist@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113542>
2017-05-22 15:02:34 +02:00
Nicolas Goaziou 2b44a1a74c Remove `org-protect-slash'
* lisp/org.el (org-protect-slash): Remove function.
(org-refile-get-targets): Apply removal.

This internal function is used only once throughout the code base.
2017-05-22 08:31:53 +02:00
Nicolas Goaziou f10e19eabf Merge branch 'maint' 2017-05-22 08:25:56 +02:00
Nicolas Goaziou d7599e3f27 Preserve targets order according to rules
* lisp/org.el (org-refile-get-targets): Keep targets grouped according
  to `org-refile-targets' value.
2017-05-22 08:24:56 +02:00
Nicolas Goaziou cadbef99f0 Merge branch 'maint' 2017-05-22 08:19:12 +02:00
Nicolas Goaziou 7560a49459 Remove duplicates in refile targets
* lisp/org.el (org-refile-get-targets): Remove duplicates in refile
  targets.
2017-05-22 08:16:42 +02:00
Kyle Meyer 23ac37da7c Merge branch 'maint' 2017-05-21 14:54:59 -04:00
Kyle Meyer 0de7ad0430 org-store-link: Don't roll C-u behavior into C-u C-u behavior
* lisp/org.el (org-store-link): When a double C-u prefix argument is
given, do not reverse the meaning of the org-context-in-file-links
option.
* testing/lisp/test-org.el (test-org/store-link): Add tests.

This allows the user to fall back to the core link storing functions
without also reversing their org-context-in-file-links preference,
because wanting to do the former does not mean a user also wants to do
the latter.

Reported-by: York Zhao <gtdplatform@gmail.com>
<https://lists.gnu.org/archive/html/emacs-orgmode/2017-05/msg00254.html>
2017-05-21 14:52:30 -04:00
Nicolas Goaziou 68429a99cc Merge branch 'maint' 2017-05-20 09:10:13 +02:00
Nicolas Goaziou 85a26f0cfe Fix "Stack overflow in regexp matcher" in `org-refresh-stats-properties'
* lisp/org.el (org-refresh-stats-properties): Simplify regexp.  Small
  refactoring.

Reported-by: Kevin Zettler <kevzettler@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113555>
2017-05-20 09:09:03 +02:00
Kyle Meyer bda9a49056 Merge branch 'maint' 2017-05-18 14:50:42 -04:00
Kyle Meyer 9d9f5179e7 org-sort: Read compare-func in interactive calls
* lisp/org-macs.el (org-read-function): New function.
* lisp/org-table.el (org-table-sort-lines): Make WITH-CASE an optional
argument to match org-sort-entries and org-sort-list.
* lisp/org.el (org-sort-entries):
* lisp/org-table.el (org-table-sort-lines):
* lisp/org-list.el (org-sort-list): Read COMPARE-FUNC when called
interactively rather than being restricted to the default behavior of
sort-subr's PREDICATE parameter.  Only prompt for for GETKEY-FUNC and
COMPARE-FUNC during an interactive call, like org-table-sort-lines
already did for GETKEY-FUNC, but use an argument rather than relying
on the brittle called-interactively-p.

Suggested-by: Zhitao Gong <zhitaao.gong@gmail.com>
<https://lists.gnu.org/archive/html/emacs-orgmode/2017-05/msg00040.html>
2017-05-18 14:46:33 -04:00
Sebastian Reuße 2906e50177 org-refile: Fix inconsistency when listing refile targets
* org.el (org-refile-get-targets): Setting org-refile-use-outline-path
to `file' or `buffer-name' causes an additional target for the file’s
root node to be inserted. This functionality was absent when using
`full-file-path'. We now add this since it is convenient and makes the
behavior more consistent.
2017-05-17 14:37:54 +02:00
Nicolas Goaziou dbe2424b07 Adjust `org-at-timestamp-p' behavior
* lisp/org.el (org-at-timestamp-p): Change optional argument
  behaviour.  Remove interactive call.
(org-follow-timestamp-link):
(org-get-repeat):
(org-auto-repeat-maybe):
(org-time-stamp):
(org-timestamp-up-day):
(org-timestamp-down-day):
(org-toggle-timestamp-type):
(org-timestamp-change):
(org-goto-calendar):
(org-date-from-calendar):
(org-shiftup):
(org-shiftdown):
(org-shiftright):
(org-shiftleft):
(org-org-menu):
(org-fill-paragraph-with-timestamp-nobreak-p):
(org-shiftcontrolup):
(org-shiftcontroldown):
* lisp/org-agenda.el (org-agenda-date-later):
(org-agenda-date-prompt):
* lisp/org-clock.el (org-clock-timestamps-change):
* lisp/org-mouse.el (org-mouse-delete-timestamp):
(org-mouse-context-menu):
* lisp/org-table.el (org-table-copy-down): Update callers.

* testing/lisp/test-org.el (test-org/at-timestamp-p): Add tests.
2017-05-14 10:54:25 +02:00
Nicolas Goaziou de2a8b31e4 Fix typo in code comment 2017-05-14 00:21:18 +02:00
Nicolas Goaziou b72d29d685 Merge branch 'maint' 2017-05-13 09:21:31 +02:00
Nicolas Goaziou c0369a7984 org-element: Fix $...$ fragments followed by an apostrophe
* lisp/org-element.el (org-element-latex-fragment-parser):
* lisp/org.el (org-latex-regexps): Allow an apostrophe right after
  a fragment.

* testing/lisp/test-org-element.el (test-org-element/latex-fragment-parser):
  Add test.

In Text mode, and, as a consequence, in Org mode, "'" is not treated
as punctuation, but as word constituent.  The apostrophe isn't caught
by "\s." regexp.

Reported-by: Joe Corneli <holtzermann17@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/113464>
2017-05-13 09:18:07 +02:00
Nicolas Goaziou 79ac71d175 Tiny fix
* lisp/org.el (org-N-empty-lines-before-current): Insert empty lines
  before point, not after.
* testing/lisp/test-org.el (test-org/insert-heading): Add test.
2017-05-12 17:45:46 +02:00
Kyle Meyer c801ef0328 org-sort: Go back to calling org-sort-* functions interactively
* lisp/org.el (org-sort): Revert change from c1addc825 that replaced
org-call-with-arg with funcall because org-table-sort-lines changes
its behavior based on the return value of called-interactively-p.
2017-05-08 23:57:30 -04:00
Kyle Meyer c1addc8252 org-sort: Call org-sort-* functions non-interactively
* lisp/org.el (org-sort): Use funcall instead of org-call-with-arg,
and make WITH-CASE an optional argument.
* lisp/org-table.el (org-table-sort-lines): Make WITH-CASE an optional
argument.
2017-05-08 11:13:19 -04:00
Sebastian Reuße 1188beaa3b org-refile: Optionally prefix refile targets with buffer name
* org.el (org-refile-get-targets): Add case to optionally prefix
refile targets with the buffer name.
(org-refile-use-outline-path): Add new option setting and document.

Having an option to use the buffer name as a prefix is convenient,
since this will work hand in hand with uniquify to only show those
parts of the filesystem path needed to disambiguate buffers of
identically named files, as opposed to prefixing refile targets with
the full filesystem path.
2017-05-06 12:01:20 -04:00
Sebastian Reuße 53bcf91a96 org-refile: Escape slashes only in headline of refile target
* org.el (org-refile-get-targets): Only escape slashes in headline
part of refile target; leave any file-system path component (when
enabled) unescaped.

The reason to escape slashes in refile targets is to make it clear
when a slash was part of a headline vs. part of the outline path.  It
makes sense to treat slashes in the file system part the same way as
outline paths, since this won’t result in any confusion and serves to
make target selection less noisy.
2017-05-06 12:01:09 -04:00
Nicolas Goaziou 5bc540eae1 Merge branch 'maint' 2017-04-30 22:26:52 +02:00
Nicolas Goaziou 3502e6fa7c Fix indentation bug
* lisp/org.el (org--get-expected-indentation): Correctly indent line
  when last element in an item is not a greater element.
* testing/lisp/test-org.el (test-org/indent-line): Add test.
2017-04-30 22:26:10 +02:00
Nicolas Goaziou 571dfe2a3f Merge branch 'maint' 2017-04-17 10:38:24 +02:00
Marc Ihm 165f7c3950 Fix explanation, if state change is blocked by contained checkboxes
* lisp/org.el (org-todo): Fix explanation, if state change is blocked
  by contained checkboxes.

Consider a node, which contains unchecked checkboxes; if you have set
org-enforce-todo-checkbox-dependencies and try to change the node to
DONE, you will be denied with a message explaining why. However in this
special case the explanation would be wrong in talking of an unrelated
node instead of the checkboxes.

The fix uses the already existing variable org-blocked-by-checkboxes
(which is handled in org-block-todo-from-checkboxes).  Similar code is
already present in org-agenda-dim-blocked-tasks within org-agenda.el.
2017-04-17 10:33:51 +02:00
Nicolas Goaziou 42f24c167c Merge branch 'maint' 2017-04-15 16:52:46 +02:00
Nicolas Goaziou 74379eaaa2 Fix `org-forward-heading-same-level'
* lisp/org.el (org-forward-heading-same-level): Do not fail when
  heading is at the beginning of the buffer.
* testing/lisp/test-org.el (test-org/forward-heading-same-level): New
  test.

Reported-by: Rafael Laboissière <rafael@laboissiere.net>
<http://permalink.gmane.org/gmane.emacs.orgmode/113084>
2017-04-15 16:51:33 +02:00
Kyle Meyer 1336347065 Merge branch 'maint' 2017-04-09 20:52:41 -04:00
Kyle Meyer 10301ab1ff org-insert-link: Correct changes from a08dd527d
* lisp/org.el (org-insert-link): Fix regexp and undefined variable.
2017-04-09 20:49:03 -04:00
Nicolas Goaziou e65be54b91 Merge branch 'maint' 2017-03-30 12:48:08 +02:00
Nicolas Goaziou 31f3725ba8 Fix `org-startup-with-latex-preview' handling
* lisp/org.el (org-mode): When honoring
  `org-startup-with-latex-preview', make sure to preview the whole
  buffer.

Reported-by: Diego Nicola Barbato
<http://permalink.gmane.org/gmane.emacs.orgmode/112925>
2017-03-30 12:46:46 +02:00
Nicolas Goaziou d4cae34eaa Merge branch 'maint' 2017-03-29 15:34:50 +02:00
Nicolas Goaziou a08dd527d9 Small refactoring
* lisp/org.el (org-insert-link): Small refactoring.
2017-03-29 15:34:27 +02:00
Matt Lundin d9038a01c1 Allow insertion of links with multi-line search strings
* lisp/org.el: (org-insert-link): Fix regexps to match across
  newlines.
2017-03-29 14:28:48 +02:00
Nicolas Goaziou a126020e56 Merge branch 'maint' 2017-03-29 14:18:14 +02:00