summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-03-19 18:45:17 -0700
committerKyle Meyer <kyle@kyleam.com>2019-03-24 20:39:52 -0400
commit355eb9e08e981fb886354d1f9ca159a48a9b736b (patch)
treeb11f2998498cd6a49a41efc5f3976598ec075bb1
parentc856b34bd19b232ea52d586094508468b5673c16 (diff)
downloadorg-mode-355eb9e08e981fb886354d1f9ca159a48a9b736b.tar.gz
Backport commit e14c0d748 from Emacs
* lisp/org-datetree.el (org-datetree--find-create): * lisp/org-pcomplete.el (org-thing-at-point): Fix regular expression and similar syntax. More minor regex cleanup e14c0d748efe35afc653151ff18c4dd93dcc456e Paul Eggert Tue Mar 19 18:47:53 2019 -0700
-rw-r--r--lisp/org-datetree.el9
-rw-r--r--lisp/org-pcomplete.el2
2 files changed, 6 insertions, 5 deletions
diff --git a/lisp/org-datetree.el b/lisp/org-datetree.el
index aea2c8d..b4797de 100644
--- a/lisp/org-datetree.el
+++ b/lisp/org-datetree.el
@@ -138,15 +138,16 @@ will be built under the headline at point."
"^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$"
year month day))))
-(defun org-datetree--find-create (regex year &optional month day insert)
- "Find the datetree matched by REGEX for YEAR, MONTH, or DAY.
-REGEX is passed to `format' with YEAR, MONTH, and DAY as
+(defun org-datetree--find-create
+ (regex-template year &optional month day insert)
+ "Find the datetree matched by REGEX-TEMPLATE for YEAR, MONTH, or DAY.
+REGEX-TEMPLATE is passed to `format' with YEAR, MONTH, and DAY as
arguments. Match group 1 is compared against the specified date
component. If INSERT is non-nil and there is no match then it is
inserted into the buffer."
(when (or month day)
(org-narrow-to-subtree))
- (let ((re (format regex year month day))
+ (let ((re (format regex-template year month day))
match)
(goto-char (point-min))
(while (and (setq match (re-search-forward re nil t))
diff --git a/lisp/org-pcomplete.el b/lisp/org-pcomplete.el
index 70a8173..38fd27f 100644
--- a/lisp/org-pcomplete.el
+++ b/lisp/org-pcomplete.el
@@ -93,7 +93,7 @@ The return value is a string naming the thing at point."
(cons "file-option" nil))
;; Link abbreviation.
((save-excursion
- (skip-chars-backward "A-Za-z0-9-_")
+ (skip-chars-backward "-A-Za-z0-9_")
(and (eq ?\[ (char-before))
(eq ?\[ (char-before (1- (point))))))
(cons "link" nil))