summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-06-01 15:54:44 +0200
committerBastien Guerry <bzg@altern.org>2012-06-01 15:54:44 +0200
commitd8d60627d1bac22020f19fdc4797b72660d7a75a (patch)
tree120a897e986a47222671fbc4185fb1bb52d8e25b
parentb4d827c402fd0bd65d651bb9766285e4f088bc07 (diff)
downloadorg-mode-d8d60627d1bac22020f19fdc4797b72660d7a75a.tar.gz
org.el: RET should not follow a timestamp when the point is right after it.
* org.el (org-at-timestamp-p): Set ̀org-ts-what' to 'after when the point is right after the timestamp. `org-at-timestamp-p' still returns `t' in this case, as this is more practical. (org-return): Check against ̀org-ts-what' to verify that point is really within the timestamp (if any). Thanks to Nick Dokos for raising this issue.
-rw-r--r--lisp/org.el71
1 files changed, 37 insertions, 34 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 28f18da..0157e36 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16162,8 +16162,8 @@ With prefix ARG, change that many days."
((= pos (match-beginning 0)) 'bracket)
;; Point is considered to be "on the bracket" whether
;; it's really on it or right after it.
- ((or (= pos (1- (match-end 0)))
- (= pos (match-end 0))) 'bracket)
+ ((= pos (1- (match-end 0))) 'bracket)
+ ((= pos (match-end 0)) 'after)
((org-pos-in-match-range pos 2) 'year)
((org-pos-in-match-range pos 3) 'month)
((org-pos-in-match-range pos 7) 'hour)
@@ -18905,38 +18905,41 @@ Also updates the keyword regular expressions."
Calls `org-table-next-row' or `newline', depending on context.
See the individual commands for more information."
(interactive)
- (cond
- ((or (bobp) (org-in-src-block-p))
- (if indent (newline-and-indent) (newline)))
- ((org-at-table-p)
- (org-table-justify-field-maybe)
- (call-interactively 'org-table-next-row))
- ;; when `newline-and-indent' is called within a list, make sure
- ;; text moved stays inside the item.
- ((and (org-in-item-p) indent)
- (if (and (org-at-item-p) (>= (point) (match-end 0)))
- (progn
- (save-match-data (newline))
- (org-indent-line-to (length (match-string 0))))
- (let ((ind (org-get-indentation)))
- (newline)
- (if (org-looking-back org-list-end-re)
- (org-indent-line-function)
- (org-indent-line-to ind)))))
- ((and org-return-follows-link (org-at-timestamp-p t))
- (org-follow-timestamp-link))
- ((and org-return-follows-link
- (let ((tprop (get-text-property (point) 'face)))
- (or (eq tprop 'org-link)
- (and (listp tprop) (memq 'org-link tprop)))))
- (call-interactively 'org-open-at-point))
- ((and (org-at-heading-p)
- (looking-at
- (org-re "\\([ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)[ \t]*$")))
- (org-show-entry)
- (end-of-line 1)
- (newline))
- (t (if indent (newline-and-indent) (newline)))))
+ (let (org-ts-what)
+ (cond
+ ((or (bobp) (org-in-src-block-p))
+ (if indent (newline-and-indent) (newline)))
+ ((org-at-table-p)
+ (org-table-justify-field-maybe)
+ (call-interactively 'org-table-next-row))
+ ;; when `newline-and-indent' is called within a list, make sure
+ ;; text moved stays inside the item.
+ ((and (org-in-item-p) indent)
+ (if (and (org-at-item-p) (>= (point) (match-end 0)))
+ (progn
+ (save-match-data (newline))
+ (org-indent-line-to (length (match-string 0))))
+ (let ((ind (org-get-indentation)))
+ (newline)
+ (if (org-looking-back org-list-end-re)
+ (org-indent-line-function)
+ (org-indent-line-to ind)))))
+ ((and org-return-follows-link
+ (org-at-timestamp-p t)
+ (not (eq org-ts-what 'after)))
+ (org-follow-timestamp-link))
+ ((and org-return-follows-link
+ (let ((tprop (get-text-property (point) 'face)))
+ (or (eq tprop 'org-link)
+ (and (listp tprop) (memq 'org-link tprop)))))
+ (call-interactively 'org-open-at-point))
+ ((and (org-at-heading-p)
+ (looking-at
+ (org-re "\\([ \t]+\\(:[[:alnum:]_@#%:]+:\\)\\)[ \t]*$")))
+ (org-show-entry)
+ (end-of-line 1)
+ (newline))
+ (t (if indent (newline-and-indent) (newline))))))
(defun org-return-indent ()
"Goto next table row or insert a newline and indent.