|
@@ -14159,59 +14159,58 @@ which make use of the date at the cursor."
|
|
|
(defun org-indent-line-function ()
|
|
|
"Indent line like previous, but further if previous was headline or item."
|
|
|
(interactive)
|
|
|
- (unless (org-edit-src-find-region-and-lang)
|
|
|
- (let* ((pos (point))
|
|
|
- (itemp (org-at-item-p))
|
|
|
- column bpos bcol tpos tcol bullet btype bullet-type)
|
|
|
- ;; Find the previous relevant line
|
|
|
- (beginning-of-line 1)
|
|
|
+ (let* ((pos (point))
|
|
|
+ (itemp (org-at-item-p))
|
|
|
+ column bpos bcol tpos tcol bullet btype bullet-type)
|
|
|
+ ;; Find the previous relevant line
|
|
|
+ (beginning-of-line 1)
|
|
|
+ (cond
|
|
|
+ ((looking-at "#") (setq column 0))
|
|
|
+ ((looking-at "\\*+ ") (setq column 0))
|
|
|
+ (t
|
|
|
+ (beginning-of-line 0)
|
|
|
+ (while (and (not (bobp)) (looking-at "[ \t]*[\n:#|]"))
|
|
|
+ (beginning-of-line 0))
|
|
|
(cond
|
|
|
- ((looking-at "#") (setq column 0))
|
|
|
- ((looking-at "\\*+ ") (setq column 0))
|
|
|
- (t
|
|
|
- (beginning-of-line 0)
|
|
|
- (while (and (not (bobp)) (looking-at "[ \t]*[\n:#|]"))
|
|
|
- (beginning-of-line 0))
|
|
|
- (cond
|
|
|
- ((looking-at "\\*+[ \t]+")
|
|
|
- (if (not org-adapt-indentation)
|
|
|
- (setq column 0)
|
|
|
- (goto-char (match-end 0))
|
|
|
- (setq column (current-column))))
|
|
|
- ((org-in-item-p)
|
|
|
- (org-beginning-of-item)
|
|
|
- (looking-at "[ \t]*\\(\\S-+\\)[ \t]*\\(\\[[- X]\\][ \t]*\\|.*? :: \\)?")
|
|
|
- (setq bpos (match-beginning 1) tpos (match-end 0)
|
|
|
- bcol (progn (goto-char bpos) (current-column))
|
|
|
- tcol (progn (goto-char tpos) (current-column))
|
|
|
- bullet (match-string 1)
|
|
|
- bullet-type (if (string-match "[0-9]" bullet) "n" bullet))
|
|
|
- (if (> tcol (+ bcol org-description-max-indent))
|
|
|
- (setq tcol (+ bcol 5)))
|
|
|
- (if (not itemp)
|
|
|
- (setq column tcol)
|
|
|
- (goto-char pos)
|
|
|
- (beginning-of-line 1)
|
|
|
- (if (looking-at "\\S-")
|
|
|
- (progn
|
|
|
- (looking-at "[ \t]*\\(\\S-+\\)[ \t]*")
|
|
|
- (setq bullet (match-string 1)
|
|
|
- btype (if (string-match "[0-9]" bullet) "n" bullet))
|
|
|
- (setq column (if (equal btype bullet-type) bcol tcol)))
|
|
|
- (setq column (org-get-indentation)))))
|
|
|
- (t (setq column (org-get-indentation))))))
|
|
|
- (goto-char pos)
|
|
|
- (if (<= (current-column) (current-indentation))
|
|
|
- (org-indent-line-to column)
|
|
|
- (save-excursion (org-indent-line-to column)))
|
|
|
- (setq column (current-column))
|
|
|
- (beginning-of-line 1)
|
|
|
- (if (looking-at
|
|
|
- "\\([ \t]+\\)\\(:[-_0-9a-zA-Z]+:\\)[ \t]*\\(\\S-.*\\(\\S-\\|$\\)\\)")
|
|
|
- (replace-match (concat "\\1" (format org-property-format
|
|
|
- (match-string 2) (match-string 3)))
|
|
|
- t nil))
|
|
|
- (org-move-to-column column))))
|
|
|
+ ((looking-at "\\*+[ \t]+")
|
|
|
+ (if (not org-adapt-indentation)
|
|
|
+ (setq column 0)
|
|
|
+ (goto-char (match-end 0))
|
|
|
+ (setq column (current-column))))
|
|
|
+ ((org-in-item-p)
|
|
|
+ (org-beginning-of-item)
|
|
|
+ (looking-at "[ \t]*\\(\\S-+\\)[ \t]*\\(\\[[- X]\\][ \t]*\\|.*? :: \\)?")
|
|
|
+ (setq bpos (match-beginning 1) tpos (match-end 0)
|
|
|
+ bcol (progn (goto-char bpos) (current-column))
|
|
|
+ tcol (progn (goto-char tpos) (current-column))
|
|
|
+ bullet (match-string 1)
|
|
|
+ bullet-type (if (string-match "[0-9]" bullet) "n" bullet))
|
|
|
+ (if (> tcol (+ bcol org-description-max-indent))
|
|
|
+ (setq tcol (+ bcol 5)))
|
|
|
+ (if (not itemp)
|
|
|
+ (setq column tcol)
|
|
|
+ (goto-char pos)
|
|
|
+ (beginning-of-line 1)
|
|
|
+ (if (looking-at "\\S-")
|
|
|
+ (progn
|
|
|
+ (looking-at "[ \t]*\\(\\S-+\\)[ \t]*")
|
|
|
+ (setq bullet (match-string 1)
|
|
|
+ btype (if (string-match "[0-9]" bullet) "n" bullet))
|
|
|
+ (setq column (if (equal btype bullet-type) bcol tcol)))
|
|
|
+ (setq column (org-get-indentation)))))
|
|
|
+ (t (setq column (org-get-indentation))))))
|
|
|
+ (goto-char pos)
|
|
|
+ (if (<= (current-column) (current-indentation))
|
|
|
+ (org-indent-line-to column)
|
|
|
+ (save-excursion (org-indent-line-to column)))
|
|
|
+ (setq column (current-column))
|
|
|
+ (beginning-of-line 1)
|
|
|
+ (if (looking-at
|
|
|
+ "\\([ \t]+\\)\\(:[-_0-9a-zA-Z]+:\\)[ \t]*\\(\\S-.*\\(\\S-\\|$\\)\\)")
|
|
|
+ (replace-match (concat "\\1" (format org-property-format
|
|
|
+ (match-string 2) (match-string 3)))
|
|
|
+ t nil))
|
|
|
+ (org-move-to-column column)))
|
|
|
|
|
|
(defun org-set-autofill-regexps ()
|
|
|
(interactive)
|