Merge branch 'fix-orgstruct'
This commit is contained in:
commit
9f3b35a114
|
@ -410,6 +410,12 @@ the value in cdr."
|
||||||
(cons (list (car flat) (cadr flat))
|
(cons (list (car flat) (cadr flat))
|
||||||
(org-make-parameter-alist (cddr flat)))))
|
(org-make-parameter-alist (cddr flat)))))
|
||||||
|
|
||||||
|
(defmacro orgstruct++-ignore-org-filling (&rest body)
|
||||||
|
"Ignore org filling in `orgstruct++-mode'."
|
||||||
|
`(let ,org-fb-vars
|
||||||
|
,@body))
|
||||||
|
(def-edebug-spec orgstruct++-ignore-org-filling (&optional ("quote" body)))
|
||||||
|
|
||||||
(provide 'org-macs)
|
(provide 'org-macs)
|
||||||
|
|
||||||
;;; org-macs.el ends here
|
;;; org-macs.el ends here
|
||||||
|
|
42
lisp/org.el
42
lisp/org.el
|
@ -4943,12 +4943,6 @@ Stars are put in group 1 and the trimmed body in group 2.")
|
||||||
|
|
||||||
(defvar bidi-paragraph-direction)
|
(defvar bidi-paragraph-direction)
|
||||||
(defvar buffer-face-mode-face)
|
(defvar buffer-face-mode-face)
|
||||||
(defvar org-auto-fill-fallback-function nil)
|
|
||||||
(defvar org-indent-line-fallback-function nil)
|
|
||||||
(defvar org-fill-paragraph-fallback-function nil)
|
|
||||||
(make-variable-buffer-local 'org-auto-fill-fallback-function)
|
|
||||||
(make-variable-buffer-local 'org-indent-line-fallback-function)
|
|
||||||
(make-variable-buffer-local 'org-fill-paragraph-fallback-function)
|
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(define-derived-mode org-mode outline-mode "Org"
|
(define-derived-mode org-mode outline-mode "Org"
|
||||||
|
@ -8366,6 +8360,8 @@ C-c C-c Set tags / toggle checkbox"
|
||||||
"Unconditionally turn on `orgstruct-mode'."
|
"Unconditionally turn on `orgstruct-mode'."
|
||||||
(orgstruct-mode 1))
|
(orgstruct-mode 1))
|
||||||
|
|
||||||
|
(defvar org-fb-vars nil)
|
||||||
|
(make-variable-buffer-local 'org-fb-vars)
|
||||||
(defun orgstruct++-mode (&optional arg)
|
(defun orgstruct++-mode (&optional arg)
|
||||||
"Toggle `orgstruct-mode', the enhanced version of it.
|
"Toggle `orgstruct-mode', the enhanced version of it.
|
||||||
In addition to setting orgstruct-mode, this also exports all indentation
|
In addition to setting orgstruct-mode, this also exports all indentation
|
||||||
|
@ -8375,14 +8371,15 @@ Note that turning off orgstruct-mode will *not* remove the
|
||||||
indentation/paragraph settings. This can only be done by refreshing the
|
indentation/paragraph settings. This can only be done by refreshing the
|
||||||
major mode, for example with \\[normal-mode]."
|
major mode, for example with \\[normal-mode]."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
(setq arg (prefix-numeric-value (or arg (if orgstruct-mode -1 1)))
|
(setq arg (prefix-numeric-value (or arg (if orgstruct-mode -1 1))))
|
||||||
;; Set fallback functions
|
|
||||||
org-auto-fill-fallback-function auto-fill-function
|
|
||||||
org-indent-line-fallback-function indent-line-function
|
|
||||||
org-fill-paragraph-fallback-function fill-paragraph-function)
|
|
||||||
(if (< arg 1)
|
(if (< arg 1)
|
||||||
(orgstruct-mode -1)
|
(progn (orgstruct-mode -1)
|
||||||
|
(mapc (lambda(v)
|
||||||
|
(org-set-local (car v)
|
||||||
|
(if (eq (car-safe (cadr v)) 'quote) (cadadr v) (cadr v))))
|
||||||
|
org-fb-vars))
|
||||||
(orgstruct-mode 1)
|
(orgstruct-mode 1)
|
||||||
|
(setq org-fb-vars nil)
|
||||||
(let (var val)
|
(let (var val)
|
||||||
(mapc
|
(mapc
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
|
@ -8390,6 +8387,7 @@ major mode, for example with \\[normal-mode]."
|
||||||
"^\\(paragraph-\\|auto-fill\\|fill-paragraph\\|adaptive-fill\\|indent-\\)"
|
"^\\(paragraph-\\|auto-fill\\|fill-paragraph\\|adaptive-fill\\|indent-\\)"
|
||||||
(symbol-name (car x)))
|
(symbol-name (car x)))
|
||||||
(setq var (car x) val (nth 1 x))
|
(setq var (car x) val (nth 1 x))
|
||||||
|
(push (list var `(quote ,(eval var))) org-fb-vars)
|
||||||
(org-set-local var (if (eq (car-safe val) 'quote) (nth 1 val) val))))
|
(org-set-local var (if (eq (car-safe val) 'quote) (nth 1 val) val))))
|
||||||
org-local-vars)
|
org-local-vars)
|
||||||
(org-set-local 'orgstruct-is-++ t))))
|
(org-set-local 'orgstruct-is-++ t))))
|
||||||
|
@ -20402,11 +20400,13 @@ If point is in an inline task, mark that task instead."
|
||||||
;;; Paragraph filling stuff.
|
;;; Paragraph filling stuff.
|
||||||
;; We want this to be just right, so use the full arsenal.
|
;; We want this to be just right, so use the full arsenal.
|
||||||
|
|
||||||
|
(declare-function orgstruct++-ignore-org-filling "org-macs.el" (&rest body))
|
||||||
(defun org-indent-line-function ()
|
(defun org-indent-line-function ()
|
||||||
"Indent line depending on context."
|
"Indent line depending on context."
|
||||||
(interactive)
|
(interactive)
|
||||||
(if org-indent-line-fallback-function
|
(if orgstruct-is-++
|
||||||
(funcall org-indent-line-fallback-function)
|
(orgstruct++-ignore-org-filling
|
||||||
|
(funcall indent-line-function))
|
||||||
(let* ((pos (point))
|
(let* ((pos (point))
|
||||||
(itemp (org-at-item-p))
|
(itemp (org-at-item-p))
|
||||||
(case-fold-search t)
|
(case-fold-search t)
|
||||||
|
@ -20709,8 +20709,11 @@ the functionality can be provided as a fall-back.")
|
||||||
(save-excursion (forward-paragraph 1) (point)))
|
(save-excursion (forward-paragraph 1) (point)))
|
||||||
(fill-paragraph justify) t))
|
(fill-paragraph justify) t))
|
||||||
;; Else falls back on `org-fill-paragraph-fallback-function'
|
;; Else falls back on `org-fill-paragraph-fallback-function'
|
||||||
(org-fill-paragraph-fallback-function
|
(orgstruct-is-++
|
||||||
(funcall org-fill-paragraph-fallback-function justify))
|
(orgstruct++-ignore-org-filling
|
||||||
|
(fill-paragraph)))
|
||||||
|
;; (org-fill-paragraph-fallback-function
|
||||||
|
;; (funcall org-fill-paragraph-fallback-function justify))
|
||||||
;; Else simply call `fill-paragraph'.
|
;; Else simply call `fill-paragraph'.
|
||||||
(t nil))))
|
(t nil))))
|
||||||
|
|
||||||
|
@ -20754,10 +20757,9 @@ the functionality can be provided as a fall-back.")
|
||||||
(setq prefix (make-string (org-list-item-body-column itemp) ?\ ))
|
(setq prefix (make-string (org-list-item-body-column itemp) ?\ ))
|
||||||
(flet ((fill-context-prefix (from to &optional flr) prefix))
|
(flet ((fill-context-prefix (from to &optional flr) prefix))
|
||||||
(do-auto-fill))))
|
(do-auto-fill))))
|
||||||
(org-auto-fill-fallback-function
|
(orgstruct-is-++
|
||||||
(let ((fill-prefix ""))
|
(orgstruct++-ignore-org-filling
|
||||||
(funcall org-auto-fill-fallback-function)))
|
(do-auto-fill)))
|
||||||
;; Else just use `do-auto-fill'.
|
|
||||||
(t (do-auto-fill)))))
|
(t (do-auto-fill)))))
|
||||||
|
|
||||||
;;; Other stuff.
|
;;; Other stuff.
|
||||||
|
|
Loading…
Reference in New Issue