Merge branch 'master' of orgmode.org:org-mode

This commit is contained in:
Bastien Guerry 2013-02-15 16:48:40 +01:00
commit 1298b6468a
2 changed files with 35 additions and 28 deletions

View File

@ -4622,26 +4622,40 @@ first element of current section."
(list (org-element-headline-parser (point-max) t)))) (list (org-element-headline-parser (point-max) t))))
;; Otherwise move at the beginning of the section containing ;; Otherwise move at the beginning of the section containing
;; point. ;; point.
(let ((origin (point)) (catch 'exit
(end (save-excursion (let ((origin (point))
(org-with-limited-levels (outline-next-heading)) (point))) (end (save-excursion
element type special-flag trail struct prevs parent) (org-with-limited-levels (outline-next-heading)) (point)))
(org-with-limited-levels element type special-flag trail struct prevs parent)
(if (org-before-first-heading-p) (goto-char (point-min)) (org-with-limited-levels
(org-back-to-heading) (if (org-before-first-heading-p)
(forward-line))) ;; In empty lines at buffer's beginning, return nil.
(org-skip-whitespace) (progn (goto-char (point-min))
(beginning-of-line) (org-skip-whitespace)
;; Parse successively each element, skipping those ending (when (or (eobp) (> (line-beginning-position) origin))
;; before original position. (throw 'exit nil)))
(catch 'exit (org-back-to-heading)
(while t (forward-line)
(setq element (org-skip-whitespace)
(when (> (line-beginning-position) origin)
;; In blank lines just after the headline, point still
;; belongs to the headline.
(throw 'exit
(progn (org-back-to-heading)
(if (not keep-trail)
(org-element-headline-parser (point-max) t)
(list (org-element-headline-parser
(point-max) t))))))))
(beginning-of-line)
;; Parse successively each element, skipping those ending
;; before original position.
(while t
(setq element
(org-element--current-element end 'element special-flag struct) (org-element--current-element end 'element special-flag struct)
type (car element)) type (car element))
(org-element-put-property element :parent parent) (org-element-put-property element :parent parent)
(when keep-trail (push element trail)) (when keep-trail (push element trail))
(cond (cond
;; 1. Skip any element ending before point. Also skip ;; 1. Skip any element ending before point. Also skip
;; element ending at point when we're sure that another ;; element ending at point when we're sure that another
;; element has started. ;; element has started.

View File

@ -19652,13 +19652,8 @@ This command does many different things, depending on context:
((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook)) ((run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-hook))
(t (t
(let* ((context (org-element-context)) (type (org-element-type context))) (let* ((context (org-element-context)) (type (org-element-type context)))
;; Test if point is within blanks at the end of an element. ;; Test if point is within a blank line.
(if (save-excursion (if (save-excursion (beginning-of-line) (looking-at "[ \t]*$"))
(or (not context)
(beginning-of-line)
(and (looking-at "[ \t]*$")
(skip-chars-forward " \r\t\n")
(>= (point) (org-element-property :end context)))))
(or (run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook) (or (run-hook-with-args-until-success 'org-ctrl-c-ctrl-c-final-hook)
(user-error "C-c C-c can do nothing useful at this location")) (user-error "C-c C-c can do nothing useful at this location"))
;; For convenience: at the first line of a paragraph on the ;; For convenience: at the first line of a paragraph on the
@ -22241,10 +22236,8 @@ the cursor is already beyond the end of the headline."
((fboundp 'move-end-of-line) 'move-end-of-line) ((fboundp 'move-end-of-line) 'move-end-of-line)
(t 'end-of-line)))) (t 'end-of-line))))
(if (or (not special) arg) (call-interactively move-fun) (if (or (not special) arg) (call-interactively move-fun)
(let* ((element (ignore-errors (let* ((element (save-excursion (beginning-of-line)
;; Don't throw an error outside elements (org-element-at-point)))
(save-excursion (beginning-of-line)
(org-element-at-point))))
(type (org-element-type element))) (type (org-element-type element)))
(cond (cond
((memq type '(headline inlinetask)) ((memq type '(headline inlinetask))