[BUG] org-element-cache warnings [9.6.1 ( @ d:/.emacs.d/elpa/org-9.6.1/)]

2023-04-10 Thread Vladimir Alexiev
When I save a particular file
https://github.com/Accord-Project/bsdd/blob/main/README-bug.org,
I get this warning (and request to post a bug):

Warning (org-element-cache): org-element--cache: Org parser error in
README.org::1092. Resetting.
 The error was: (error "Invalid search bound (wrong side of point)")
 Backtrace:
nil

In another case when I am at line:col 1578:93 and save, I get this warning:

Warning (org-element-cache): org-element--cache: (save-buffer) Cached
element is incorrect in README.org. (Cache tic up to date: "yes") Resetting.
If this warning appears regularly, please report the warning text to Org
mode mailing list (M-x org-submit-bug-report).
The element is: "(paragraph (:begin 1 :end 14 :contents-begin 1
:contents-end 14 :post-blank 0 :post-affiliated 1 :mode top-comment
:granularity element :cached t :parent (section (:begin 1 :end 14
:contents-begin 1 :contents-end 14 :robust-begin 1 :robust-end 12
:post-blank 0 :post-affiliated 1 :mode first-section :granularity element
:cached t :parent (org-data ...)"
 The real element is: "(keyword (:key \"OPTIONS\" :value \"':nil *:t -:t
::t <:t H:5 n:nil ^:{} arch:headline author:t\" :begin 1 :end 73
:post-blank 0 :post-affiliated 1 :mode top-comment :granularity element
:parent (section (:begin 1 :end 981 :contents-begin 1 :contents-end 980
:robust-begin 1 :robust-end 978 :post-blank 1 :post-affiliated 1 :mode
first-section :granularity element :parent (org-data ...)"
 Cache around :begin:
nil
(paragraph (:begin 1 :end 14 :contents-begin 1 :contents-end 14 :post-blank
0 :post-affiliated 1 :mode top-comment :granularity element :cached t
:parent (section (:begin 1 :end 14 :contents-begin 1 :contents-end 14
:robust-begin 1 :robust-end 12 :post-blank 0 :post-affiliated 1 :mode
first-section :granularity element :cached t :parent (org-data (:begin 1
:contents-begin 1 :contents-end 14 :end 14 :robust-begin 3 :robust-end 12
:post-blank 0 :post-affiliated 1 :path nil :mode org-data :CATEGORY nil
:cached t))


Emacs  : GNU Emacs 28.1 (build 52, x86_64-w64-mingw32)
 of 2022-04-04
Package: Org mode version 9.6.1 ( @ d:/.emacs.d/elpa/org-9.6.1/)

current state: (two hook values simplified rather than showing bytecode)
==
(setq
 org-html-with-latex nil
 org-link-elisp-confirm-function 'yes-or-no-p
 org-hierarchical-todo-statistics nil
 org-export-with-sub-superscripts '{}
 org-yank-adjusted-subtrees t
 org-agenda-custom-commands nil
 org-startup-folded "showeverything"
 org-babel-after-execute-hook '(va/org-babel-after-execute-hook)
 org-persist-after-read-hook '(org-element--cache-persist-after-read)
 org-export-before-parsing-hook '(org-attach-expand-links)
 org-cycle-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-html-postamble t
 org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-show-empty-lines
  org-cycle-optimize-window-after-visibility-change
org-cycle-display-inline-images)
 org-latex-listings-options '(("basicstyle" "\\footnotesize\\ttfamily")
("frame" "single")
  ("showstringspaces" "false"))
 org-startup-numerated t
 org-persist-before-read-hook '(org-element--cache-persist-before-read)
 org-modules '(org-attach org-crypt org-entities org-id org-mouse
org-protocol org-tempo)
 org-link-from-user-regexp "\\"
 org-image-actual-width '(500)
 org-export-use-babel nil
 org-mode-hook '(#f(compiled-function
()
#)
   org-tempo-setup #f(compiled-function
  ()
  #)
   my-orgtbl-mode-hook #f(compiled-function
  ()
  #)
   #f(compiled-function
  ()
  #)
   org-babel-result-hide-spec org-babel-hide-all-hashes va/org-mode-hook)
 org-babel-load-languages '((emacs-lisp . t) (ditaa . t) (dot . t) (perl .
t) (plantuml . t) (salt . t)
(shell . t) (sparql . t))
 org-export-headline-levels 5
 org-highlight-links '(bracket angle plain radio footnote)
 org-latex-default-figure-position "!htpb"
 org-html-head " #content {max-width: 120em; margin: auto}
h1,h2,h3,h4,h5,h6,h7 {font-family: Arial} .author, .date, .creator
{-webkit-margin-before: 0em; -webkit-margin-after: 0em} .abstract {margin:
1em; padding: 1em; border: 1px solid black} .abstract:before {content:
'Abstract: '; font-weight: bold} #preamble p {font-size: 110%%;
margin-left: auto; margin-right: auto; text-align: center} th.org-left
{text-align:left} th.org-right  {text-align:right} th.org-center
{text-align:center} th, td {line-height: 1em; border-width: 1px;
border-style: solid solid; border-spacing: 2px 2px; padding: 2px 1px}
.CANCELED {color: blue} .MAYBE {color: blue} .POSTPONED {color: blue} .SAME
{color: blue} .APPLIED {color: orange} .FOLLOW {color: orange} .INPROGRESS
{color: orange} .NEXT {color: orange} .IER {color: orange}.underline
{text-decoration:underline} "
 org-export-allow-bind-keywords 

Re: [BUG] ox-md image captions

2023-04-07 Thread Vladimir Alexiev
Hi Max!
It's not about the tooltip in HTML:
figure captions are very important in scholarly publishing.


Re: [BUG] ox-md image captions

2023-04-05 Thread Vladimir Alexiev
I posted a Pandoc request: https://github.com/jgm/pandoc/issues/8752

On Wed, Apr 5, 2023 at 2:04 PM Ihor Radchenko  wrote:

> Morgan Willcock  writes:
>
> > If ox-md is trying to do the same thing as Markdown.pl then it doesn't
> > really make sense to compare it to CommonMark.
>
> Most likely, ox-md is following Markdown.pl simply because there was no
> better standard at the time ox-md was written.
>
> I now looked up a comparison between markdown flavours (see the attached)
> and I do not see why we should abandon following the original markdown.
> CommonMark and other markdown flavours usually extend things on top of
> the original implementation. So, following Markdown.pl should be the
> most universal option. We leave more specific exporters for advanced
> markdown flavours to external packages.
>
> > The only point am I trying to make is that both ox-md and Pandoc need to
> > deal in the same unambiguous specification in order to inter-operate.
> >
> > For Pandoc, the matching specification needs to be selected to ensure
> > that the correct one is used, but nothing based on Markdown.pl can be
> > unambiguous in this scenario because Markdown.pl has no unambiguous
> > specification.
>
> Indeed.
> I tried to make this point more clear in the attached patch for Org manual.
>
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: [BUG] ox-md image captions

2023-04-04 Thread Vladimir Alexiev
Maybe an option?

Saying "pandoc is in the wrong" doesn't do much to resolve the issue.

Despite my enormous love for orgmode, Pandoc is used a lot more widely for
scholarly publishing and interactive websites. See Quarto and Manubot.

On Tue, Apr 4, 2023, 11:46 Ihor Radchenko  wrote:

> Ihor Radchenko  writes:
>
> > I am inclined to change ![img](url "caption") to
> > ![caption](url) for links without description (links with description do
> > not obey caption in org export).
> >
> > Any objections?
>
> Upon further investigation, I have found that our base MD reference we
> follow in ox-md is defining image syntax as the following:
>
> ![Alt text](/path/to/img.jpg)
>
> ![Alt text](/path/to/img.jpg "Optional title")
>
> https://daringfireball.net/projects/markdown/syntax#img
>
> Therefore, Org mode is doing everything right within the scope of MD
> specification we follow. Pandoc does not.
>
> In fact, looking closer at https://pandoc.org/MANUAL.html#images, I find
> it very strange that alt text is used as image caption, not actual
> title. In HTML, alt text is supposed to be displayed *instead* of the
> image if the image cannot be viewed -- a feature often used as the base
> of accessibility for blind users. See
> https://www.w3schools.com/TAGS/att_alt.asp
>
> Therefore, I see no bug on Org side.
> Canceled.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: Ability to add logo to HTML export

2023-03-26 Thread Vladimir Alexiev
Thanks, that works!

On Fri, Mar 24, 2023 at 4:04 PM Ihor Radchenko  wrote:

> Vladimir Alexiev  writes:
>
> > But then C-c C-e h h complains: "org-export--parse-option-keyword: End of
> > file during parsing".
>
> Please update Org mode.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>


Re: Ability to add logo to HTML export

2023-03-24 Thread Vladimir Alexiev
#+OPTIONS: html-preamble:"Author: %a(%e)Date: %d"

C-c happily says "Local setup has been refreshed"

But then C-c C-e h h complains: "org-export--parse-option-keyword: End of
file during parsing".
I don't see any problem in the string; evaluating it in *scratch* returns
it just fine.
But I think  org-export--parse-option-keyword uses some limited reader...


Ability to add logo to HTML export

2023-03-23 Thread Vladimir Alexiev
Some projects have a logo, which one may want to add to the beginning of a
HTML document.
Eg like this (before authors and Title):
[image: image.png]

Right now I have to resort to a bad kludge to do that: a local variable in
the org file:

#+comment: -*- org-html-preamble: "Author:
%a(%e)Date: %d" -*-

And also this in my org setup:

(put 'org-html-preamble 'safe-local-variable 'stringp)

I looked at

(org-export-define-backend 'html
  :options-alist
(:html-preamble nil "html-preamble" org-html-preamble)

and the help for org-export-options-alist:
this word "html-preamble" corresponds to:

OPTION is a string that could be found in an #+OPTIONS: line.

So I tried this, but it had no effect"

#+OPTION: html-preamble: "Author: %a(%e)Date: %d"

Minor note: normally, I distribute the standard variables between preamble
and postamble as follows:

(setq
 org-html-preamble-format '(("en" "Author: %a (%e)
Date: %d"))
 org-html-postamble t   ; was 'auto which inserts author,
date: but I want those in preamble
 org-html-postamble-format  '(("en" "Exported by %c
%v"))
)


[BUG] ox-md image captions

2023-02-27 Thread Vladimir Alexiev
I have an image caption like this:

#+label: fig:bsdd-graphql-voyager-refact-detail
#+caption: Refactored bSDD GraphQL Schema
[[./img/bsdd-graphql-voyager-refact-Classification-ClassificationProperty.png]]

ox-md exports it like this:

![img](./img/bsdd-graphql-voyager-refact-Classification-ClassificationProperty.png
"Refactored bSDD GraphQL Schema")

(see https://git.sr.ht/~bzg/org-mode/tree/main/item/lisp/ox-md.el#L595)

However, pandoc expects image captions to be formatted like this:

![Refactored bSDD GraphQL
Schema](./img/bsdd-graphql-voyager-refact-Classification-ClassificationProperty.png)

(see https://pandoc.org/MANUAL.html#images).
Consequently, all my captions are lost and replaced with "img".

Maybe ox-md should emit captions in both places?

![caption](image-url "caption")

Note: I checked, ox-gfm doesn't do anything different regarding image
captuions

---

[9.5.2 (release_9.5.2-25-gaf6f12 @ c:/Emacs/share/emacs/28.1/lisp/org/)]
Emacs  : GNU Emacs 28.1 (build 52, x86_64-w64-mingw32) of 2022-04-04
Package: Org mode version 9.5.2 (release_9.5.2-25-gaf6f12 @
c:/Emacs/share/emacs/28.1/lisp/org/)


Re: configure separator in org-table-insert-hline

2020-08-22 Thread Vladimir Alexiev
How can I use radio tables for that?


Re: configure separator in org-table-insert-hline

2020-08-21 Thread Vladimir Alexiev
>
> You may suggest it to Markdown mode. I think this is a terrible idea for
> Org mode: syntax should not be optional.
>

But I'm not talking about org-mode !
I'm talking about orgtbl minor mode.
That minor mode is supposed to work in other modes (that's the whole
purpose of its existence),
and so it should be able to adapt to the table syntax of those
modes/notations.

Yes, markdown-mode may need to do something to use orgtbl-mode.
The problem is that the two functions are not adaptable because "+" is
hard-coded in them.


Re: configure separator in org-table-insert-hline

2020-08-21 Thread Vladimir Alexiev
> That will not work without changing Org syntax. Markdown and Org table
are incompatible.

I guess you're right re support for formulas, table export, table
input/output from code, etc.
But I don't expect any of that of Markdown tables.
All I expect is that I can use table editing and alignment, and have proper
markdown hlines.

Here's some code that works for me.
It overwrites 2 org table functions, changing just one line (see "FIXED").
Would be nice if this can be adopted in org; of course with a proper option
etc.

Cheers!


;; Make org table minor mode (orgtbl-mode) support "|" as hline separator
in markdown

(add-hook 'orgtbl-mode-hook
  (defun my-orgtbl-mode-hook ()
(set (make-local-variable 'org-table-hline-separator)
 (if (memq major-mode '(markdown-mode gfm-mode))
 "|" "+"

(eval-after-load "org" '(fset 'org-table-align 'my-org-table-align))
(eval-after-load "org-table" '(fset 'org-table-insert-hline
'my-org-table-insert-hline))

(defun my-org-table-align ()
  "Align the table at point by aligning all vertical bars."
  (interactive)
  (let ((beg (org-table-begin))
(end (copy-marker (org-table-end
(org-table-save-field
 ;; Make sure invisible characters in the table are at the right
 ;; place since column widths take them into account.
 (org-font-lock-ensure beg end)
 (move-marker org-table-aligned-begin-marker beg)
 (move-marker org-table-aligned-end-marker end)
 (goto-char beg)
 (org-table-with-shrunk-columns
  (let* ((indent (progn (looking-at "[ \t]*") (match-string 0)))
;; Table's rows as lists of fields.  Rules are replaced
;; by nil.  Trailing spaces are removed.
(fields (mapcar
 (lambda (l)
(and (not (string-match-p org-table-hline-regexp l))
(org-split-string l "[ \t]*|[ \t]*")))
 (split-string (buffer-substring beg end) "\n" t)))
;; Compute number of columns.  If the table contains no
;; field, create a default table and bail out.
(columns-number
 (if fields (apply #'max (mapcar #'length fields))
(kill-region beg end)
(org-table-create org-table-default-size)
(user-error "Empty table - created default table")))
(widths nil)
(alignments nil))
;; Compute alignment and width for each column.
(dotimes (i columns-number)
 (let* ((max-width 1)
(fixed-align? nil)
(numbers 0)
(non-empty 0))
   (dolist (row fields)
 (let ((cell (or (nth i row) "")))
(setq max-width (max max-width (org-string-width cell)))
(cond (fixed-align? nil)
 ((equal cell "") nil)
 ((string-match "\\`<\\([lrc]\\)[0-9]*>\\'" cell)
  (setq fixed-align? (match-string 1 cell)))
 (t
  (cl-incf non-empty)
  (when (string-match-p org-table-number-regexp cell)
(cl-incf numbers))
   (push max-width widths)
   (push (cond
  (fixed-align?)
  ((>= numbers (* org-table-number-fraction non-empty)) "r")
  (t "l"))
 alignments)))
(setq widths (nreverse widths))
(setq alignments (nreverse alignments))
;; Store alignment of this table, for later editing of single
;; fields.
(setq org-table-last-alignment alignments)
(setq org-table-last-column-widths widths)
;; Build new table rows.  Only replace rows that actually
;; changed.
(dolist (row fields)
 (let ((previous (buffer-substring (point) (line-end-position)))
(new
(format "%s|%s|"
indent
(if (null row) ;horizontal rule
(mapconcat (lambda (w) (make-string (+ 2 w) ?-))
widths
org-table-hline-separator) ;; FIXED
  (let ((cells ;add missing fields
 (append row
 (make-list (- columns-number
(length row))
""
(mapconcat #'identity
(cl-mapcar #'org-table--align-field
  cells
  widths
  alignments)
"|"))
   (if (equal new previous)
(forward-line)
 (insert new "\n")
 (delete-region (point) (line-beginning-position 2)
(set-marker end nil)
(when org-table-overlay-coordinates (org-table-overlay-coordinates))
(setq org-table-may-need-update nil))

(defun my-org-table-insert-hline ( above)
  "Insert a horizontal-line below the current line into the table.
With prefix ABOVE, insert above the current line."
  (interactive "P")
  (unless (org-at-table-p) (user-error "Not at a table"))
  (when (eobp) (save-excursion (insert "\n")))
  (unless (string-match-p "|[ \t]*$" (org-current-line-string))
(org-table-align))
  (org-table-with-shrunk-columns
   (let ((line (org-table-clean-line
(buffer-substring (point-at-bol) (point-at-eol
(col (current-column)))
 (while (string-match "|\\( +\\)|" line)
   (setq line (replace-match
  (concat org-table-hline-separator ;; FIXED
   (make-string (- (match-end 1) (match-beginning
1)) ?-)
   "|") t t line)))
 (and (string-match "\\+" line) (setq line (replace-match "|" t t
line)))
 (beginning-of-line (if above 1 2))
 (insert line "\n")
 (beginning-of-line (if above 1 -1))
 (org-move-to-column col)
 (when org-table-overlay-coordinates (org-table-align)


configure separator in org-table-insert-hline

2020-08-21 Thread Vladimir Alexiev
org-table-insert-hline (org-table.el) inserts lines like this
|++|

But I often use orgtbl-mode in markdown-mode,
and in markdown the hlines should be like this:
||||

Perhaps all that's needed is to make this conditional:
(concat "+"


Re: org-babel-demarcate-block doesn't respect case preference

2020-05-25 Thread Vladimir Alexiev
>  Org inserts lower-case #+begin* keywords as a default

But  org-babel-demarcate-block doesn't do that in the case of new block.


org-babel-demarcate-block doesn't respect case preference

2020-05-23 Thread Vladimir Alexiev
org-babel-uppercase-example-markers says whether to insert BEGIN_SRC or
begin_src.

org-babel-demarcate-block doesn't respect this setting:
https://code.orgmode.org/bzg/org-mode/src/master/lisp/ob-core.el#L1893
makes this check

(lower-case-p (and block
  (let (case-fold-search)
(string-match-p "#\\+begin_src" block)

which sets  lower-case-p only if it's inside an existing lowercase block
(i.e. when splitting a block).
Otherwise (when demarcating the region) it goes with uppercase.


[O] org-mode and dokieli / linked-research?

2017-03-27 Thread Vladimir Alexiev
(I'd be much obliged if you comment here: 
https://gist.github.com/VladimirAlexiev/80338cc0ec51d3a402ff6d9b9ce4ae4e)


**Linked Research** is a movement to publish articles in HTML, with embedded 
semantic data 
that would allow not just citations but much deeper interactions. 
Sarven Capadisli is at the forefront of this, and people like Tim Berners-Lee 
and Soren Auer support it fully. 
I believe this is the **future** of scholarly publishing.

- see http://csarven.ca/archives/articles for relevant articles
- https://dokie.li is a template and a set of CSS that produces native HTML, 
LNCS and ACM styles.
  It also includes nice interactive tools (eg comments, citations, Sparklines) 
but is not yet a fully-fledge editor

The best way to write research articles is, of course, plain text.
Org-mode excels at writing PDF articles (amongst many other things), 
but fairly sucks for writing HTML articles (eg there's no standard way to
give the Abstract, multiple authors with affiliations, etc etc).
I believe that an enriched org HTML exporter that can produce dokieli-style 
articles will pave the way to that future.

A first step in that direction is 
http://www-public.tem-tsp.eu/~berger_o/test-org-publishing-rdfa.html 
by Olivier Berger, and there's relevant work by John Kitchin.

I asked this a couple times but there's no takeup yet...

- https://gitter.im/linkeddata/dokieli?at=56a0a7813165a6af1a3d0ad8
- 
https://disqus.com/home/discussion/kitchinresearchgroup/the_kitchin_research_group_934/#comment-2574588842
- http://thread.gmane.org/gmane.emacs.orgmode/96910/focus=96961

There are other similar approaches: Scholarly HTML and RASH.
This is a nice comparison: 
https://essepuntato.github.io/papers/rash-peerj2016.html#sec_related_works




[O] Meaningful & stable anchors in HTML export

2016-07-01 Thread Vladimir Alexiev
Consider e.g. http://vladimiralexiev.github.io/Multisensor/#sec-3-2-2, which
uses an anchor made from the section number.
I much prefer a readable/meaningful anchor like github does:
https://github.com/VladimirAlexiev/VladimirAlexiev.github.io/tree/master/Mul
tisensor#322-normalization-problems 
Numbered anchors are bad because they are not stable: if I move the section,
the anchor will change. 

Github makes anchors from the heading text, which in my experience are a lot
more stable.
In the above case it added the section number since I have
#+OPTIONS: num:t
in
https://raw.githubusercontent.com/VladimirAlexiev/VladimirAlexiev.github.io/
master/Multisensor/index.org.
But I'm willing to give up section numbering in favor of stable anchors.

In the HTML exporter (ox-html.el) version org-plus-contrib-20150803, the
following are tried in succession to obtain a preferred-id:

  (list (org-element-property :CUSTOM_ID headline)
(concat "sec-" section-number)
(org-element-property :ID headline

The first is manually set CUSTOM_ID property, the second a numbered secton
(eg "sec-3-2-2") and the third an ID that's automatically inserted by
org-store-link.

The newest ox-html.el
(http://orgmode.org/w/?p=org-mode.git;a=blob_plain;f=lisp/ox-html.el;hb=HEAD
) uses this

  (list (org-element-property :CUSTOM_ID headline)
(org-export-get-reference headline info)
(org-element-property :ID headline

You see the second line is changed. It uses org-export-get-reference from
ox.el, 
which uses org-export-new-reference, which "Generates random 7 digits
hexadecimal numbers". 
I don't know if that is stored (which would make it stable), but it's
certainly not meaningful to any reader of the HTML file.

So my request is: the HTML export should have an option 
  org-export-anchors-use-title
to generate section anchors from the section title.

--

There is some code https://github.com/snosov1/toc-org that embeds a TOC
inside the org file,
which is very useful in github (github preview itself doesn't show a TOC).
toc-org generates meaningful (Github-like) links when
toc-org-hrefify-default is "gh".

But as described in https://github.com/snosov1/toc-org/issues/29,
Github keeps the section number, and doesn't strip the TODO and
statistics-cookies.
So a section headline like "3.2.2 TODO Normalization Problems [3/4]"
will get this anchor #322-todo-normalization-problems-34.

So it's best to include further options about which parts of a headline to
use:

- org-export-anchors-use-section-numbers
  "If org-export-with-section-numbers is also enabled, prepend the section
number (without any dashes).
This makes your anchors ugly and less stable, but you need to set this for
Github preview compatibility"
- org-export-anchors-use-todo
  "Prepend TODO/DONE keywords, in lowercase, to section anchors.
This makes your anchors ugly and less stable, but you need to set this for
Github preview compatibility"
-  org-export-anchors-use-title
  "Make section anchors from the words in the section title, converting to
lowercase and replacing punctuation with dash. 
This makes your anchors stable (title changes less frequently than
numbering) and readable. Set this for Github preview compatibility"
- org-export-anchors-use-statistics-cookies
  "Append statistic cookies (e.g. [33%] or [1/3]) to section anchor,
replacing punctuation with dash.
This makes your anchors ugly and less stable, but you need to set this for
Github preview compatibility"





[O] ox-latex doesn't handle doi: links right

2016-03-18 Thread Vladimir Alexiev
A link like doi:10.1109/ICMEW.2015.7169818 is resolved in org to 
http://dx.doi.org/10.1109/ICMEW.2015.7169818.
(I mean that if I click to the link, I go to that URL)

However, ox-latex makes merely this:
   \url{10.1109/ICMEW.2015.7169818} 
which Acrobat tries to resolve as a local file.
Instead, ox-latex should make this:
   \href{http://dx.doi.org/10.1109/ICMEW.2015.7169818}
{doi:10.1109/ICMEW.2015.7169818}





[O] org-html-use-unicode-chars breaks source code blocks

2015-08-04 Thread Vladimir Alexiev
Hi! 
I've set org-html-use-unicode-chars since I want ox-html to leave IRIs as IRIs.
But this has another undesired effect: it breaks URL references in code,
since it doesn't escape the brackets.

Eg this:

#+BEGIN_SRC Turtle
@prefix aat:   http://vocab.getty.edu/aat/.
#+END_SRC

results in the URL being invisible in the exported HTML.
The fault is here:

(defun org-html-final-function (contents backend info)
  ...
(when org-html-use-unicode-chars
  (require 'mm-url)
  (mm-url-decode-entities))

previous code carefully escaped the entities in org-html-protect-char-alist, 
only for mm-url-decode-entities to unescape them.

http://article.gmane.org/gmane.emacs.orgmode/94742 is somewhat related.




[O] HTML export should leave IRIs as is

2015-02-08 Thread Vladimir Alexiev
I have this in a file:

- 
[[https://chrome.google.com/webstore/detail/copy-url/mkhnbhdofgaendegcgbmndipmijhbili][CopyURL]]
 Chrome Plugin
  - Many URLs in dbpedia are International Resource Identifiers (IRIs)
  - When you copy from the browser's address bar, an IRI is URL-encoded
  - Unreadable ugliness like 
http://bg.dbpedia.org/resource/%D0%9A%D0%BE%D0%BD%D1%81%D1%82%D0%B0%D0%BD%D1%82%D0%B8%D0%BD%D0%B0_%D0%96%D0%B8%D0%B2%D0%BE%D0%B2%D0%B0
  - Instead, this plugin allows you to copy  paste IRIs like 
http://bg.dbpedia.org/resource/Константина_Живова

With default settings, the HTML export made both URLs the same unreadable 
ugliness.

I see no good reason for ox-html to escape IRIs, I think it should emit them as 
IRIs.
- I expected (setq org-html-use-unicode-chars t) to fix this, but for some 
reason (mm-url-decode-entities) doesn't do it
- This fixed the problem: (org-url-hexify-p nil), but I'm afraid it may break 
something else.

Furthermore, this fix converted BOTH URLs to an IRI. So to illustrate the 
point, I had to change my org file to:

  - Unreadable ugliness like
: 
http://bg.dbpedia.org/resource/%D0%9A%D0%BE%D0%BD%D1%81%D1%82%D0%B0%D0%BD%D1%82%D0%B8%D0%BD%D0%B0_%D0%96%D0%B8%D0%B2%D0%BE%D0%B2%D0%B0






[O] truncate-lines for org tables, visual-line-mode for rest?

2015-01-26 Thread Vladimir Alexiev
I use visual-line-mode to wrap long lines on display.
But for org tables, wrapping makes the display very confused.
Is it possible to have truncate-lines ONLY for lines that represent tables?





[O] Bad handling of IRI links

2015-01-19 Thread Vladimir Alexiev
I have a IRI link (written without any brackets) including Cyrillic like this:

https://bg.wikipedia.org/wiki/Уикипедия:Сътрудничество/Държавна_агенция_„Архиви“#Mapped_to_DBpedia
 

When I click it, it goes to this:

https://bg.wikipedia.org/wiki/Уикипедия:Сътрудничество/Държавна_агенциь:/my/Onto/KBs/dbpedia/
 

which of course doesn't reach the correct page. In contrast, if I paste it into 
the browser, it works fine.

org-version 8.2.7c


[O] (org-protocol-check-filename-for-protocol) should not (server-edit)

2014-12-11 Thread Vladimir Alexiev
I want org-protocol-store-link to paste the link in my current buffer and 
location, no questions asked.
I've defined a function like this:

(defun va/org-protocol-store-link (info)
  Process an org-protocol://store-link:// style url.
Store a browser URL as an org link, automatically in the current buffer.
Also saves marked text. The browser bookmark has to look like this:
  javascript:location.href='org-protocol://store-link://'+ 
encodeURIComponent(location.href)+'/' \\ 
encodeURIComponent(document.title)+'/'+encodeURIComponent(window.getSelection())
  (let* ((parts (org-protocol-split-data info t org-protocol-data-separator))
 (url (org-protocol-sanitize-uri (car parts)))
 (title (cadr parts))
 (region (caddr parts)))
;; (set-buffer (car (buffer-list))) ; when called, a server buffer is 
current
;; (setq org-stored-links (cons (list uri title) org-stored-links))
;; (org-insert-link)
(insert [[ url ])
(if title (insert [ title ]))
(insert ])
(if region (insert   region))
(raise-frame)
nil ; no buffer to edit
))

And attached it like that:

(setq org-protocol-protocol-alist
  '((org-store-link :protocol store-link
 :function va/org-protocol-store-link :kill-client t)))

Unfortunately it pastes the link in the most recent server buffer.
The reason is that (org-protocol-check-filename-for-protocol) does 
(server-edit), 
which does Switch to next server editing buffer; say Done for current 
buffer.

If I set the :kill-client to nil, nothing happens (as far as I can see).

Why does (org-protocol-check-filename-for-protocol) call (server-edit)?

Cheers! Vladimir

PS: the gmane search is pretty bad. I googled with this:
+org-protocol +server-edit url:gmane.emacs.orgmode
and found a slightly related article:
http://blog.gmane.org/gmane.emacs.orgmode/month=20100901





Re: [O] bug#17749: 24.3.91; Crash on mwheel-scroll of org file

2014-08-05 Thread Vladimir Alexiev
  1. Open emacs-crash-test.org
  2. Make the window smaller (e.g. 20 lines tall)
  2. Roll the mouse wheel down until you see the end of file, then up.
  3. CRASH

The specific org file doesn't matter.
The window size doesn't matter.
This crash happens to me occasionally (2-3 times a week), always on an org 
file, always on mwheel-up (which invokes mwheel-scroll).

Eli, can you tell something from the backtrace here?
http://lists.gnu.org/archive/html/emacs-orgmode/2014-06/txtkIBvnmHi_F.txt

The critical lines are:

die at C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/alloc.c:6826
pop_it at C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/xdisp.c:6060
set_iterator_to_next at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/xdisp.c:7523
move_it_in_display_line_to at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/xdisp.c:8838

  ../../emacs-24.3.91/src/xdisp.c:6066: Emacs fatal error: assertion failed: 
  (BUFFERP (it-object)  IT_CHARPOS (*it) == it-
 bidi_it.charpos  IT_BYTEPOS (*it) == it-bidi_it.bytepos) || (STRINGP 
 (it-object)  IT_STRING_CHARPOS (*it) == it-
 bidi_it.charpos  IT_STRING_BYTEPOS (*it) == it-bidi_it.bytepos) || (CONSP 
 (it-object)  it-method ==
 GET_FROM_STRETCH)

The code can be seen here:
https://github.com/mirrors/emacs/blob/master/src/xdisp.c#L6127 

 This is an assertion violation, not a crash.

The failing assertion causes a crash, so I'm not sure what's the difference. 
Is there an emacs build that doesn't crash on eassert() failure?

 Some assumption in the
 code turned out to be false, but it is not possible to know which one,
 and whether it's just a wrong assumption or a real problem.

It seems the assertion does basic consistency checks of the IT structure.

What is it-bidi_p? I don't use BIDI text: this happens on ascii org files.


I guess I'll upgrade Emacs and Org and hope for the best...




Re: [O] How to define file-local preamble for graphviz dot?

2014-08-05 Thread Vladimir Alexiev
Vladimir Alexiev vladimir.alexiev at ontotext.com writes:

 I have a bunch of dot settings that I want to set globally. I hacked it like 
 this:
 (defadvice org-babel-expand-body:dot (before add-preamble (body params) 
 activate)

A better way to hack it is like that, using the header args :prologue and 
:epilogue

(eval-after-load ob-dot
  ' (progn
  (add-to-list 'org-babel-default-header-args:dot
   '(:cache . yes))
  (add-to-list 'org-babel-default-header-args:dot
   '(:prologue . digraph g {
  rankdir=LR nodesep=0.2 ranksep=0.1 arrowsize=0.2
  node [fontname=courier fontsize=10 margin=\0.02,0.01\ shape=box width=0.1 
height=0.1]
  edge [fontname=courier fontsize=8 labelfontname=courier labelfontsize=8]))
  (add-to-list 'org-babel-default-header-args:dot
   '(:epilogue . }

Unfortunately ob-dot doesn't interpret :prologue and :epilogue, so I adviced it:

(defadvice org-babel-expand-body:dot (before prologue-epilogue activate)
  Interpret :prologue and :epilogue headers, like 
org-babel-expand-body:generic
  (let ((pro (cdr-safe (assoc :prologue params)))
(epi (cdr-safe (assoc :epilogue params
(setq body (mapconcat #'identity
  (append (when pro (list pro))
  (list body)
  (when epi (list epi)))
  \n

Then in a particular file I can override the :prologue like so:

* Local Variables :noexport:
Local Variables:
eval: (setq-local org-babel-default-header-args:dot (cons '(:prologue . 
digraph g {
  rankdir=LR nodesep=0.2 ranksep=0.3 arrowsize=0.1
  node [fontname=courier fontsize=8 margin=\0.02,0.01\ shape=circle 
width=0.25 height=0.25 label=\\]
  edge [fontname=courier fontsize=8 labelfontname=courier labelfontsize=8])
  (cl-remove :prologue org-babel-default-header-args:dot :key 'car :test 'eq)))
End:

This works, although it asks for confirmation every time the file is loaded.
Trying to do it with a code block:

#+BEGIN_SRC emacs-lisp :results silent :exports none
#+END_SRC

didn't work because that code is not executed automatically on export.





[O] How to define file-local preamble for graphviz dot?

2014-08-01 Thread Vladimir Alexiev
I have a bunch of dot settings that I want to set globally. I hacked it like 
this:

(setq va/org-dot-preamble digraph g {
  rankdir=LR nodesep=0.2 ranksep=0.1 arrowsize=0.2
  node [fontname=courier fontsize=10 margin=\0.02,0.01\ shape=box width=0.1 
height=0.1]
  edge [fontname=courier fontsize=8 labelfontname=courier labelfontsize=8])

(defadvice org-babel-expand-body:dot (before add-preamble (body params) 
activate)
  add DOT=va/org-dot-preamble as :var in params, so $dot is replaced with it
  (setq params (cons (cons ':var (cons 'DOT va/org-dot-preamble))
 params)))

And then I start dot code blocks with $dot, which is replaced with the above 
string:

#+begin_src dot :results silent file :file ./img/SymmetricProperty.png
$dot 
x - y [label=q]
y - x [label=q color=red]
}
#+end_src

I can override a dot param by adding a different value after the common 
inclusion $dot, e.g.:
$dot ranksep=0.7

The problem is
*** how can I make this per-file? 
Neither #+BIND nor emacs Local Variables: does the trick.
Bonus if I can do it per-heading :-)

dot can take these settings from the command line, eg
-G rankdir=LR nodesep=0.2 ranksep=0.1 arrowsize=0.2
-N fontname=courier fontsize=10 margin=\0.02,0.01\ shape=box width=0.1 
height=0.1
-E fontname=courier fontsize=8 labelfontname=courier labelfontsize=8

So I could try to mess with the :cmdline slot of 
org-babel-default-header-args:dot ... is this evaluated locally?





Re: [O] org-plus-contrib should provide org

2014-08-01 Thread Vladimir Alexiev
  The org-plus-contrib package on http://orgmode.org/elpa/ should provide 
  org-8.0
 Why do you think it does not?

To be frank, I'm not sure how packages declare what they provide. 
org-plus-contrib has this
(define-package org-plus-contrib 20140526 Outline-based notes management 
and organizer 'nil)

While org has that:
(define-package org 20140526 Outline-based notes management and organizer 
'nil)

All I know is that when I install something like org-reveal:

(define-package ox-reveal 20140409.929 reveal.js Presentation Back-End for 
Org Export Engine 
   '((org 8.0)) :keywords (outlines hypermedia slideshow 
presentation))

(the second line starts with the REQUIREMENTS param of define-package)

it goes and installs org, even though I have org-plus-contribs.





[O] allow multiline #+BIND

2014-07-30 Thread Vladimir Alexiev
It would be nice to allow multiline BINDs. I'd much rather write this than put 
it all on one line:

#+BIND: va/org-dot-preamble digraph g {
#+BIND:   rankdir=LR nodesep=0.2 ranksep=0.1 arrowsize=0.2
#+BIND:   node [fontname=courier fontsize=8 margin='0.02,0.01' shape=circle 
width=0.1 height=0.1 label='']
#+BIND:   edge [fontname=courier fontsize=8 labelfontname=courier 
labelfontsize=8]

The usual continuation syntax of backslash before the EOL can be used.
Or else, a new keyword #+BIND1: for each continuation line.

The function to fix is ox.el::org-export--list-bound-variables




Re: [O] org-plus-contrib should provide org

2014-06-17 Thread Vladimir Alexiev
  The org-plus-contrib package on http://orgmode.org/elpa/ should provide 
  org-8.0
 Why do you think it does not?

For example, ox-reveal says Requires: org-8.0. When I select to install it, 
the package manager also installs org, although org-plus-contrib is installed.
I looked for provides info in the packages and I couldn't find any... maybe 
simply the package name indicates what is provided?




[O] 24.3.91; Crash on mwheel-scroll of org file

2014-06-10 Thread Vladimir Alexiev
Hi! 

I think I found a new crash, at least I can't find it with google.

Scenario:
1. Open emacs-crash-test.org
2. Make the window smaller (e.g. 20 lines tall)
2. Roll the mouse wheel down until you see the end of file, then up. 
3. CRASH

I cannot reproduce it with emacs -Q yet.
I cannot always reproduce it with emacs-crash-test.org. I made this by 
replacing all letter with a in an original file that I can't share.
Please let me know whether this is a new crash and you are willing to debug it.
Then I can dig deeper to find which exact situation, or my code, or ELPA 
package causes this.

I saved emacs_backtrace.txt, then did
$ cat emacs_backtrace.txt | addr2line -C -f -i -p -e c:/emacs/bin/emacs  
emacs_addr.txt
Both files are attached.
I also attach the info from report-emacs-bug.

Do I still need to do gdb bt full or xbacktrace, or are the attachments 
enough?
Sorry, I can't recompile or debug emacs.

$ emacs 
[1] 5344

../../emacs-24.3.91/src/xdisp.c:6066: Emacs fatal error: assertion failed: 
(BUFFERP (it-object
)  IT_CHARPOS (*it) == it-bidi_it.charpos  IT_BYTEPOS (*it) == 
it-bidi_it.bytepos) || (ST
RINGP (it-object)  IT_STRING_CHARPOS (*it) == it-bidi_it.charpos  
IT_STRING_BYTEPOS (*it)
 == it-bidi_it.bytepos) || (CONSP (it-object)  it-method == 
GET_FROM_STRETCH)

$ gdb -5 5344
Attaching to process 5344
[New Thread 5344.0x1148]
[New Thread 5344.0x214c]
[New Thread 5344.0x1574]
Reading symbols from /cygdrive/c/emacs/bin/emacs...done.

warning: `/cygdrive/c/Windows/SYSTEM32/ntdll.dll': Shared library architecture 
i386:x86-64 is n
ot compatible with target architecture i386.
(and several more warnings about Windows system libraries)

(gdb) continue
Continuing.
[Thread 5344.0x1574 exited with code 0]
[Inferior 1 (process 5344) exited with code 01400]
(gdb)
The program is not being run.


emacs-crash-test.org
Description: Binary data
w32_backtrace at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/w32fns.c:8436
emacs_abort at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/w32fns.c:8468
terminate_due_to_signal at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/emacs.c:378
die at C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/alloc.c:6826
pop_it at C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/xdisp.c:6060
set_iterator_to_next at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/xdisp.c:7523
move_it_in_display_line_to at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/xdisp.c:8838
move_it_to at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/xdisp.c:9076
window_scroll_pixel_based at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/window.c:5160
window_scroll at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/window.c:4839
scroll_command at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/window.c:5396
Fscroll_down at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/window.c:5424
Ffuncall at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/eval.c:2815
eval_sub at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/eval.c:2157
internal_lisp_condition_case at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/eval.c:1323
exec_byte_code at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/bytecode.c:1162
funcall_lambda at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/eval.c:3049
Ffuncall at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/eval.c:2864
Fapply at C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/eval.c:2301
apply1 at C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/eval.c:2588
Fcall_interactively at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/callint.c:378
Ffuncall at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/eval.c:2822
exec_byte_code at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/bytecode.c:916
funcall_lambda at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/eval.c:2983
Ffuncall at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/eval.c:2864
call1 at C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/eval.c:2614
command_loop_1 at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/keyboard.c:1559
internal_condition_case at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/eval.c:1354
command_loop_2 at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/keyboard.c:1177
internal_catch at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/eval.c:1118
command_loop at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/keyboard.c:1156
recursive_edit_1 at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/keyboard.c:777
Frecursive_edit at 
C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/keyboard.c:848
main at C:\msys\home\Dani\emacs\build\src/../../emacs-24.3.91/src/emacs.c:1646
_mingw_CRTStartup at C:\MinGW\msys\1.0\src\mingwrt/../mingw/crt1.c:244
mainCRTStartup 

[O] org-plus-contrib should provide org

2014-06-04 Thread Vladimir Alexiev
The org-plus-contrib package on http://orgmode.org/elpa/ should provide org-
8.0, since it does include org.
Otherwise a bunch of addon packages (eg ox-reveal) install the org package 
anyway.

Cheers!




[O] RE: [Orgmode] [HOW] no way to escape vertical bar (pipe char) in tables?

2011-03-07 Thread Vladimir Alexiev
  what is the best way to manage
  leading/trailing spaces in a table cell?
 This i don't understand -- you want to *keep* the spaces
 in the exported table?

Not all spaces, but some spaces some of the time is needed.

The recent patch to org-babel-read by Erik Schulte makes this possible. See 
second sentence below:

If a value starts with one of ('` it is read as an emacs lisp sexp.
If it starts with  then it's read as a quoted string: start/end quotes are 
stripped, \ and \\ are unescaped
   (this is useful for embedding leading/trailing whitespace in strings).
If it looks like a number, it's read as a number.
Else it's read as a literal string, without any quotation or escaping.
(Please note that | in tables is always interpreted as column separator and 
currently there is no way to quote it)





[O] RE: [Orgmode] Re: org-babel-read should have option NOT to interpret as elisp

2011-03-01 Thread Vladimir Alexiev
 I've applied the patch
 attached to my previous email and unless there is a real push-back ...

Could you add handling of quoted strings?
And most importantly, document all of this in (org)var.
Here is a merged dscription:

If a value starts with one of ('` it is read as an emacs lisp sexp.
If it starts with  then it's read as a quoted string: start/end quotes are 
stripped, \ and \\ are unescaped
   (this is useful for embedding leading/trailing whitespace in strings).
If it looks like a number, it's read as a number.
Else it's read as a literal string, without any quotation or escaping.
(Please note that | in tables is always interpreted as column separator and 
currently there is no way to quote it)


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


RE: [O] RE: [Orgmode] Re: org-babel-read should have option NOT to interpret as elisp

2011-03-01 Thread Vladimir Alexiev
 I believe quoted strings are already handled, e.g.,
 #+results:
 : (a b c)

They are not. This leaves the quotes as part of the string.

Please add a second usage to the description:

(this is useful for having leading/trailing whitespace in a string,
or having a leading ('` yet preventing the emacs lisp treatment)


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [BUG] org-babel-tangle causes Wrong type argument: sequencep, hline

2011-02-27 Thread Vladimir Alexiev
When I try to tangle the simple file shown below, I get this error:
  Wrong type argument: sequencep, hline.
Org-mode version 7.4 (release_7.4.44.g49d9c.dirty)

I have the default values of these args (checked through gebugging)
According to the help:
* :hlines: `no' (default)
  Strips horizontal lines from the input table.
* :colnames `nil' (default) 
  If an input table looks like it has column names (because
  its second row is an hline), then the column names will be removed
  from the table before processing

This is urgent for me, so any help is appreciated!

 input file:

#+STARTUP:  showeverything
#+BABEL::tangle yes

* Normalize
#+tblname: normalize
| search| replace  |
|---+--|
| no salt added | without salt |

#+begin_src perl :var norm_search=normalize[*,0] :var norm_repl=normalize[*,1]
$norm_search;
$norm_repl;
#+end_src 

 backtrace cut at 74 columns (email me for the full backtrace):

Debugger entered--Lisp error: (wrong-type-argument sequencep hline)   
  org-babel-ref-index-list(0 hline) 
  #[(sub-lis) \302   \\207 [remainder sub-lis org-babel-ref-index-lis
  mapcar(#[(sub-lis) \302\\207 [remainder sub-lis org-babel-ref-i
  org-babel-ref-index-list(*,0 ((search replace) hline (no salt add
  org-babel-ref-resolve(normalize[*,0]) 
  org-babel-ref-parse(norm_search=normalize[*,0])   
  (if (consp (cdr el)) (cdr el) (org-babel-ref-parse (cdr el)))   
  (lambda (el) (if (consp (cdr el)) (cdr el) (org-babel-ref-parse (cdr el)
  mapcar((lambda (el) (if (consp (cdr el)) (cdr el) (org-babel-ref-parse (
  (org-babel-disassemble-tables (mapcar (lambda (el) (if (consp (cdr el)) 
  (let* ((vars-and-names (org-babel-disassemble-tables (mapcar (lambda (el
  org-babel-process-params(((:comments . ) (:shebang . ) (:cache . no
  org-babel-get-src-block-info()  
  byte-code(\203

I tried debugging but quickly got lost. Still, some observations:
- org-babel-disassemble-tables: didn't seem to do much since 'vars' was nil
- org-babel-ref-index-list: I think it should receive the stripped table,
  i.e. these elements should have been removed:
  (search replace) hline


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] org-babel-read should have option NOT to interpret as elisp

2011-02-27 Thread Vladimir Alexiev
I keep perl regexps in a table, and some of them start with (.
I'd like these to be left alone (returned unmodified as a string).

(info (org)var) doesn't mention special processing of table cells,
but the doc of org-babel-read says:

Convert the string value of CELL to a number if appropriate.
Otherwise if cell looks like lisp (meaning it starts with a
( or a ') then read it as lisp, otherwise return it
unmodified as a string.

So it seems to me that this special behavior of org-babel-read 
should be documented in info, and controllable by a user option.





___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: [BUG] org-babel-tangle causes Wrong type argument: sequencep, hline

2011-02-27 Thread Vladimir Alexiev
 The hline was assumed to be a list (as normal rows are) by the indexing
 code, so I just inserted a quick check to ensure that hlines are left
 alone.

So Eric, you're handing this arg as per documentation (info)
* :hlines: `no' (default)
  Strips horizontal lines from the input table.

But you've missed handling this arg:
* :colnames `nil' (default) 
  If an input table looks like it has column names (because
  its second row is an hline), then the column names will be removed
  from the table before processing

I think that org-babel-ref-index-list should receive the stripped table,
i.e. these elements should have been removed:
  (search replace) hline

I think the fix is somewhere in org-babel-disassemble-tables, 
not in functions it calls (downstream from it). 
But in my debugging it always returned (nil nil nil)?


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: org-babel-read should have option NOT to interpret as elisp

2011-02-27 Thread Vladimir Alexiev
 would be onerous to have to wrap every cell
 of a table in double quotes...

I tried doing this as a workaround, but it is not 
since the quotes are passed to perl, and that's not what I want

 it would be a breaking change for
 anyone who is currently relying on the ability

Right, that's why I think it should be an option.
The default could stay as is, but should be documented.


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: org-babel-read should have option NOT to interpret as elisp

2011-02-27 Thread Vladimir Alexiev
 What syntax would you suggest to indicate that a variable is to be
 passed without the possibility of elisp evaluation

I think this should be done with a header arg, 
since they have very flexible setup scheme:
  see (info (org)Using header arguments)
  values of header arguments can be set in six different ways

- Ideally, the arg should be attached to
  #+tblname: since it's a characteristic of the table itself
- If attached to
  #+begin_src: then it will be dissociated from the table,
  and all :var's of that line will be forced to use the same arg.
- But that's good enough since it can be set in various ways. For me most 
useful:
-- org-babel-default-header-args: global
-- #+BABEL: per file

The header arg should be called :read-as (or :var-read). Considerations:
- should be quite distinct so it can be used as a property name
- should use dash so it's analogous to no-expand

Its values should be:
- literal: 
  If a value looks like a number, it's read as a number.
  Else it's read as a literal string.
- elisp or nil (default):
  If a value starts with one of ('` it's read as emacs lisp.
  Else it's read as 'literal'.
- quoted: 
  If a value starts with  then it's read as a quoted string:
  start and end quotes are stripped, and \ escaped quotes are unescaped
  (this is useful for embedding leading/trailing whitespace in strings).
  Else it's read as `literal'.
- quoted_elisp: combination of `quoted' and `elisp'
(I assume that using multiple values per arg is not supported)

This above is about data coming from tables, 
since I haven't used the other two options (literal value and code block).
The chosen solution should work for those too.

Please note that org-babel-read says
  This is taken almost directly from `org-read-prop'.
so the chosen solution should be compatible with that.
But I can't find such function.





___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: [BUG] org-babel-tangle causes

2011-02-27 Thread Vladimir Alexiev
I found a simple WORKAROUND. 
Kindly put this in the documentation of :colnames,
at the end of the nil value:

Please note that such table disassembly does not work with var indexing.
As a simple workaround, put the #+tblname AFTER the hline (not before the 
table).
For example:

  #+STARTUP:  showeverything
  #+BABEL::tangle yes

  | colA | colB |
  |--+--|
  #+tblname: table
  | a1   | b1   |
  | a2   | b2   |

  #+begin_src perl :var a=table[*,0] :var b=table[*,1]
  $a; $b;
  #+end_src 

If you tangle this source with C-c C-x t, you can see 
that the assignments are correct.


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: a question about fontification and org-emphasis-alist

2011-02-27 Thread Vladimir Alexiev
 C-h v org--emphasisTAB

But how do you know how many dashes to put?

I'd use apropos-variable (show variables matching pattern: WORDS or regexp).
I bind that to C-h C-v and use it often.

All apropos* functions are very useful, learn them


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [HOW] no way to escape vertical bar (pipe char) in tables?

2011-02-24 Thread Vladimir Alexiev
I want to manage some perl regexps in a table
then feed them to a code block (literate programming).
Unfortunately they include alternatives (|) 
and the table editor thinks this is a column break.

There's no way to escape this?

On a related thought: what is the best way to manage
leading/trailing spaces in a table cell?
I've been forced to use \x20 for this purpose...


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: [CRASH] org-pretty-entities causes emacs to take 100% CPU

2011-02-17 Thread Vladimir Alexiev
 not able to reproduce this
 with GNU Emacs 24.0.50.2 of 2011-02-15.

Can I get this from somewhere, built for W32/cygwin?
I got 24.0.50.1 from file Emacs24.BZR.102298.Win32.20101110.zip
from http://ourcomments.org/Emacs/DL/EmacsW32/EmacsCVS/unptch/ .
I looked there for a newer version, but there isn't one.


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: [CRASH] org-pretty-entities causes emacs to take 100% CPU

2011-02-15 Thread Vladimir Alexiev
I've isolated it by running clean emacs (emacs -q) with this setup:

(setq org-entities-user ; name latex math-p html ascii latin1 utf8
  '((ok nil nil font color='green'#x2714;/font OK OK ✔)
(nok nil nil font color='red'#x2718;/font NOK NOK ✘))
  org-pretty-entities t)

And this small org file:

#+STARTUP:   showall indent
* Deployment Options
- \ok Deploy on

Observations:
- The crash DOES NOT happen with noident
- Moving up from the mark, I get this in *Messages*
  line-move-visual: Args out of range: 3, 3 
  (the number varies according to where the line is)
- it doesn't matter whether visual-line-mode is on or off


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: Open HTML link in other window?

2011-02-15 Thread Vladimir Alexiev
 I don't think this is really necessary.

IN web presentations (eg s5.org) each section is one slide (screen).
If you click on an external link, it replaces the presentation,
and when you go back to it, you lose the current slide.

Setting some global HTML_ATTR may also be useful for images,
eg if I want all my images on the right.


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Open HTML link in other window?

2011-02-03 Thread Vladimir Alexiev
Is there a way to configure the HTML export to open every 
*external* link to another window?
Eg this is very useful for web presentations (search for s5 org).


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [BUG] org-html.el: internal links don't work unless CUSTOM_ID is used

2011-01-30 Thread Vladimir Alexiev
Internal links do not work in HTML export unless CUSTOM_ID is used.

I have tried with [[id:]] and [[*Heading]] links.
It makes the link like this:
  a href=#sec-49
It makes the anchor like this:
  h2 id=sec-49.../h2
and if the entry has ID (id: link is used) then also
  a name=ID-80ea259f-73f0-4456-b2f5-3343d44e6336
  id=ID-80ea259f-73f0-4456-b2f5-3343d44e6336/a
Unfortunately h2.id doesn't create an anchor, 
and even for id: links it uses href=#sec-49, which doesn't work.

I wondered how links in WORK work, so I checked, e.g.
  http://orgmode.org/worg/org-contrib/babel/intro.html
The link is denoted like this
  [[#source-code-execution][here]]
and the target like this:
  * Source Code Execution
:PROPERTIES:
:CUSTOM_ID: source-code-execution
:END:

Indeed the Org manual advises:
  The most important case is a link like
  `[[#my-custom-id]]' which will link to the entry with the `CUSTOM_ID'
  property `my-custom-id'.  Such custom IDs are very good for HTML export
  (*note HTML export::) where they produce pretty section links.
But it would be very tedious to add CUSTOM_ID to every target,
and the manual also hints to it:
  You are responsible yourself to make sure these custom IDs are unique

Having to go out and make a target interrupts one's flow.
It's much faster to type [[*He and use completion to create the link.

That's why I've marked this BUG and not Enhancement.



___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: [BUG] .dir-locals.el broken links on cygwin

2011-01-11 Thread Vladimir Alexiev
 Some of the .dir-locals.el files in the distribution are 
 symbolic links to another. On cygwin they come out as LNK files.

The error I get is 
Directory-local variables error: (wrong-type-argument listp !symlink  \.)



___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: [PATCH] org-display-inline-images to reduce image size

2011-01-10 Thread Vladimir Alexiev
How to avoid line breakage in the patch? 
Some source lines are naturally 80 chars and I wouldn't like to shorten them.
I posted from the web (http://post.gmane.org/post.php?group=gmane.emacs.orgmode)
I guess I should get an account and post from a real mail client?

Furthermore, the Comments at the patchwork server 
(http://patchwork.newartisans.com/patch/526/)
mess up the patch, though the patch itself is ok
(http://patchwork.newartisans.com/patch/526/raw/)


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [BUG] .dir-locals.el broken links on cygwin

2011-01-10 Thread Vladimir Alexiev
Some of the .dir-locals.el files in the distribution are 
symbolic links to another.
On cygwin they come out as LNK files.
Emacs tries to load such LNK file and fails.
I had to remove these files to be able to edit orgmode elisp files.

Perhaps there is a way to make emacs on cygwin interpret LNK as links,
then it should be mentioned in the installation instructions.

Otherwise (and I think better), the build process could copy .dir-locals.el
from the master dir to the slave dirs


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: inline images

2011-01-07 Thread Vladimir Alexiev
eimp.el uses an external program (mogrify) to actually modify the image. 
That's not what is wanted. The image should remain the same, 
just be displayed in emacs in a smaller size


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [ENH] ditaa version

2011-01-07 Thread Vladimir Alexiev
I think org-mode\contrib\scripts\ditaa.jar
should be upgraded to the newest version from
http://sourceforge.net/projects/ditaa/
which is 0.9 of 2009-11-24.
I've been running with it for a month, no problems.


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [PATCH] org-display-inline-images to reduce image size

2011-01-07 Thread Vladimir Alexiev
Here's a patch that introduces two custom options
org-display-inline-image-width, org-display-inline-image-height
and patches org-display-inline-images to respect them as
max width, height settings for inline images.

(Someone please defcustom them for me, I only know defvar syntax).

org-display-inline-images uses overlay-put.
(iimage.el uses text-properties, which are recommended in emacs).
(The refs below are (elisp) info nodes.)
Both overlays and text-properties use Display Property, 
Other Display Specifications to setup an image. 
Of all Image formats, only ImageMagick Images (maybe XBM and PS) 
support scaling. 
That is, IF you build Emacs with ImageMagick (a big if indeed!)

So the patch uses scaling if (fboundp 'imagemagick-types)
  and in this case you must call (imagemagick-register-types) in your .emacs;
else it uses a slice the top left corner (cropping the rest).

diff --git a/doc/org.texi b/doc/org.texi
index 96ea986..9e1c5cf 100755
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -3266,13 +3266,31 @@ variable @code{org-display-internal-link-with-indirect-
buffer}}.
 @vindex org-startup-with-inline-images
 @cindex @code{inlineimages}, STARTUP keyword
 @cindex @code{noinlineimages}, STARTUP keyword
-Toggle the inline display of linked images.  Normally this will only inline
+Toggle the inline display of linked images. 
+Works only for links that start with @code{file:},
+. (current dir), / (root dir) or ~ (home dir). 
+Normally this will only inline
 images that have no description part in the link, i.e. images that will also
 be inlined during export.  When called with a prefix argument, also display
 images that do have a link description.  You can ask for inline images to be
 displayed at startup by configuring the variable
 @code{org-startup-with-inline-imag...@footnote{with corresponding
 @code{#+STARTUP} keywords @code{inlineimages} and @code{inlineimages}}.
+
+...@vindex org-display-inline-image-width
+...@vindex org-display-inline-image-height
+Maximum image size that Orgmode will display inline. Images are reduced by 
EITHER:
+...@itemize @bullet
+...@itemize Scaling down: supported when Emacs is compiled with ImageMagic, in 
which case
+  the function @code{imagemagick-types} is bound. You should invoke
+  @code{(imagemagick-register-types)} in your @code{.emacs}, OR
+...@itemize Slicing the top left corner and cropping the rest
+...@end itemize
+Integer specifies maximum number of pixels.
+Floating number specifies maximum ratio to the frame width/height respectively.
+nil places no restriction on the respective dimension. 
+If both are set, scaling can distort the aspect ratio
+
 @orgcmd{C-c %,org-mark-ring-push}
 @cindex mark ring
 Push the current position onto the mark ring, to be able to return
Modified lisp/org.el
diff --git a/lisp/org.el b/lisp/org.el
index 53039e4..836286c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16156,6 +16156,55 @@ INCLUDE-LINKED is passed to `org-display-inline-
images'.
 (length org-inline-image-overlays))
   (message No images to display inline
 
+;; TODO: defcustom
+(defvar org-display-inline-image-width nil
+*Maximum image width that Orgmode will display inline.
+Images are reduced by:
+- Scaling down: supported when Emacs is compiled with ImageMagic, in which case
+  (fboundp 'imagemagick-types). You should invoke (imagemagick-register-types) 
in .emacs. 
+- Otherwise: slicing the top left corner and cropping the rest
+Integer specifies maximum number of pixels.
+Floating point specifies maximum ratio to the frame width.
+nil places no restriction.
+If both org-display-inline-image-width and org-display-inline-image-height are 
set, 
+scaling can distort the aspect ratio)
+
+;; TODO: defcustom
+(defvar org-display-inline-image-height nil
+*Maximum image height that Orgmode will display inline.
+Works similarly to org-display-inline-image-width, which see.)
+
+;; TODO tested only in GNU Emacs 24.0.50.1
+;; TODO scaling not tested (don't have ImageMagick)!
+(defun org-display-inline-images-scale-or-slice (img)
+  ;; Return eventually scaled or sliced down version of image IMG.
+  ;; Scaling is an image property (after 'image)
+  ;; Slicing is a display property (for overlay or text-property) (before 
'image).
+  (when (or org-display-inline-image-width org-display-inline-image-height)
+(let (c w h width height width height)
+  (setq c (image-size img 'pixels))
+  (setq w (car c) h (cdr c))
+  (setq width (cond
+   ((integerp org-display-inline-image-width)
+org-display-inline-image-width)
+   ((floatp org-display-inline-image-width)
+(truncate (* org-display-inline-image-width (frame-pixel-
width))
+  (setq height (cond
+((integerp org-display-inline-image-height)
+ org-display-inline-image-height)
+((floatp org-display-inline-image-height) 
+ 

[Orgmode] Re: Huge performance problems to open some Org files

2010-12-20 Thread Vladimir Alexiev
Sébastien Vauban wxhgmqzgw...@... writes:

 Believe me or not, but C-g has not effect during those 7 seconds. It simply
 does not stop anything

Sounds like emacs is waiting inside some blocking call, and waits until it 
times 
out. Likely a network call. Do you have any tramp/efs/angeftp stuff going on?


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] [PATCH] org-babel-confirm-evaluate when org-confirm-babel-evaluate is a function

2010-12-20 Thread Vladimir Alexiev
I tried following http://orgmode.org/worg/org-contribute.php to the letter.
But this is my first patch (and first time using git  magit), so please kindly 
give me feedback if something is not right.

* doc/org.texi: org-confirm-babel-evaluate: add example for using a
  function
* lisp/ob.el (org-babel-confirm-evaluate): Fix for the case when
  org-confirm-babel-evaluate is a function (used to always ask no matter
  what the function returns) 

--- a/doc/org.texi
+++ b/doc/org.texi
@@ -12662,9 +12662,19 @@ Make sure you know what you are doing before 
customizing the variables
 which take off the default security brakes.
 
 @defopt org-confirm-babel-evaluate
-When set to t user is queried before code block evaluation
+When t (the default), the user is asked before every code block evaluation.
+When nil, the user is not asked.
+When set to a function, it is called with two arguments (language and body of 
the code
+block) and should return t to ask and nil not to ask.
 @end defopt
 
+For example, here is how to execute ditaa code (which is considered safe) 
without asking:
+...@example
+(defun my-org-confirm-babel-evaluate (lang body)
+  (not (string= lang ditaa)))  ; don't ask for ditaa
+(setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate)
+...@end example
+

--- a/lisp/ob.el
+++ b/lisp/ob.el
@@ -209,11 +209,11 @@ Note disabling confirmation may result in accidental 
evaluation
 of potentially harmful code.
   (let* ((eval (or (cdr (assoc :eval (nth 2 info)))
   (when (assoc :noeval (nth 2 info)) no)))
-(query (or (equal eval query)
-   (if (functionp org-confirm-babel-evaluate)
-   (funcall org-confirm-babel-evaluate
-(nth 0 info) (nth 1 info))
- org-confirm-babel-evaluate
+ (query (cond ((equal eval query))
+  ((functionp org-confirm-babel-evaluate)
+   (funcall org-confirm-babel-evaluate
+(nth 0 info) (nth 1 info)))
+  ((org-confirm-babel-evaluate)
 (if (or (equal eval never) (equal eval no)
(and query
 (not (yes-or-no-p

TINYCHANGE



___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] orgmode wiki sync

2010-11-28 Thread Vladimir Alexiev
I have a dream. A dream where all people, emacs orgmode devotees or not, 
can work together on a wiki. :-)

I mean this: in an office environment, the majority of people would not be
emacs users. So despite the excellent collaboration workflow based on sharing
org files through git, the average office worker (such as myself) is stranded
if they have to work on a wiki. I think what's needed is a way to sync changes
between wiki and org, a kind of extension of wiki publishing.

The task is complex and involves:
- converters for various wikis (back and forth). May use a common central 
format 
  such as Creole as a hub
- a strategy to deal with unrecognized markup for both directions. 
  Such should be left alone, not clobbered
- a strategy to deal with mapping between org files/trees and wiki pages (often 
  people map level1 or level2 org trees to a wiki page)
- sync/diff functionality to merge changes and resolve conflicts
-- in the simplest scenario, org could refresh a page from the wiki, obtain a
   page lock (most wikis support page locks), change only one page, commit it
- read  write conduits for various wikis

Is anyone interested in collaborating on this?
What wikis are important for you?


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: From state table to state diagram

2010-11-23 Thread Vladimir Alexiev
You first need to decide on a syntax: 
how many cols in the table and what do they 
mean.

A Confluence plugin does that. You may want to check it out for inspiration and 
nice examples:
https://studio.plugins.atlassian.com/wiki/display/GVIZ/Confluence+Graphviz+Plugin
https://studio.plugins.atlassian.com/wiki/display/GVIZ/Graph-from-table+Macro

Dot is a really simple language, so translating to it should be easy. Eg
  | state1 | state2 | transition |
becomes
  state1 - state2 [label=transition]


___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode