summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien <bzg@gnu.org>2018-11-28 13:05:47 +0100
committerBastien <bzg@gnu.org>2018-11-28 13:05:47 +0100
commitd9ab07042ae110567aef3d6b6082ed3ba7006835 (patch)
treea147832c7141dd4e7a7b25700aa25c7806699771
parent32b16bceb6c0ecfe88eaaa7f67ebec7a6245e060 (diff)
parente3fdef74b9092f7c8fc49013bfc7bb8d1ef5f72a (diff)
downloadorg-mode-d9ab07042ae110567aef3d6b6082ed3ba7006835.tar.gz
Merge branch 'master' of code.orgmode.org:bzg/org-mode
-rw-r--r--lisp/org.el46
-rw-r--r--lisp/ox-latex.el33
-rw-r--r--lisp/ox.el5
3 files changed, 43 insertions, 41 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 0da0007..8dddf02 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4138,10 +4138,12 @@ A cell is of the format
If SNIPPET-FLAG is non-nil, the package also needs to be included
when compiling LaTeX snippets into images for inclusion into
-non-LaTeX output. COMPILERS is a list of compilers that should
-include the package, see `org-latex-compiler'. If the document
-compiler is not in the list, and the list is non-nil, the package
-will not be inserted in the final document.
+non-LaTeX output.
+
+COMPILERS is a list of compilers that should include the package,
+see `org-latex-compiler'. If the document compiler is not in the
+list, and the list is non-nil, the package will not be inserted
+in the final document.
A string will be inserted as-is in the header of the document."
:group 'org-latex
@@ -4175,6 +4177,11 @@ SNIPPET-FLAG, when non-nil, indicates that this package is also
needed when turning LaTeX snippets into images for inclusion into
non-LaTeX output.
+COMPILERS is a list of compilers that should include the package,
+see `org-latex-compiler'. If the document compiler is not in the
+list, and the list is non-nil, the package will not be inserted
+in the final document.
+
A string will be inserted as-is in the header of the document.
Make sure that you only list packages here which:
@@ -7640,22 +7647,25 @@ unconditionally."
(member arg '((4) (16)))
(and (not invisible-ok)
(invisible-p (max (1- (point)) (point-min)))))
- ;; Position point at the location of insertion.
- (if (not level) ;before first headline
- (org-with-limited-levels (outline-next-heading))
- ;; Make sure we end up on a visible headline if INVISIBLE-OK
- ;; is nil.
- (org-with-limited-levels (org-back-to-heading invisible-ok))
- (cond ((equal arg '(16))
- (org-up-heading-safe)
- (org-end-of-subtree t t))
- (t
- (org-end-of-subtree t t))))
- (unless (bolp) (insert "\n")) ;ensure final newline
+ ;; Position point at the location of insertion. Make sure we
+ ;; end up on a visible headline if INVISIBLE-OK is nil.
+ (org-with-limited-levels
+ (if (not level) (outline-next-heading) ;before first headline
+ (org-back-to-heading invisible-ok)
+ (when (equal arg '(16)) (org-up-heading-safe))
+ (org-end-of-subtree)))
+ (unless (bolp) (insert "\n"))
(unless (and blank? (org-previous-line-empty-p))
(org-N-empty-lines-before-current (if blank? 1 0)))
- (insert stars " \n")
- (forward-char -1))
+ (insert stars " ")
+ (when (eobp) (save-excursion (insert "\n")))
+ ;; When INVISIBLE-OK is non-nil, ensure newly created headline
+ ;; is visible.
+ (unless invisible-ok
+ (pcase (get-char-property-and-overlay (point) 'invisible)
+ (`(outline . ,o)
+ (move-overlay o (overlay-start o) (line-end-position 0)))
+ (_ nil))))
;; At a headline...
((org-at-heading-p)
(cond ((bolp)
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index ebb2b6e..2d77167 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -1440,26 +1440,21 @@ Return the new header."
(defun org-latex--remove-packages (pkg-alist info)
"Remove packages based on the current LaTeX compiler.
-If the fourth argument of an element is set in pkg-alist, and it
-is not a member of the LaTeX compiler of the document, the packages
-is removed. See also `org-latex-compiler'.
+PKG-ALIST is a list of packages, as in `org-latex-packages-alist'
+and `org-latex-default-packages-alist'. If the fourth argument
+of a package is neither nil nor a member of the LaTeX compiler
+associated to the document, the package is removed.
-Return modified pkg-alist."
+Return new list of packages."
(let ((compiler (or (plist-get info :latex-compiler) "")))
- (if (member-ignore-case compiler org-latex-compilers)
- (delq nil
- (mapcar
- (lambda (pkg)
- (unless (and
- (listp pkg)
- (let ((third (nth 3 pkg)))
- (and third
- (not (member-ignore-case
- compiler
- (if (listp third) third (list third)))))))
- pkg))
- pkg-alist))
- pkg-alist)))
+ (if (not (member-ignore-case compiler org-latex-compilers)) pkg-alist
+ (cl-remove-if-not
+ (lambda (package)
+ (pcase package
+ (`(,_ ,_ ,_ nil) t)
+ (`(,_ ,_ ,_ ,compilers) (member-ignore-case compiler compilers))
+ (_ t)))
+ pkg-alist))))
(defun org-latex--find-verb-separator (s)
"Return a character not used in string S.
@@ -2892,7 +2887,7 @@ contextual information."
(listings (plist-get info :latex-listings)))
(cond
;; Case 1. No source fontification.
- ((not listings)
+ ((or (not lang) (not listings))
(let* ((caption-str (org-latex--caption/label-string src-block info))
(float-env
(cond ((string= "multicolumn" float)
diff --git a/lisp/ox.el b/lisp/ox.el
index 743fcd7..ad4942b 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -2673,10 +2673,7 @@ The function assumes BUFFER's major mode is `org-mode'."
(quote ,val))
vars))))))
;; Whole buffer contents.
- (insert
- ,(org-with-wide-buffer
- (buffer-substring-no-properties
- (point-min) (point-max))))
+ (insert ,(org-with-wide-buffer (buffer-string)))
;; Narrowing.
,(if (org-region-active-p)
`(narrow-to-region ,(region-beginning) ,(region-end))