emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Bug: src code blocks of type compilation-minor don't work when gener


From: John Ciolfi
Subject: [O] Bug: src code blocks of type compilation-minor don't work when generating PDF [9.1.14 (9.1.14-dist @ /path/to/org/install/emacs/site-lisp/org/)]
Date: Fri, 1 Feb 2019 08:48:11 -0500

Hi

Using following

  emacs -q --batch -L /path/to/org/install/emacs/site-lisp/org -l 
my-org-to-pdf.el

the generated PDF is incorrect. The "compilation-minor" code block gets
replaced with the "c" code block, i.e. the c code block is
duplicated. If you generate HTML all is good. Running org-lint doesn't
indicate that one cannot use compilation-minor code blocks.

I'm using Emacs 25.1.1 with the released version of org-mode
9.1.14. It would be nice if this was supported. Alternatively, if
compilation-minor (or compilation) code blocks are not supported could
and error be produced?

Thanks


--- my-org-to-pdf.el ---

(require 'org)
(require 'ox-latex)
(require 'ox-publish)

(defun my-org-to-pdf (org-file)
  "Convert current org-mode buffer to FILE.pdf"
  (find-file org-file)
  (if (not (eq major-mode 'org-mode))
      (error "%S current buffer is not an org file" org-file))
  (let ((org-latex-image-default-width "")
        (org-latex-listings 'minted)
        (org-latex-logfiles-extensions (remove "log" 
org-latex-logfiles-extensions))
        (org-latex-packages-alist '(("cache=false" "minted")))
        (org-latex-minted-options '(("xleftmargin" "1em")
                                    ("breaklines" "true")
                                    ("fontsize" "\\small")))
        (org-latex-pdf-process
         '("pdflatex -shell-escape -interaction nonstopmode -output-directory 
%o %f"
           "pdflatex -shell-escape -interaction nonstopmode -output-directory 
%o %f"))
        (pdf-file))
    ;; Color the hyper links, see
    ;; 
https://tex.stackexchange.com/questions/823/remove-ugly-borders-around-clickable-cross-references-and-hyperlinks
    (add-to-list 'org-latex-default-packages-alist
                 
'("colorlinks=true,linkcolor={red!50!black},citecolor={blue!50!black},urlcolor={blue!80!black}"
 "hyperref" nil))
    (setq pdf-file (org-latex-export-to-pdf))
    (set-buffer-modified-p nil)
    (message "Created %S" pdf-file)))

(my-org-to-pdf "foo.org")


--- foo.org ---

#+STARTUP: showall

#+BEGIN_SRC c
double foo(double u) {
    int k;

    int u2 = u + k;

    int u3 = u;

    return(u2 * 2.0);
}
#+END_SRC


#+BEGIN_SRC compilation-minor
foo.c: In function ‘foo’:
foo.c:6:9: warning: unused variable ‘u3’ [-Wunused-variable]
     int u3 = u;
         ^~
foo.c:4:16: warning: ‘k’ is used uninitialized in this function 
[-Wuninitialized]
     int u2 = u + k;
              ~~^~~
#+END_SRC

<#part type="application/emacs-lisp" 
filename="/mathworks/devel/sandbox/ciolfi/projects/org_mode/issues/src_block_compilation_minor/my-org-to-pdf.el"
 disposition=attachment>
<#/part>

<#part type="text/x-org" 
filename="/mathworks/devel/sandbox/ciolfi/projects/org_mode/issues/src_block_compilation_minor/foo.org"
 disposition=inline>
<#/part>

<#part type="application/pdf" 
filename="/mathworks/devel/sandbox/ciolfi/projects/org_mode/issues/src_block_compilation_minor/foo.pdf"
 disposition=attachment>
<#/part>




Emacs  : GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2017-09-15, modified by Debian
Package: Org mode version 9.1.14 (9.1.14-dist @ 
/path/to/org/install/emacs/site-lisp/org/)

current state:
==============
(setq
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
                      org-babel-header-arg-expand)
 org-speed-command-hook '(org-speed-command-activate
                          org-babel-speed-command-activate)
 org-occur-hook '(org-first-headline-recenter)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-confirm-shell-link-function 'yes-or-no-p
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
                     org-src-mode-configure-edit-buffer)
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-babel-pre-tangle-hook '(save-buffer)
 org-mode-hook '(#[0 "\300\301\302\303\304$\207"
                   [add-hook change-major-mode-hook org-show-block-all append
                    local]
                   5]
                 #[0 "\300\301\302\303\304$\207"
                   [add-hook change-major-mode-hook org-babel-show-result-all
                    append local]
                   5]
                 org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 "\n\n(fn 
ENTRY)"]
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-hide-drawers
                  org-cycle-show-empty-lines
                  org-optimize-window-after-visibility-change)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-link-parameters '(("id" :follow org-id-open)
                       ("rmail" :follow org-rmail-open :store
                        org-rmail-store-link)
                       ("mhe" :follow org-mhe-open :store org-mhe-store-link)
                       ("irc" :follow org-irc-visit :store org-irc-store-link)
                       ("info" :follow org-info-open :export org-info-export
                        :store org-info-store-link)
                       ("gnus" :follow org-gnus-open :store
                        org-gnus-store-link)
                       ("docview" :follow org-docview-open :export
                        org-docview-export :store org-docview-store-link)
                       ("bibtex" :follow org-bibtex-open :store
                        org-bibtex-store-link)
                       ("bbdb" :follow org-bbdb-open :export org-bbdb-export
                        :complete org-bbdb-complete-link :store
                        org-bbdb-store-link)
                       ("w3m" :store org-w3m-store-link) ("file+sys")
                       ("file+emacs") ("doi" :follow org--open-doi-link)
                       ("elisp" :follow org--open-elisp-link)
                       ("file" :complete org-file-complete-link)
                       ("ftp" :follow
                        (lambda (path) (browse-url (concat "ftp:" path))))
                       ("help" :follow org--open-help-link)
                       ("http" :follow
                        (lambda (path) (browse-url (concat "http:" path))))
                       ("https" :follow
                        (lambda (path) (browse-url (concat "https:" path))))
                       ("mailto" :follow
                        (lambda (path) (browse-url (concat "mailto:"; path))))
                       ("news" :follow
                        (lambda (path) (browse-url (concat "news:"; path))))
                       ("shell" :follow org--open-shell-link))
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 )




reply via email to

[Prev in Thread] Current Thread [Next in Thread]