Re: [O] temporary set source blocks major-mode-hook to nil locally to speed up Org Mode

2018-10-15 Thread Nicolas Goaziou
Hello,

stardiviner  writes:

> When I open a big Org file which contains many different languages
> source blocks. And when the Org file buffer is fontified when option
> `org-src-fontify-natively` is enabled. Org will try to load those
> major modes. Including major-mode-hook like "clojure-mode-hook",
> "emacs-lisp-mode-hook", "python-mode-hook" etc. But for fontify the
> source blocks, I don't think it is necessary to load those
> major-mode-hooks. Also they are slow. Like in my case, most of time is
> used for loading source blocks major-mode-hooks.
>
> - clojure-mode-hook has CIDER etc
> - python-mode-hook has elpy etc
> - emacs-lisp-mode-hook has some utilities.
>
> Temporary disable those major-mode-hooks by set-local them to nil is a good 
> solution to speed-up Org.
>
> WDYT? If I'm wrong, please give out some thought from you. Thanks.

Some major modes may use major mode hooks to finish setting up their
fontification process, who knows.

In any case, it could be worth trying it. Do you want to provide a patch
for that?

Regards,

-- 
Nicolas Goaziou



Re: [O] Bug: Column width ignored ? [9.1.14 (release_9.1.14-987-g823d90 @ /usr/share/emacs/site-lisp/org/)]

2018-10-15 Thread Nicolas Goaziou
Hello,

Frederic Gilbert  writes:

> Following an upgrade from 8.2.10 to 9.1.14 from GIT repository,
> it looks like tables column width specifications (e.g. <10> on a row)
> don't work anymore.

Could you explain what doesn't work?

Regards,

-- 
Nicolas Goaziou



[O] Exporting each subtree, including the headline?

2018-10-15 Thread Diego Zamboni
Hi,

I am working on publishing a book using LeanPub (
https://leanpub.com/learning-hammerspoon/), produced from an Org source
file. I am trying to use the code from
https://medium.com/@lakshminp/publishing-a-book-using-org-mode-9e817a56d144,
which you can see here:
https://gist.githubusercontent.com/badri/4d1bf1f0a24e8db5065e31946355cfe3/raw/86889ba22e381252e11aa3a8678f31023aa10f7e/leanpub-export.el

The code works, and each resulting file (one per top-level subtree)
contains the corresponding section, but without the headline. I would like
the headling to be exported as well.

I have been looking around and found this:
https://emacs.stackexchange.com/a/2260. This code exports each section
including its headline, but each file contains the corresponding section
PLUS everything after it.

I've been poking around the org functions, but I haven't been able to
figure this out. Any ideas?

Thanks in advance,
--Diego


Re: [O] mathjax macro in org-mode

2018-10-15 Thread Jeremie Juste
Jeremie Juste  writes:

Hello,

looking deeper into the docs I saw that we could modify the
org-html-mathjax-template in the following way to add the macro.


(setq (org-html-mathjax-template
   "
MathJax.Hub.Config({
displayAlign: \"%ALIGN\",
displayIndent: \"%INDENT\",

\"HTML-CSS\": { scale: %SCALE,
linebreaks: { automatic: \"%LINEBREAKS\" },
webFont: \"%FONT\"
   },
SVG: {scale: %SCALE,
  linebreaks: { automatic: \"%LINEBREAKS\" },
  font: \"%FONT\"},
NativeMML: {scale: %SCALE},
TeX: { equationNumbers: {autoNumber: \"%AUTONUMBER\"},
   MultLineWidth: \"%MULTLINEWIDTH\",
   TagSide: \"%TAGSIDE\",
   TagIndent: \"%TAGINDENT\",
 Macros: {
  R: '{mathbb{R}}',
  arr: '{#1_{^{}_{#3}}^{^{#2}}}',
  myperm: '{frac{#2!}{(#2-#1)!}}'
}

 }
});

"))

another quick option is just to define the latex macro directly in the
main body as follows before exporting to html but this would generate an
 when exporting to latex

$\newcommand{\R}{\mathbb{R}}$


Hope it helps,

Jeremie


> Hello,
>
> I was wondering how to set up mathjax macro in org-mode. For instance
> would it be possible to use #+HTML_MATHJAX: to include the following macro?
>
>  Macros: {
>   R: '{\\mathbb{R}}',
>   bold: ['{\\bf #1}',1]
> }
>
> So far my attempts have been unsuccessful.
>
> Best regards,
>
> Jeremie



[O] Bug: Column width ignored ? [9.1.14 (release_9.1.14-987-g823d90 @ /usr/share/emacs/site-lisp/org/)]

2018-10-15 Thread Frederic Gilbert




Remember to cover the basics, that is, what you expected to happen and
what in fact did happen.  You don't know how to make a good report?  See

 https://orgmode.org/manual/Feedback.html#Feedback

Your bug report will be posted to the Org mailing list.


Hi,

Following an upgrade from 8.2.10 to 9.1.14 from GIT repository,
it looks like tables column width specifications (e.g. <10> on a row)
don't work anymore.
Sorry if there was a syntax change but I could not find any information.

Best regards,
Frederic Gilbert.

Emacs  : GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21)
 of 2017-09-22, modified by Debian
Package: Org mode version 9.1.14 (release_9.1.14-987-g823d90 @ 
/usr/share/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-todo-keyword-faces '(("IN_PROGRESS" . "orange") ("STANDBY" . 
"darkkhaki")

  ("CANCELLED" . "darkcyan"))
 org-after-todo-state-change-hook '(org-clock-out-if-current)
 org-from-is-user-regexp "\\"
 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-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-refile-targets '((nil :maxlevel . 9) (org-agenda-files :maxlevel . 9)
  (org-mobile-files :maxlevel . 9))
 org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3 
"\n\n(fn ENTRY)"]

 org-archive-hook '(org-attach-archive-delete-maybe)
 org-directory "~/Dropbox/palm/org"
 org-cycle-hook '(org-cycle-hide-archived-subtrees 
org-cycle-show-empty-lines

  org-optimize-window-after-visibility-change)
 org-todo-keywords '((sequence "TODO" "IN_PROGRESS" "STANDBY" "|" "DONE"
  "CANCELLED")
 )
 org-babel-tangle-lang-exts '(("sed" . "sed") ("awk" . "awk")
  ("python" . "py") ("emacs-lisp" . "el")
  ("elisp" . "el"))
 org-confirm-elisp-link-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-startup-truncated nil
 org-link-parameters '(("id" :follow org-id-open)
   ("eww" :follow eww :store org-eww-store-link)
   ("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
:export org-irc-export)
   ("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 or

[O] (no subject)

2018-10-15 Thread Nik Clayton
Hi,

I'd like to propose a couple of changes / enhancements to how org-export
exports some data in to HTML files to make it slightly easier to style
those files.

The first is re line-numbers.

At the moment those get exported as content in the HTML, although they're
really additional metadata. Amongst other things, this means that if you
copy/paste from the output you get the line numbers included in the text
that's copied.

CSS supports arbitrary counters that can be associated with content,
starting from an arbitrary value. My current hack that sort of works is the
following CSS:

/* Hide the current line numbers */
span.linenr {
  display: none;
}

/* Style each line. Maintain a counter for each line, increment
   by one for each ... element.
.reveal pre.src code {
  display: inline;
  font-size: 125%;
  line-height: 1.2;
  counter-increment: line;
}

/* Show a line number before each line. */
.reveal pre.src code:before {
  content: counter(line);
  border-right: 1px solid #ddd;
  padding: 0 0.5em;
  margin-right: 0.5em;
  width: 1em;
  display: inline-block;
  text-align: right;
}

and a change to org-html-do-format-code to wrap each line in its own
... element:

...
  ;; Transcoded src line.
  (format "%s" loc)
...

But this adds line numbers to all code blocks, irrespective of the "-n"
option, and they all start from one.

What I'd like to do is change the output to:

1. Omit the ..." content.
2. Add an additional class to the pre element to indicate whether or not
this block should have line numbers.
3. Add a data-ox-starting-number (or similar) attribute to the pre element
that specifies what the starting line number for this block should be.

Couple of questions before I write a patch:

a) Does that sound reasonable?
b) Should this replace the current approach, or be an option that can be
toggled by a customisation?


And the second is re languages associated with exported SRC blocks.

At the moment the language is mentioned as src-... class (src-html,
src-javascript, etc).

I'd like to put the language in a data-ox-src-language attribute as well
(e.g., ...) so
that I can put use CSS to put badges indicating the language in the output.

Per
https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes
that would look something like:

.src:after {
  content: attr(data-ox-src-language);
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 70%;
  background: green;
  color: white;
  text-align: center;
  line-height: 18px;
  border-radius: .25em;
  padding: 0 0.5em;
  box-shadow: 0 0 1px #333;
}

I see there's already some code that tries to show language badges on hover
(which doesn't work for me for some reason, I haven't dug in to why).

Does this change sound reasonable?

Here's a screenshot from an export showing early versions of these changes
in action. Notice how the selected text (the first function) doesn't
include the line numbers in the selection.

[image: image.png]

N