dynamic blocks orgmode manpage

2024-02-14 Thread chris
Hi all,

#+title: dynamic blocks orgmode manpage

* Example from the manual

Concerned page: [[https://orgmode.org/manual/Dynamic-Blocks.html][Dynamic 
Blocks (The Org Manual)]]

Below is an elisp snippet from the manual. You can execute it with =C-c C-c=.

#+begin_src emacs-lisp
  (defun org-dblock-write:block-update-time (params)
(let ((fmt (or (plist-get params :format) "%d. %m. %Y")))
  (insert "Last block update at: "
  (format-time-string fmt
#+end_src

#+RESULTS:
: org-dblock-write:block-update-time

Below is another snippet from the manual. You can update it with =M-x org-
dblock-update=.

#+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M"
Last block update at: on 02/14/2024 at 21:33
#+END:

Now, after running =C-c C-c= on the line below, trying =M-x org-dynamic-block-
insert-dblock= will result in the error: =funcall-interactively: Wrong type 
argument: commandp, org-dblock-write:block-update-time=.

#+begin_src emacs-lisp
  (org-dynamic-block-define "block update time" #'org-dblock-write:block-
update-time)
#+end_src

#+RESULTS:
: ((block update time . org-dblock-write:block-update-time) (abstracts-index . 
org-dblock-write:abstracts-index) (columnview . org-columns-insert-dblock) 
(clocktable . org-clock-report))


* Alternative construction

Given the circumstances described above, the following snippet works with both 
=M-x org-dblock-update= and =M-x org-dynamic-block-insert-dblock=.

#+begin_src emacs-lisp
  (defun cool-hello () (string-join '("cool" "hello") " "))

  (defun org-dblock-write:hello-dblock ( arg)
(interactive)
(let* ((a (if (called-interactively-p 'any)
 (format "#+BEGIN: hello-dblock\n%s\n#+END:\n"
 (cool-hello))
   (format "%s" (cool-hello)
  (insert a)))

  (org-dynamic-block-define "hello dblock" #'org-dblock-write:hello-dblock)
#+end_src

#+RESULTS:
: org-dblock-write:hello-dblock


#+BEGIN: hello-dblock
cool hello
#+END:

* Notes

In the above snippet, for it to work in both cases, after numerous 
experiments, I found that both the =(interactive)= part and the =( 
arg)= part are necessary.

If memory serves, depending on whether it is used with =M-x org-dblock-update= 
or =M-x org-dynamic-block-insert-dblock=, one of them might not require the 
=interactive= part, while it's a requirement for the other one. Similarly, one 
scenario requires no arguments, while the other demands that arguments are 
present.

Cheers,
Chris






Re: Using backticks for the inline code delimiter? (now with `org-publish-all`)

2023-12-06 Thread chris
On Monday, December 4, 2023 1:06:37 PM UTC you wrote:
> chris  writes:
> > The code below is working fine as long as I stay in `org-mode`. But it
> > shows its limitations when I do `M-x org-publish-all`, at which time,
> > instead of having the text with style verbatim, I get the text within
> > backticks.
> > 
> > Is there any improvement you could think of that would fix that?
> 
> You will need to patch the parser in org-element.el.

Yes, that seems a very good idea.
I've never "patched" emacs before: in the hack I've been using so far I was 
doing some `(advice-add 'org-do-emphasis-faces :override #'org-do-emphasis-
faces-fixed)` thing.
In any case the problem (or part of it) lies in `org-element.el` because I've 
observed the backticks constructions were not recognised as an "element".
But okay, patch emacs, no worries. Since I'm using NixOS, it will take a bit 
of time for me to figure out how to do it the NixOS way.
> 
> We do not officially support extending markup syntax. So, even changing
> org-element may still leave other bugs. Caveat emptor.

The backticks for inline code or verbatim are very pleasing to the eye, and 
are used literally universally.







Re: Using backticks for the inline code delimiter? (now with `org-publish-all`)

2023-11-26 Thread chris
The code below is working fine as long as I stay in `org-mode`. But it shows 
its limitations when I do `M-x org-publish-all`, at which time, instead of 
having the text with style verbatim, I get the text within backticks.

Is there any improvement you could think of that would fix that?
Thanks,
Chris


On Saturday, March 19, 2022 3:17:10 AM UTC you wrote:
> > George Mauer writes:
> >> is there a straightforward way to extend the org parser to do this?
> > 
> > I don't think so. It seems the emphasis markers are hard-coded
> > in various places.
> > 
> > From a quick look at the code, you'd have to customize
> > `org-emphasis-alist` and redefine `org-set-emph-re`  and
> > `org-do-emphasis-faces`. Maybe that'd be enough.
> 
> I did just what you said, and I've inserted what's bellow, somewhere in my
> `init.org` / `init.el`, before anything `org-mode` related (save for two
> `hook`): (Note it is an almost exact copy from `org.el`, I've only changed
> a few characters. And added the `advice-add override`.)
> 
> #+begin_src emacs-lisp
>   (defun org-set-emph-re-fixed (var val)
> "Set variable and compute the emphasis regular expression."
> (set var val)
> (when (and (boundp 'org-emphasis-alist)
>(boundp 'org-emphasis-regexp-components)
>org-emphasis-alist org-emphasis-regexp-components)
>   (pcase-let*
>   ((`(,pre ,post ,border ,body ,nl) org-emphasis-regexp-components)
>(body (if (<= nl 0) body
>(format "%s*?\\(?:\n%s*?\\)\\{0,%d\\}" body body nl)))
>(template
> (format (concat "\\([%s]\\|^\\)" ;before markers
> "\\(\\([%%s]\\)\\([^%s]\\|[^%s]%s[^%s]\\)\\3\\)"
> "\\([%s]\\|$\\)") ;after markers
> pre border border body border post)))
> (setq org-emph-re (format template "*/_+"))
> (setq org-verbatim-re (format template "=~`")
> 
>   (advice-add 'org-set-emph-re :override #'org-set-emph-re-fixed)
> #+end_src
> 
> #+begin_src emacs-lisp
>   (defun org-do-emphasis-faces-fixed (limit)
> "Run through the buffer and emphasize strings."
> (let ((quick-re (format "\\([%s]\\|^\\)\\([~`=*/_+]\\)"
> (car org-emphasis-regexp-components
>   (catch :exit
> (while (re-search-forward quick-re limit t)
>   (let* ((marker (match-string 2))
>  (verbatim? (member marker '("~" "`" "="
> (when (save-excursion
> (goto-char (match-beginning 0))
> (and
>  ;; Do not match table hlines.
>  (not (and (equal marker "+")
>(org-match-line
> "[ \t]*\\(|[-+]+|?\\|\\+[-+]+\\+\\)[
> \t]*$"))) ;; Do not match headline stars.  Do not consider ;; stars of a
> headline as closing marker for bold ;; markup either.
>  (not (and (equal marker "*")
>(save-excursion
>  (forward-char)
>  (skip-chars-backward "*")
>  (looking-at-p org-outline-regexp-bol
>  ;; Match full emphasis markup regexp.
>  (looking-at (if verbatim? org-verbatim-re org-emph-re))
> ;; Do not span over paragraph boundaries.
>  (not (string-match-p org-element-paragraph-separate
>   (match-string 2)))
>  ;; Do not span over cells in table rows.
>  (not (and (save-match-data (org-match-line "[ \t]*|"))
>(string-match-p "|" (match-string 4))
>   (pcase-let ((`(,_ ,face ,_) (assoc marker org-emphasis-alist))
> (m (if org-hide-emphasis-markers 4 2)))
> (font-lock-prepend-text-property
>  (match-beginning m) (match-end m) 'face face)
> (when verbatim?
>   (org-remove-flyspell-overlays-in
>(match-beginning 0) (match-end 0))
>   (remove-text-properties (match-beginning 2) (match-end 2)
>   '(display t invisible t intangible
> t))) (add-text-properties (match-beginning 2) (match-end 2)
> '(font-lock-multiline t org-emphasis t)) (when (and
> org-hide-emphasis-markers
>(not (org-at-comment-p)))
>   (add-text-properties (match-end 4) (match-beginning 5)
>'(invisible t))
>   (add-text-properties (match-beginning 3) (match-end 3)
>'(invisible t)))
> (throw :exit t







Re: Calc/TBLFM: how to conditionally insert hours:minutes?

2023-09-25 Thread Chris Keschnat


Hi Bruno,

> You could switch to the "Lisp" syntax (as opposed to the "Calc" syntax),
> and, write the conversion manually:
>
> | 19:55:00 |
> | 40:01:00 |
> | 40:01:00 |
>
> #+TBLFM: $1='(org-table-time-string-to-seconds (if (<= @# 1) "19:55" 
> "40:01"));T

awesome, thank out. This works as expected with the little addendum that
@# in Calc seems to ignore the header line (not present in this
example), but the Lispy syntax doesn't. So the 1 in the "if" becomes a 2.

> Note that, for Calc, 'X:Y' means the fraction 'X/Y' of the two
> integers X and Y:
>
>40:01 = 40/1 = 40
>40:02 = 40/2 = 20
>    40:03 = 40/3
>40:04 = 40/4 = 10

This also explains why 40:00 errors out :)

Thanks a lot

Chris



Calc/TBLFM: how to conditionally insert hours:minutes?

2023-09-23 Thread Chris Keschnat


Hi,
I am trying to understand how to set hours:minutes values in tables 
conditionally.

Just setting hours directly works:

| 40:03:00 |
| 40:03:00 |
| 40:03:00 |
#+TBLFM: $1=40:03;T

But when doing that conditionally (first row different from the others),
I do not understand the behavior:

This seemed to work:

| 19:55:00 |
| 40:03:00 |
| 40:03:00 |
#+TBLFM: $1=if(@# <= 1, 19:55, 40:03);T

But after adjusting the minutes, this happens:

| 19:55:00 |
| 00:00:40 |
| 00:00:40 |
#+TBLFM: $1=if(@# <= 1, 19:55, 40:01);T

What would be the correct way to do this?

PS: I have found that the same happens when I add parentheses:

| 40:03:00 |
| 40:03:00 |
| 40:03:00 |
#+TBLFM: $1=(40:03);T

| 00:00:40 |
| 00:00:40 |
| 00:00:40 |
#+TBLFM: $1=(40:01);T

PPS: I came across this when trying to understand the formulas here
https://github.com/clange/org-mode

Thanks
Chris



Re: [BUG] tikz latex figures don't render properly in the html output. [9.6.6 (release_9.6.6 @ /usr/share/emacs/29.1/lisp/org/)]

2023-09-20 Thread chris
On Tuesday, September 19, 2023 10:07:07 AM UTC Ihor Radchenko wrote:
> Rudolf Adamkovič  writes:
> > tusharhero--- via "General discussions about Org-mode."
> > 
> >  writes:
> >> \begin{tikzpicture}
> >> \draw (0,0) circle [radius=2cm];
> >> \end{tikzpicture}
> > 
> > ... But, but, but!  There
> > is a new LaTeX preview system in works [2],
> > and it fixes a lot of problems out of the
> > box, including yours!
> 

At some point in the past I've experimented with
https://tikzjax.com/
So I changed something somewhere in the org-mode config and it just worked, it 
was quite straightforward to do. I however probably don't have notes on how I 
did it.
I didn't insist in that direction because it wasn't working with TikZ libs, 
specifically tikzcd.
But it was really nice.
This however is implementing many TikZ libraries, I don't know if it's usable 
with org-mode, but it looks totally great, it's from Obsidian but it's on 
Github
https://github.com/artisticat1/obsidian-tikzjax
IMO this sort of solution is very nice.

> Fist, for the record...
> Confirmed.
> 
> I can also confirm that TEC's feature branch does not have this bug.

What is TEC?

> 
> On main, the bug is caused by horrible heuristics in
> `org-html--latex-environment-numbered-p' and
> `org-html--unlabel-latex-environment', which make a naive assumption
> that \begin{foo*} is always available and codifies unnumbered version of
> environment.
> 
> However, \begin{tikzpicture*} environment is not valid. Moreover,
> \begin{tikzpicture} is not numbered either (just as many other
> non-equation environments).
> 
> That said, I am not sure what is going on with numbering in TEC's branch
> - the above two functions are left in the code, __unused__. Which
> indicates that we might also have some feature regression on that branch.
> Timothy, any comments?







Re: File generation from LaTeX src fails due to temporary PDF in wrong directory

2023-03-30 Thread chris
On Thursday, 30 March 2023 13:15:34 CEST Christian Moe wrote:
> 
> chris writes:
> 
> > On Wednesday, 29 March 2023 23:15:03 CEST Christian Moe wrote:
> >>
> >> Hi,
> >>
> >> Pardon the noise: It turned out to be a pretty obvious problem with my
> >> setup that has now been resolved.
> >>
> >> I had modified org-latex-pdf-process to use xelatex, and for some reason
> >> my setup lacked the =-output-directory %o= switch. I should probably
> >> have thought of that first, but the omission has had no ill effects on
> >> ordinary PDF export, so I didn't run into any problem before trying to
> >> use Babel with LaTeX.
> >>
> >> Ihor and Pedro, thanks for checking.
> >>
> >> Chris, I don't know why your attempts fail, but I'll be trying similar
> >> things over the next days, so maybe I'll come back to you.
> >>
> >
> > For one thing I don't understand 90% of the options, that can explain a lot.
> > Another point, the gibberish output I was speaking about are "similar" those
> > of
> > [[https://emacs.stackexchange.com/questions/68823/minimal-working-example-of-tikz-to-svg-in-orgmode]]
> > Actually the svg image they get is an image containing the `tikz` 
> > instructions
> > transformed as image. What I get is the svg instructions that should 
> > generate
> > the image: an image showing a `svg` listing.
> 
> I am seeing the same problem, and think I have a solution below, but
> it's confusing and I'm wondering if other people have this working out
> of the box somehow.
> 
> The difference between what you are seeing, and what they are seeing in
> the stackexchange thread, comes down to whether =:headers
> '("\\usepackage{tikz}")= is specified. Without it, all they get is an
> SVG of the glyphs in the arguments to the tikz commands. With it, we get
> an SVG of the glyphs in the SVG for the image. So when the extension is
> .svg, the intermediate PDF that is converted into SVG does not contain
> the image, but a listing of the SVG, which has *already* been generated!
> 
> The reason, I think, is that org-babel-latex-preamble includes this
> definition:
> 
> : \def\pgfsysdriver{pgfsys-tex4ht.def}
> 
> So what happens, I think, is that tex4ht already generates SVG from the
> TikZ code. When Org then uses org-babel-latex-pdf-svg-process to call an
> external utility, by default inkscape, to convert the PDF to SVG, we are
> converting not an image but a code listing already in SVG.
> 
> It is not at all clear to me why tex4ht is invoked in the default
> preamble. I wonder if it still serves a purpose. If it makes better SVG
> from LaTeX than the other utilities, it would be nice to use it directly
> somehow. But perhaps it is just a leftover from a stage in development
> when htlatex was used to produce the SVG, before the two-part-process
> ->PDF->SVG with org-babel-latex-pdf-svg-process was defined. If so it
> should probably be changed. Here's the relevant thread, I think, for
> people wanting to look into that:
> 
>   https://list.orgmode.org/873608ajfn@bzg.fr/t/
> 
> 
> Solution:
> 
> Redefine org-babel-latex-preamble to remove
> the offending line.
> 
>   (setq org-babel-latex-preamble
> '(lambda (_)
>   "\\documentclass[preview]{standalone}"))
> 
> With this setup, my example
> 
>   #+header: :fit yes :headers '("\\usepackage{tikz}")
>   #+begin_src latex :exports results :results raw file :file 
> test-tikz-triangle.svg
> \begin{tikzpicture}
>   \draw[draw=black, fill=blue!10] (0,4) -- (3,0) -- (-3,0) -- cycle;
> \end{tikzpicture}
>   #+end_src
> 
> exports correctly to an .svg file.

Hmm, your fix works perfectly! And it's a `defcustom` variable so it's not even 
a hack.

I guess that since you haven't selected specific method like: `#+header: 
:imagemagick yes`, the method used is `inkscape` (`ob-latex.el` file):
```
(defcustom org-babel-latex-pdf-svg-process
  "inkscape \
--pdf-poppler \
--export-area-drawing \
--export-text-to-path \
--export-plain-svg \
--export-filename=%O \
%f"
  "Command to convert a PDF file to an SVG file."
  :group 'org-babel
  :type 'string
  :package-version '(Org . "9.6"))
```

I don't know if you use `org-latex-preview` for `tikz` snippets? Maybe you 
don't because that doesn't export to `html`.

I use `(setq org-preview-latex-default-process 'dvipng)`, and I guess it would 
be nice to add an new option in `(defcustom org-preview-latex-process-alist` to 
add `inkscape`.

So with you solution, I guess when we export to `html`, the "normal" `latex` 
formulas are rendered by `mathjax`, which works very well, and the `tikz` 
diagrams are automatically exported as a `svg` image, while the code to produce 
them is not exported.

I suppose you use those `latex` code block for exporting to `html` purpose?

Thanks,
Chris

> 
> Yours,
> Christian
> 
> 







Re: File generation from LaTeX src fails due to temporary PDF in wrong directory

2023-03-29 Thread chris
On Wednesday, 29 March 2023 23:15:03 CEST Christian Moe wrote:
> 
> Hi,
> 
> Pardon the noise: It turned out to be a pretty obvious problem with my
> setup that has now been resolved.
> 
> I had modified org-latex-pdf-process to use xelatex, and for some reason
> my setup lacked the =-output-directory %o= switch. I should probably
> have thought of that first, but the omission has had no ill effects on
> ordinary PDF export, so I didn't run into any problem before trying to
> use Babel with LaTeX.
> 
> Ihor and Pedro, thanks for checking.
> 
> Chris, I don't know why your attempts fail, but I'll be trying similar
> things over the next days, so maybe I'll come back to you.
> 

For one thing I don't understand 90% of the options, that can explain a lot.
Another point, the gibberish output I was speaking about are "similar" those 
of
[[https://emacs.stackexchange.com/questions/68823/minimal-working-example-of-tikz-to-svg-in-orgmode]]
Actually the svg image they get is an image containing the `tikz` instructions 
transformed as image. What I get is the svg instructions that should generate 
the image: an image showing a `svg` listing.
Anyway
You start from that:

 #+begin_src emacs-lisp
  (setq org-latex-compiler "lualatex")
#+end_src

#+name: circle
#+header: :results file drawer
#+header: :file circle.svg
#+header: :dvisvgm yes
#+header: :headers '("\\usepackage{tikz}")
#+begin_src latex
  \begin{tikzpicture}
  \fill[yellow] (0,0) circle (3cm);
\end{tikzpicture}
#+end_src

You do C-c C-c on both blocks.
Looking at *Messages* you see there is a file

```
cat /tmp/babel-DQ59bY/latex-2whyWA.tex
\documentclass[preview]{standalone} 
\def\pgfsysdriver{pgfsys-tex4ht.def} 
\usepackage{tikz}\begin{document}\begin{tikzpicture} 
   \fill[yellow] (0,0) circle (3cm); 
 \end{tikzpicture}\end{document}
```

Among `latex`, `pdflatex`, `lualatex`, `htlatex`, the latex file can only be 
successfully processed by `htlatex`, which will produces several outputs:

```
ls *2whyWA* 
latex-2whyWA-1.svg  latex-2whyWA.4tc  latex-2whyWA.css  latex-2whyWA.html  
latex-2whyWA.lg   latex-2whyWA.tmp 
latex-2whyWA.4ctlatex-2whyWA.aux  latex-2whyWA.dvi  latex-2whyWA.idv   
latex-2whyWA.log  latex-2whyWA.xref
```
One of them is `svg` file and is correct.

I've tried replacing `(setq org-latex-compiler "lualatex")` by every possible 
latex compiler listed above.
I've also tried replacing `#+header: :dvisvgm yes` by `htlatex` and 
`inkscape`.

In every case I get the gibberish output, specifically an image of the listing 
of the svg output, or in any case something resembling to `XML`.

Something else I can do "by hand":

```
lualatex -jobname=foo <(sed '/pgfsysdriver/d' /tmp/babel-DQ59bY/
latex-2whyWA.tex); dvisvgm --pdf --output=foo.svg foo.pdf
```

then:

```
$ cat foo.svg 
 
 
 
 
 
 
 
 
 

$ cat latex-2whyWA-1.svg  
  
  
http://www.w3.org/2000/svg; xmlns:xlink="http://www.w3.org/1999/
xlink" width="170.71652pt" height="170.71652pt" viewBo
x="-85.35826 -85.35826 170.71652 170.71652 ">  
  
  
 
 
 
 
 
 
 

 
```

I got that last trick from [[https://en.wikipedia.org/wiki/
Wikipedia:Graphics_Lab/Resources/PDF_conversion_to_SVG]]

We can see both files have the exact same size, `foo.svg` is 548 bytes, 
`latex-2whyWA-1.svg` is 855 bytes.

`foo.svg` is superior in that it uses `utf-8` encoding, which is superior.

bitmaps outputs for `tikz` are not nice.

So two ways to do it by hand, and it would be nice to have it doing it 
automatically.

Wikipedia says `inkscape` method can yield heavy results, and indeed I had to 
install `potrace`.

They say in the stackexchange page that `pdflatex+inkscape` is the default 
method, so even it didn't work at all, I followed the instruction it gave me 
to first install `inkscape` and then install `potrace`.

What I like best is:

```
lualatex -jobname=foo <(sed '/pgfsysdriver/d' /tmp/babel-DQ59bY/
latex-2whyWA.tex); dvisvgm --pdf --output=foo.svg foo.pdf
```

It would be easier if second line `\def\pgfsysdriver{pgfsys-tex4ht.def}` was 
not inserted in the first place.

I think the way plain `org-latex-preview`, which work for me, are generated is 
through `latex + dvisvgm` and I think that in this case the above 
`\def\pgfsysdriver{pgfsys-tex4ht.def}` isn't used neither.

Using "old" `latex` can be troublesome in some cases though, namely everytime 
somebody is trying to use some `utf-8`.

Best,
Chris



> Yours,
> Christian
> 
> 
> chris writes:
> 
> > On Wednesday, 29 March 2023 10:00:35 CEST Pedro Andres Aranda Gutierrez 
wrote:
> >> On Tue, 28 Mar 2023 10:04:24 +0200, Christian Moe  
wrote
> >> Hi,
> >>
> >> > I'm trying and failing to export images from TikZ code, apparently
> &g

Re: File generation from LaTeX src fails due to temporary PDF in wrong directory

2023-03-29 Thread chris
t; :message "you need to 
install the programs: latex and dvisvgm." :image-input-type "dvi" 
:image-output-type "svg" :image-size-adjust
   (1.7 . 1.5)
   :latex-compiler
   ("latex -interaction nonstopmode 
-output-directory %o %f")
   :image-converter
   ("dvisvgm %f -n -b min -c %S -o %O"))
  (imagemagick :programs ; The recommended "new" way.
   ("latex" "convert")
   :description "pdf > png" :message "you need 
to install the programs: latex and imagemagick." :image-input-type "pdf" 
:image-output-type "png" :image-size-adjust
   (1.0 . 1.0)
   :latex-compiler
   ("lualatex -interaction nonstopmode 
-output-directory %o %f")
   :image-converter
   ("convert -density %D -trim -antialias %f 
-quality 100 %O"
#+end_src

No luck at all there neither.

BTW, when I do C-c C-c on the OP example, after having evaluated
#+begin_src emacs-lisp
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((latex . t)))
#+end_src

No pdf, no output, only an empty latex file generated in /tmp


Bottom line, I'd really like to know how this hole thing is supposed to work.
org-preview latex working perfectly fine though.

Note: The reason I want to have this working is that I want to export to html. 
Plain latex formula are displayed very very well using mathjax. But TiKz things 
are not working.
So even though I've got a near wysiwyg in emacs, I can't have that exported to 
html.
What I'd like to have is plain latex formulas exported to mathjax and tikz 
diagrams exported using the SVG image.
Initially my setting wasn't even using imagemagick, only dvisvgm.

Also it seems we have three ways to do the exact same thing:
org-latex-preview which works perfectly with minimal effort on my box,
the C-c C-c thing,
and the org-html-export-to-html thing.
Each using independent workflow. Though probably not completely independent 
though.

My emacs is master from a month ago.

Cheers,
Chris



> 
> My emacs:
> 
> GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33,
>  cairo version 1.16.0) of 2023-03-26
> 
> Would you please try again, calling with emacs -Q and giving a couple
> clues more of your process to confirm... It may be that I'm too modern
> ;-)
> 
> Thx, /Pedro A.
> 
> 




[1] https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.html


Re: MathJax extension does not work

2023-03-27 Thread chris
On Sunday, 10 October 2021 11:14:24 CEST Rudolf Adamkovič wrote:
> I would like to use the "\mathclap" command from the "mathtools" package in 
> my Org document. In LaTeX, it works. For HTML, I visited the Org manual [1] 
> where I saw the following example:
> 
> #+HTML_MATHJAX: cancel.js noErrors.js
> 
> with a comment "it loads the two MathJax extensions ‘cancel.js’ and 
> ‘noErrors.js’ [132]." (As a side-note, the first link in [132] points to 
> 404.) Thus, I put the following into my Org file
> 
> #+HTML_MATHJAX: mathtools.js
> 

With similar scenario I ended up with:
(and `mathjax` extensions work very well)

```org-mode
#+STARTUP: latexpreview

#+BEGIN_EXPORT html

window.MathJax = {
  loader: {
paths: {unicodeMath:

'<a  rel="nofollow" href="https://cdn.jsdelivr.net/npm/@amermathsoc/mathjax-unicode-math@1/browser">https://cdn.jsdelivr.net/npm/@amermathsoc/mathjax-unicode-math@1/browser</a>'},
load: ['[tex]/mathtools', '[unicodeMath]/unicode-math.js']},
tex: {packages: {'[+]': ['mathtools', 'unicode-math']}}};

#+END_EXPORT

\begin{array}{ccc}
  \underset{\longrightarrow}{\lim}^f(\alpha_1 \circ p_1)
  &\overset{\underset{\longrightarrow}{\lim}^f \phi}{\longrightarrow}&
  \underset{\longrightarrow}{\lim}^f(\alpha_2 \circ p_2)
  \\
{}^{\mathllap{\simeq}}\downarrow
&&
\downarrow^{\mathrlap{\simeq}}
\\
\underset{\longrightarrow}{\lim}^f \alpha_1
&\underset{f}{\longrightarrow}&
\underset{\longrightarrow}{\lim}^f \alpha_2
\end{array}

(diagram above from: [[https://ncatlab.org/nlab/show/ind-object][ind-object in 
nLab]])

\(\Bbbc\)

This above uses the other extension, unicode-math.
```

It works when exporting to `latex` and then `pdf`,
it works very well when exporting to `html` via `org-html-export-to-html`,
it almost works with `org-latex-preview`.

Here the relevant part of my `config.org`:

```org-mode
#+begin_src emacs-lisp
  (with-eval-after-load 'org
  (add-to-list 'org-latex-packages-alist '("" "stmaryrd" t))
  (add-to-list 'org-latex-packages-alist '("" "tikz-cd" t))
  (add-to-list 'org-latex-packages-alist '("" "amscd" t))
  (add-to-list 'org-latex-packages-alist '("" "mathtools" t))
  (add-to-list 'org-latex-packages-alist '("" "unicode-math" t))
  ;; (add-to-list 'org-latex-packages-alist '("" "breqn" t))
  (add-to-list 'org-latex-packages-alist '("" "thisisastupidtestfile" t))
  (setq org-latex-create-formula-image-program 'dvisvgm)
  (setq org-format-latex-options
(plist-put org-format-latex-options :scale 0.80)))
#+end_src
```

`thisisastupidtestfile.sty` contains a few straightforward macro of the sort of 
`\newcommand{\calT}{\mathcal{T}}`.

Everything works save `unicode-math` which doesn't work with anything `dvi`.

I use `dvisvgm` because it allows `tikz` to work with `org-latex-preview`.

Cheers,
Chris


> but it seems to do nothing; the exported HTML code not even contain the word 
> "mathtools".
> 
> A file that demonstrates the problem:
> 
> #+LATEX_HEADER: \usepackage{mathtools}
> #+HTML_MATHJAX: mathtools.js
> 
> \begin{equation*}
> \begin{aligned}
> \lim_{R\to0}F_1
> =\lim_{R\to0}\frac{2PR}{P+R}
> =\lim_{R\to0}\frac{2\cdot0\cdot{}R}{0+R}
> =\lim_{R\to0}\frac{0}{R},
> =\underbrace{\lim_{R\to0}\frac{0}{1}}_{\mathclap{\text{by L'Hôpital's Rule 
> with $\frac{d}{dR}R=1$}}}
> =\lim_{R\to0}0
> =0.
> \end{aligned}
> \end{equation*}
> 
> Rudy
> 
> [1] https://orgmode.org/manual/Math-formatting-in-HTML-export.html
> 
> 







Re: visual-line-mode don't play well with org-latex-preview

2023-03-08 Thread chris
On Wednesday, 8 March 2023 20:14:53 CET Bruno Barbier wrote:
> 
> Hi Chris,
> 
> chris  writes:
> 
> > On Thursday, 2 March 2023 20:00:14 CET Bruno Barbier wrote: 
> >> The behavior looks the same using only text-mode (without using org).
> >> You should probably report this as an Emacs bug (see M-x
> >> report-emacs-bug).
> >
> > What command for latex preview in text mode? (I'll probably figure that 
> > out.)
> >
> 
> org-latex-preview. Why ? :-)
> 
> 
> > Yes, I should definitely report that bug.
> 
> In case it helps you to report the bug, here is the minimal way I found
> to reproduce it (no latex, no org):
> 
>  #+begin_src elisp
>(let ((b (generate-new-buffer "=bug")))
>  (with-current-buffer b
>(dotimes (_ 110) (insert "Hello "))
>(insert-image (svg-image (let ((s (svg-create 250 9)))
>(svg-line s 0 0 250 9 :stroke-color 
> "green")
>    s)))
>(org-mode)
>(visual-line-mode 1)
>(pop-to-buffer b)))
>  #+end_src

Amazing,
Chris

> 
> Bruno
> 







Re: visual-line-mode don't play well with org-latex-preview

2023-03-06 Thread chris
On Thursday, 2 March 2023 20:00:14 CET Bruno Barbier wrote:
> 
> Hi Chris,
> 
> chris  writes:
> 
> > Hi all,
> >
> > ```
> > hello hello hello hello hello hello hello hello hello hello hello hello 
> > hello 
> > hello hello  \(\text {hello hello hello hello hello hello hello hello}\)
> > ```
> >
> > If you put the above text in a org file, and activate `visual-line-mode` 
> > and 
> > `org-latex-preview`, depending on the length of the initial part of the 
> > text, 
> > the generated png/svg image from latex expression can be displayed in full, 
> > partially hidden or totally hidden.
> >
> 
> I'm observing the same behavior.
> 
> The preview is not always fully visible.  But, after adding some text
> (at least one space after the preview), Emacs wraps as needed, so that
> the preview remains visible. 

That is a very nice workaround.

> Emacs is just not wrapping correctly in
> that edge case, where there is nothing at all after the latex preview.
> 
> The behavior looks the same using only text-mode (without using org).
> You should probably report this as an Emacs bug (see M-x
> report-emacs-bug).

What command for latex preview in text mode? (I'll probably figure that out.)

Yes, I should definitely report that bug.

Thanks a lot,
Chris

> 
> Bruno
> 







visual-line-mode don't play well with org-latex-preview

2023-02-27 Thread chris
Hi all,

```
hello hello hello hello hello hello hello hello hello hello hello hello hello 
hello hello  \(\text {hello hello hello hello hello hello hello hello}\)
```

If you put the above text in a org file, and activate `visual-line-mode` and 
`org-latex-preview`, depending on the length of the initial part of the text, 
the generated png/svg image from latex expression can be displayed in full, 
partially hidden or totally hidden.

That certainly hinder readability.

I've search the web to see if someone else did stumbled on that but haven't 
found anything yet.

Sure enough there isn't an obvious fix that would deal with every cases, like 
when the image is longer that the width of the window of the max column of 
`visual-column-mode`. At least there are different cases to consider.

Best,
Chris





Re: [BUG] org-latex-preview with custom sty file

2023-02-24 Thread chris
On Friday, 24 February 2023 18:49:10 CET Timothy wrote:
> Hi Chris,
> 
> > Note: I haven’t been able to compute the return value of the hash function 
> > for
> > my latex expression, because I can’t figure out what the arguments actually 
> > are,
> > specifically `forbuffer`, `fg` and `bg`, but the above reasoning seems 
> > sound.
> > Note: Removing specifically the images looking like the image associated 
> > with
> > the latex expression that refuses to be regenerated, using some file 
> > manager,
> > and then invoking `org-latex-preview`, does the trick, but it’s impractical.
> 
> Yea, `org-format-latex' is a bit of a nightmare. I’ve got a WIP overhaul of 
> the
> entire LaTeX preview system which is currently 95% of the way done. The new
> system will still not notice changes in package source files, but it will be
> easy to clear the cache and regenerate.

There is that, which is supposed to be included in org-mode 9.7:
https://github.com/karthink/org-preview?

I suppose for image regeneration it needs user manual intervention, otherwise 
it's the same to do `rm ltximg/*`.

If I were able to compute the output of the hash function I could have decided 
which image to selectively remove.

> 
> All the best,
> Timothy
> 
> 







[BUG] org-latex-preview with custom sty file

2023-02-24 Thread chris
Dear all,

How to do it:

My org-latex-preview related config:

```
(with-eval-after-load 'org 
 (add-to-list 'org-latex-packages-alist '("" "stmaryrd" t)) 
 (add-to-list 'org-latex-packages-alist '("" "tikz-cd" t)) 
 (add-to-list 'org-latex-packages-alist '("" "thisisastupidtestfile" t)) 
 (setq org-latex-create-formula-image-program 'dvisvgm) 
 (setq org-format-latex-options 
   (plist-put org-format-latex-options :scale 0.80)))

```

in some org file (`hello.org`), add this latex formula:
`\(\calT \llbracket \tau_H \rrbracket \)`
Invoke `org-latex-preview` (`C-c C-x C-l`).
Open `thisisastupidtestfile.sty` which is situated in the same directory as our 
`hello.org` file.
Change the definition of: `\newcommand{\calT}{\mathcal{T}}` to 
`\newcommand{\calT}{\mathcal{K}}` and invoke `org-latex-preview`.

Result: There is no way you can have the image regenerated.

Analysis: the image is associated to the latex input through some hash function 
(see below). Editing `thisisastupidtestfile.sty` doesn't change the arguments 
of the hash function, consequently the image isn't regenerated.

I understand org-latex-preview images are associated to latex expression 
through some hash function:
```
(sha1 (prin1-to-string
   (list org-format-latex-header
 org-latex-default-packages-alist
 org-latex-packages-alist
 org-format-latex-options
 forbuffer value fg bg)))
```

Now if I edit my custom sty file, the output of the hash function won't change, 
and therefore the generated image won't change neither.

Note: I haven't been able to compute the return value of the hash function for 
my latex expression, because I can't figure out what the arguments actually 
are, specifically `forbuffer`, `fg` and `bg`, but the above reasoning seems 
sound.
Note: Removing specifically the images looking like the image associated with 
the latex expression that refuses to be regenerated, using some file manager, 
and then invoking `org-latex-preview`, does the trick, but it's impractical.

Best,
Chris






Re: [BUG] Emacs tries to recenter / rescroll when it hits hidden org emphasis [9.4.6 (9.4.6-798-g738759.dirty-elpaplus @ .emacs.d/elpa/develop/org-plus-contrib-20210929/)]

2022-12-25 Thread Chris Findeisen
Thanks a lot Ihor for looking at this. I followed the discussion in the
linked mailing list. I write a lot in Emacs and this gets rid of a long
standing annoyance. :) Cheers!

On Thu, Oct 27, 2022 at 11:08 PM Ihor Radchenko  wrote:

> Ihor Radchenko  writes:
>
> > I have forwarded this bug report to Emacs bug tracker.
> > See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58793
>
> The bug is now fixed on Emacs master.
> This issue will be resolved in the next Emacs 29 release.
> (It has nothing to do with Org)
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>


Re: Org 9.5 broke the rendering of my SVG images

2022-10-17 Thread Chris Clark
Would the HTML  tag be appropriate in this case?

For example, here's a tiny example of using the  tag with an external
CSS stylesheet: https://plnkr.co/edit/i8RFDW?preview


On Fri, Oct 14, 2022 at 4:32 AM Ihor Radchenko  wrote:

> Alexandre Duret-Lutz  writes:
>
> > In Org 9.5, SVG images started being exported by the HTML exporter as
> >  rather than .
> >
> > The patch causing that was
> >   https://list.orgmode.org/87k0pemj6d@gmail.com/T/
> > with two arguments:
> > 1)  do not have an alt attribute
> > 2)  will not render some SVG file correctly if it has no viewBox
> >(I'm assuming that the issue shown in that message is a missing
> viewBox).
> >
> > The reason I've noticed this change is that it broke my web pages.  On
> > my pages, I use SVG to display many automata, and they all share a
> > common stylesheet.  That stylesheet is not inlined into the SVG, rather,
> > it is a separate file included in the SVG files with
> >   
> > so that the browser only need to download it once.
> >
> > Infortunately,  does not allow external stylesheets to be
> > processed, so my stylesheets are now ignored.  Note that one can also
> > build SVG images that include other SVG images, or SVG images that have
> > animations that start when you hover on some elements.  All those
> > usages would break with .
> >
> > I've seen that very issue was discussed back in 2016
> > https://list.orgmode.org/871t2iq353@iki.fi/T/
> > where Christian Moe pointed out exactly this:
> >
> >> (2) You can also do other things with  that you cannot with
> >> , like manipulating the SVG with Javascript and styling it with
> >> an external stylesheet (linked from the SVG, not the web page).
> >
> > So in the interest of allowing users to build documents where SVG
> > files are not static, self-contained images, it seems to me that Org
> > probably needs some way to specify whether SVG images should be
> > exported as  or  (or maybe even inlined).
>
> Confirmed.
> This is clearly a regression and should be fixed.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at .
> Support Org development at ,
> or support my work at 
>
>


Re: Add 'backend' header arg to clojure code blocks

2022-10-09 Thread Chris Clark
Thank you for the great feedback! Here are some updated patches.

Attached are two patches: one for org mode, and a corresponding one for
worg.

On Sun, Oct 9, 2022 at 3:42 AM Ihor Radchenko  wrote:

> Chris Clark  writes:
>
> > This is my first attempt to contribute to org-mode; please let me know if
> > I'm doing something wrong.
>
> Thanks a lot! Contributions are always welcome.
>
> Please also add a mention and/or example to the ob-clojure documentation
> https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html
> (The source repository is https://git.sr.ht/~bzg/worg )
>
> Also, you need to add an etc/ORG-NEWS entry about the new header
> argument.
>
> And I have few minor comments on the patch itself.
>
> > From cc72dcac3075be76e3edcfee75c887272e48698c Mon Sep 17 00:00:00 2001
> > From: Chris Clark 
> > Date: Sat, 8 Oct 2022 05:41:20 -0400
> > Subject: [PATCH] ob-clojure.el: Add a 'backend' header arg to clojure
> code blocks
>^:backend
> > * ob-clojure.el (org-babel-header-args:clojure,
> > org-babel-execute:clojure): Add a 'backend' header arg that can
>^:backend
> > override the configured `org-babel-clojure-backend`.
>^'
> (by convention, we quote like `symbol' using `' pair).
>
>
> Also, unless you have FSF copyright assignment, we need you to add
> TINYCHANGE at the end of the commit message. See
> https://orgmode.org/worg/org-contribute.html#first-patch
>
> > +   (t (user-error "You need to customize
> org-babel-clojure-backend")
>
> While we are here, can as well quote `org-babel-clojure-backend'.
>
> Or may even add "or set `:backend' header argument".
>
> --
> 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>
>


0001-ob-clojure.el-Add-a-backend-header-arg-to-clojure-co.patch
Description: Binary data


0001-ob-doc-clojure.org-Add-example-of-backend-header-arg.patch
Description: Binary data


Add 'backend' header arg to clojure code blocks

2022-10-08 Thread Chris Clark
This is my first attempt to contribute to org-mode; please let me know if
I'm doing something wrong.

Attached is a patch to incorporate some of the changes that were originally
presented by Ag Ibragimov here:
https://list.orgmode.org/m2y2oimdjf@gmail.com/. I've been using these
changes locally for a long time, and I'm hoping others might benefit!

For example:

   #+header: :backend babashka
   #+begin_src clojure
 (range 3)
   #+end_src

   #+RESULTS:
   : (0 1 2)


0001-ob-clojure.el-Add-a-backend-header-arg-to-clojure-co.patch
Description: Binary data


Re: `M-x org-open-at-point` on `[[file:/path/file.hs][name]]` says: "Running less /home/path/file.hs"

2022-04-11 Thread chris
On Wednesday, 6 April 2022 19:26:38 CEST chris wrote:
> [was: Issue with internal directory links]
> 
> > Hi Jonathan,
> > 
> > Jonathan Fox  writes:
> >> Here's a link I'm using:
> >> 
> >> [[./templates][Templates]]
> 
> I have similar issue with `[[file:/path/file.hs][name]]`
> `M-x org-open-at-point` says:
> "Running less /home/path/file.hs"
> In terminal:
> `mimetype /home/path/file.hs` => `text/x-haskell`
> 
> ```
> org-file-apps is a variable defined in ‘org.el’.
> Its value is
> ((auto-mode . emacs)
>  (directory . emacs)
>  ("\\.mm\\'" . default)
>  ("\\.x?html?\\'" . default)
>  ("\\.pdf\\'" . default))
> ```
> 
> I guess I can configure it alright, but I have no idea why it is invoking
> `less` in the first place. I also have no idea where the output of `less`
> should be found.
> 
> `org-version` => 9.5.2
> `emacs-version` => 29.0.50

Using `https://list.orgmode.org/87y2pbv4pw@kyleam.com/T/[1]`, I've guessed 
that 
`(straight-use-package 'haskell-mode)` should fix it, and it did.

> 
> Thanks,
> Chris
> 
> > You can try adding (directory . emacs) to `org-file-apps' in your
> > configuration like this:
> > 
> > (setq org-file-apps
> > 
> >   '((auto-mode . emacs)
> >   
> > (directory . emacs)
> > 
> > ("\\.mm\\'" . default)
> > ("\\.x?html?\\'" . default)
> > ("\\.pdf\\'" . default)))
> > 
> > A bug related to mailcap handling has been fixed in Emacs 27,
> > perhaps this is what caused the change in your setup.  I added
> > (directory . emacs) in `org-file-apps' by default in the master
> > branch.
> > 
> > Thanks for reporting this,




[1] https://list.orgmode.org/87y2pbv4pw@kyleam.com/T/


`M-x org-open-at-point` on `[[file:/path/file.hs][name]]` says: "Running less /home/path/file.hs"

2022-04-06 Thread chris
[was: Issue with internal directory links]

> 
> Hi Jonathan,
> 
> Jonathan Fox  writes:
> 
>> Here's a link I'm using:
>>
>> [[./templates][Templates]]
> 

I have similar issue with `[[file:/path/file.hs][name]]`
`M-x org-open-at-point` says:
"Running less /home/path/file.hs"
In terminal:
`mimetype /home/path/file.hs` => `text/x-haskell`

```
org-file-apps is a variable defined in ‘org.el’.
Its value is
((auto-mode . emacs)
 (directory . emacs)
 ("\\.mm\\'" . default)
 ("\\.x?html?\\'" . default)
 ("\\.pdf\\'" . default))
```

I guess I can configure it alright, but I have no idea why it is invoking 
`less` in the first 
place. I also have no idea where the output of `less` should be found.

`org-version` => 9.5.2
`emacs-version` => 29.0.50

Thanks,
Chris


> You can try adding (directory . emacs) to `org-file-apps' in your
> configuration like this:
> 
> (setq org-file-apps
>   '((auto-mode . emacs)
>   (directory . emacs)
>   ("\\.mm\\'" . default)
>   ("\\.x?html?\\'" . default)
>   ("\\.pdf\\'" . default)))
> 
> A bug related to mailcap handling has been fixed in Emacs 27,
> perhaps this is what caused the change in your setup.  I added
> (directory . emacs) in `org-file-apps' by default in the master
> branch.
> 
> Thanks for reporting this,
> 
> -- 
>  Bastien



Re: citations: org-cite vs org-ref 3.0

2022-03-20 Thread chris
On Sunday, 20 March 2022 20:44:50 CET Bruce D'Arcus wrote:
> On Sun, Mar 20, 2022 at 9:42 AM Ihor Radchenko  wrote:
> > For citar, why not simply using ivy-bibtex? It supports org-cite, AFAIK.
> 
> Not really; or rather minimally.

I use `org-cite` with a very minimal configuration, and it works very well. I 
don't use `ivy` at all. I don't use `helm` at all. Those are very large 
framework and should not be forced to people. (I don't use `org-ref`.)

I only use `citar` with minimal configuration. I use `vertico` for the 
completion. `citar` is simple enough for me to be able to read and understand 
a large part of it.

IMO the more layers of code there are, the more difficult it is to have things 
work right. And similarly with the size of the code.

Chris

> 
> Ivy-bibtex supports, for example, inserting of org-cite citations, but
> not via org-cite-insert.

And I have `org-cite-insert` working straight out of the box.

> 
> So there are currently no org-cite processors for ivy-bibtex etc.
> 
> Bruce







Re: Using backticks for the inline code delimeter?

2022-03-18 Thread chris
("/" italic)
 ("_" underline)
 ("=" org-verbatim verbatim)
 ("`" org-code verbatim)
 ("~" org-code verbatim)
 ("+" (:strike-through t)
#+end_src

Just before:

#+begin_src emacs-lisp
  (straight-use-package 'org)
#+end_src

And it seems it works.

I've tried the "cosmetic" version from bellow, but it wasn't working so well, 
with either `visual-fill-colum` or `org-indent-mode`?
Well, it wasn't working well. I don't know if the hack above is playing more 
nicely. Because I've only tested it on one example.
Chris

>
> For the cosmetic part, there's this  piece of code from
> https://archive.casouri.cat/note/2020/better-looking-verbatim-markup-in-org-mode/index.html
> that displays org's `=` and `~` markers as ```.
>
> --
> Sébastien Miquel







Re: Using backticks for the inline code delimeter?

2022-03-18 Thread chris
> George Mauer writes:
>> is there a straightforward way to extend the org parser to do this?
> I don't think so. It seems the emphasis markers are hard-coded
> in various places.
>
> From a quick look at the code, you'd have to customize
> `org-emphasis-alist` and redefine `org-set-emph-re`  and
> `org-do-emphasis-faces`. Maybe that'd be enough.
>

I did just what you said, and I've inserted what's bellow, somewhere in my 
`init.org` / 
`init.el`, before anything `org-mode` related (save for two `hook`):
(Note it is an almost exact copy from `org.el`, I've only changed a few 
characters. And 
added the `advice-add override`.)

#+begin_src emacs-lisp
  (defun org-set-emph-re-fixed (var val)
"Set variable and compute the emphasis regular expression."
(set var val)
(when (and (boundp 'org-emphasis-alist)
   (boundp 'org-emphasis-regexp-components)
   org-emphasis-alist org-emphasis-regexp-components)
  (pcase-let*
  ((`(,pre ,post ,border ,body ,nl) org-emphasis-regexp-components)
   (body (if (<= nl 0) body
   (format "%s*?\\(?:\n%s*?\\)\\{0,%d\\}" body body nl)))
   (template
(format (concat "\\([%s]\\|^\\)" ;before markers
"\\(\\([%%s]\\)\\([^%s]\\|[^%s]%s[^%s]\\)\\3\\)"
"\\([%s]\\|$\\)") ;after markers
pre border border body border post)))
(setq org-emph-re (format template "*/_+"))
(setq org-verbatim-re (format template "=~`")

  (advice-add 'org-set-emph-re :override #'org-set-emph-re-fixed)
#+end_src

#+begin_src emacs-lisp
  (defun org-do-emphasis-faces-fixed (limit)
"Run through the buffer and emphasize strings."
(let ((quick-re (format "\\([%s]\\|^\\)\\([~`=*/_+]\\)"
(car org-emphasis-regexp-components
  (catch :exit
(while (re-search-forward quick-re limit t)
  (let* ((marker (match-string 2))
 (verbatim? (member marker '("~" "`" "="
(when (save-excursion
(goto-char (match-beginning 0))
(and
 ;; Do not match table hlines.
 (not (and (equal marker "+")
   (org-match-line
"[ \t]*\\(|[-+]+|?\\|\\+[-+]+\\+\\)[ \t]*$")))
 ;; Do not match headline stars.  Do not consider
 ;; stars of a headline as closing marker for bold
 ;; markup either.
 (not (and (equal marker "*")
   (save-excursion
 (forward-char)
 (skip-chars-backward "*")
 (looking-at-p org-outline-regexp-bol
 ;; Match full emphasis markup regexp.
 (looking-at (if verbatim? org-verbatim-re org-emph-re))
 ;; Do not span over paragraph boundaries.
 (not (string-match-p org-element-paragraph-separate
  (match-string 2)))
 ;; Do not span over cells in table rows.
 (not (and (save-match-data (org-match-line "[ \t]*|"))
   (string-match-p "|" (match-string 4))
  (pcase-let ((`(,_ ,face ,_) (assoc marker org-emphasis-alist))
  (m (if org-hide-emphasis-markers 4 2)))
(font-lock-prepend-text-property
 (match-beginning m) (match-end m) 'face face)
(when verbatim?
  (org-remove-flyspell-overlays-in
   (match-beginning 0) (match-end 0))
  (remove-text-properties (match-beginning 2) (match-end 2)
  '(display t invisible t intangible 
t)))
(add-text-properties (match-beginning 2) (match-end 2)
 '(font-lock-multiline t org-emphasis t))
(when (and org-hide-emphasis-markers
   (not (org-at-comment-p)))
  (add-text-properties (match-end 4) (match-beginning 5)
   '(invisible t))
  (add-text-properties (match-beginning 3) (match-end 3)
   '(invisible t)))
(throw :exit t


Re: ox-publish: Some starting problems

2022-03-11 Thread chris
Hi Christian,
I've received the following in my personal email box, and I think it is related 
to this thread, 
so I paste it here:
On Thursday, 10 March 2022 06:54:22 CET c.bu...@posteo.jp wrote:
> Hello together,
> 
> I do not understand all details. But it seems to me that currently
> ox-publish is not fully capable to generate a linked together HTML
> files out of org-roam-v2 generated org files because of the ID-linking
> of org-roam-v2.
> 
> In my tests it sometimes work and sometimes not. I was not able to
> reproduce this. While writing to the list about that problem I was
> pointed to that bug report here.
> 
> Kind
> Christian
And I think that I understand the question, and the general setting related to 
it.

So, on the one hand you have `org-mode/org-id` links like 
`[[id:32ba80a3-1982-4f43-becb-
b0e346a91b0d][hello]]`, which seem the thing to do in the 21st century, the 
most sensible 
thing to do IMO, I only use those, `org-roam` only use those.

When with `emacs` the links are followed/resolved through a database. For 
example, the 
database can be updated through functions like `org-id-update-id-locations`, 
part of 
https://github.com/tkf/org-mode/blob/master/lisp/org-id.el[1].

However the use of them is controversial because some deem them as not human 
friendly 
enough. So I suppose guidelines should be defined for anything to happen, but 
I'm not 
sure people would agree on what to do. And internal ID links, resolved locally 
through 
reading in a database, should be thoroughly translated to something accurate 
and 
consistent at export-time, and that seems a lot.

I myself use `org-roam` and `ID`; considering the difficulties of exporting to 
html through 
emacs/org-mode, I just gave up.
Thanks,
Chris
PS: I think you are doing an awesome job at trying to have all that working.


On Wednesday, 9 March 2022 17:39:46 CET c.bu...@posteo.jp wrote:
> Dear Max,
> 
> thank's a lot for your help and your patience with a newbie.
> 
> Am 09.03.2022 16:32 schrieb Max Nikulin:
> >> 3.
> >> I use (setq org-export-with-broken-links t) with and without
> >> ":with-broken-links "mark"" to prevend ox-publish stopping when there
> >> are broken links. I swear and I also checked that there are only a few
> >> of them. But in the HTML output all links are gone. No links. No text
> >> for the links.
> > 
> > If you insist on setq than try
> > 
> >(setq org-export-with-broken-links 'mark)
> > 
> > without :with-broken-links. You can get correct value using easy
> > customization interface. It does not matter for
> > `org-export-with-broken-links', but some custom variables have :set
> > property, so the following may be generally better
> > 
> >(custom-set-variables
> >
> > '(org-export-with-broken-links 'mark))
> 
> Do you mean that (setq org-export-with-broken-links 'mark) is the same
> as :with-broken-links mark? This are just two different ways to set the
> same thing?
> How do I know as a newbie? ;)
> 
> Why using custom-set variables here? Is there something wrong with just
> doing
> (org-export-with-broken-links t)
> ?
> 
> >> I tried to reproduce this in a minimal example with two new nodes. But
> >> for them the links are generated.
> > 
> > It seems, changing project options or global variables does not lead
> > to updating of the files if the sources have not modified.
> 
> I do not understand. Do you a see a solution for the problem?
> 
> > There is a known problem with id links. They may be broken if they
> > lead to another file:
> > inkbottle. org-id with ox-html. Sat, 14 Aug 2021 00:28:35 +0200
> > https://list.orgmode.org/4617246.m1MCmUpgFQ@pluto/

Re: cut and paste not working after xdg-open "org-protocol://store-link?url=URL=TITLE"

2022-01-31 Thread chris
(previous email has been truncated? resending)

On Monday, 31 January 2022 17:29:28 CET Max Nikulin wrote:
> On 31/01/2022 08:14, Ihor Radchenko wrote:
> > chris writes:
> > 
> > I am not using Wayland. However, if I just do (kill-new "test") in X and
> > my select-enable-primary is nil (default) - "test" will not go to my X
> > clipboard. It is the default behaviour of Emacs in X that has nothing to
> > do with Org mode.

This quote above is not from me (Chris), I think it's from Ihor, I just say 
that to try not to add to confusion ;)
I myself, am using Wayland.

> Ihor, please, do not add more confusion to this obscure issue.
> `select-enable-primary' controls PRIMARY selection, not CLIPBOARD.
> `select-enable-clipboard' is an independent variable.
> 
> Chris, did you tune clipboard manager in KDE? This kind of software may
> cause quite peculiar behavior...

So, on debian/sid/kde/wayland, I've clicked on "configure clipboard" in the 
default plasma panel:
I can see "ignore selection" is selected. I don't like "primary selection", I 
think it's messy.

> 
> So, do not confuse PRIMARY selection and CLIPBOARD. Unlike MS Windows,
> X11 has several selection (and legacy cut buffers). I do not know the
> full story, but it seems that wayland developers decided that it is more
> secure to have just clipboard, but they did not sustain pressure of
> users who really like that "hard to discover feature": just select some
> text with mouse without additional hotkeys and paste it using middle click.

Yes, you inadvertently select text, and inadvertently paste it: that's legacy 
for you.

Well, look at that: 
https://bugs.kde.org/show_bug.cgi?id=441668
"Recently middle-click pasting got implemented for the Wayland platform. 
However, this feature could be regarded as an annoyance due to the risk of 
inadvertent pasting.", etc.

So "selection ignored by the clipboard" according to kwin/wayland seems to 
mean "user can't see it when they look in the clipboard"
But it's fully working all right and you just can't disable it.
Awesome.

So yeah, debian-sid-kde-plasma-wayland:
There is both "primary selection"  and "clipboard" and you just can't disable 
"primary selection".

At least according to the above kde bug report.

> 
> Ububntu-21.10 impish, gnome, wayland, Emacs-27.1. I am aware that KDE
> may have rather different implementation related to wayland protocol and
> something may change in Emacs since the released version. I just have VM
> with such configuration.
> 
> New session, empty selection and clipboard:
> $ wl-paste --list-types
> No selection
> $ wl-paste --primary --list-types
> No selection
> 
> Select a word in terminal using mouse:
> $ wl-paste --primary --list-types
> text/plain
> text/plain;charset=utf-8
> STRING
> TEXT
> COMPOUND_TEXT
> UTF8_STRING
> $ wl-paste --list-types
> No selection
> 
> [Ctrl+Shift+V] to copy selection to clipboard
> $ wl-paste --primary --list-types
> text/plain
> text/plain;charset=utf-8
> STRING
> TEXT
> COMPOUND_TEXT
> UTF8_STRING
> $ wl-paste --list-types
> text/plain
> text/plain;charset=utf-8
> STRING
> TEXT
> COMPOUND_TEXT
> UTF8_STRING
> 
> Let's copy some text from Firefox and then select another text
> but do not copy it:
> $ wl-paste
> Copy from Firefox
> $ wl-paste --primary
> Just select in Firefox
> 
> So paste and insert using middle click are not synchronized now.
> 
> Execute the following in Emacs:
> (kill-new "kill-new from Emacs")

Okay, at this point, we have seen, from the kde bug above (https://
bugs.kde.org/show_bug.cgi?id=441668), that things are a little bit in a mess, 
right now.

So when I use `wl-paste`, `wl-paste --primary`, `wl-paste --list-types`, `wl-
paste --primary --list-types`, I've got results whose logic is following the 
logic of your examples, with "primary selection" and "clipboard" living their 
separated lives, and not being synchronized, etc.

But when I use `(kill-new "kill-new from Emacs")`, I've got results "way 
superior to yours".

On the one hand, if I do:
`~/path/emacsclient --create-frame --altern
ate-editor=""`
Then go to `*scratch*`
Then `(kill-new "kill-new from Emacs")`
Then `C-y` gives `kill-new from Emacs`, and,
$ wl-paste 
kill-new from Emacs 
$ wl-paste --primary 
(kill-new "kill-new from Emacs")

On the other hand, if I do `~/path/emacsclient -e "(kill-new \"test523
\")"`, I get:
$ wl-paste --primary; wl-paste 
emacsclient -e "(kill-new \"test523\")" 
emacsclient -e "(kill-new \"test523\")"
And if I go to the emacsclient actual fram

Re: cut and paste not working after xdg-open "org-protocol://store-link?url=URL=TITLE"

2022-01-31 Thread chris
On Monday, 31 January 2022 17:29:28 CET Max Nikulin wrote:
> On 31/01/2022 08:14, Ihor Radchenko wrote:
> > chris writes:
> > 
> > I am not using Wayland. However, if I just do (kill-new "test") in X and
> > my select-enable-primary is nil (default) - "test" will not go to my X
> > clipboard. It is the default behaviour of Emacs in X that has nothing to
> > do with Org mode.

This quote above is not from me (Chris), I think it's from Ihor, I just say 
that to try not to 
add to confusion ;)
I myself, am using Wayland.

> Ihor, please, do not add more confusion to this obscure issue.
> `select-enable-primary' controls PRIMARY selection, not CLIPBOARD.
> `select-enable-clipboard' is an independent variable.
> 
> Chris, did you tune clipboard manager in KDE? This kind of software may
> cause quite peculiar behavior...

So, on debian/sid/kde/wayland, I've clicked on "configure clipboard" in the 
default plasma 
panel:
I can see "ignore selection" is selected. I don't like "primary selection", I 
think it's messy.

> 
> So, do not confuse PRIMARY selection and CLIPBOARD. Unlike MS Windows,
> X11 has several selection (and legacy cut buffers). I do not know the
> full story, but it seems that wayland developers decided that it is more
> secure to have just clipboard, but they did not sustain pressure of
> users who really like that "hard to discover feature": just select some
> text with mouse without additional hotkeys and paste it using middle click.

Yes, you inadvertently select text, and inadvertently paste it: that's legacy 
for you.

Well, look at that: 
https://bugs.kde.org/show_bug.cgi?id=441668[1]
"Recently middle-click pasting got implemented for the Wayland platform. 
However, this 
feature could be regarded as an annoyance due to the risk of inadvertent 
pasting.", etc.

So "selection ignored by the clipboard" according to kwin/wayland seems to mean 
"user 
can't see it when they look in the clipboard"
But it's fully working all right and you just can't disable it.
Awesome.

So yeah, debian-sid-kde-plasma-wayland:
There is both "primary selection"  and "clipboard" and you just can't disable 
"primary 
selection".

At least according to the above kde bug report.

> 
> Ububntu-21.10 impish, gnome, wayland, Emacs-27.1. I am aware that KDE
> may have rather different implementation related to wayland protocol and
> something may change in Emacs since the released version. I just have VM
> with such configuration.
> 
> New session, empty selection and clipboard:
> $ wl-paste --list-types
> No selection
> $ wl-paste --primary --list-types
> No selection
> 
> Select a word in terminal using mouse:
> $ wl-paste --primary --list-types
> text/plain
> text/plain;charset=utf-8
> STRING
> TEXT
> COMPOUND_TEXT
> UTF8_STRING
> $ wl-paste --list-types
> No selection
> 
> [Ctrl+Shift+V] to copy selection to clipboard
> $ wl-paste --primary --list-types
> text/plain
> text/plain;charset=utf-8
> STRING
> TEXT
> COMPOUND_TEXT
> UTF8_STRING
> $ wl-paste --list-types
> text/plain
> text/plain;charset=utf-8
> STRING
> TEXT
> COMPOUND_TEXT
> UTF8_STRING

Re: looking for examples of `org-capture-templates` working with `org-protocol://capture`

2022-01-30 Thread chris
On Monday, 31 January 2022 04:07:01 CET chris wrote:
> On Monday, 31 January 2022 03:30:41 CET chris wrote:
> > Hi,
> > When you do
> > `emacsclient "org-protocol://capture?
> > template=X=URL=TITLE=BODY"`
> > I don't understand at all how you make use of `url` `title` and `body` in
> > `org- capture-template`.
> > I understand there is some sort of "encoding" that doesn't make use of the
> > keywords `url` `title` or `body`, but it's dense.
> > There are no indications of how to do that here:
> > https://orgmode.org/manual/The-capture-protocol.html[1]
> > I haven't found any example that I've been able to reproduce in the whole
> > web. I've spent hours on the documentation and the source code of
> > https://github.com/emacs-mirror/emacs/blob/master/lisp/org/org-protocol.el
> > [2 ] And I have absolutely no idea of how to use `url` `title` and `body`
> > in `org-capture- template`.
> 
> The last example in https://blog.jethro.dev/posts/capturing_inbox/[1],
> namely: ```emacs-lisp
> (setq org-capture-templates
>   `(("l" "org-protocol-capture" entry
>  (file "~/path/inbox.org")
> "* TODO [[%:link][%:description]]\n\n %i"
> 
> :immediate-finish t)))
> 
> ```
> Seems to work consistently with:
> `xdg-open "org-protocol://capture?template=l=URL$(date
> --iso-8601=s)=TITLE$ (date --iso-86
> 01=s)=BODY$(date --iso-8601=s)"`
> 
> 
> Provided I have opened at least one org buffer before hand, otherwise it
> opens a buffer named
> `"org-protocol://capture?template=l=URL=TITLE=BODY" ` at
> what point it can get messy. Probably I have to "start" somehow "org-mode"
> first, and it doesn't get enough started from my `init.el`.
> 

So, reverse-engineering the example I've eventually found the relevant points 
of the 
documentation:

https://orgmode.org/worg/org-contrib/org-protocol.html[1]
%i'
will be replaced by the selected text in your browser window if any.
In addition, you may use the following placeholders in your template:
Placeholders Replacement
%:link URL of the web-page
%:description The title of the web-page
%:initial Selected text.


https://orgmode.org/manual/Template-expansion.html[2]

So, not so many examples, that's all.

So I've rewritten Jethro's example using `%:initial` because it's easier to 
read:


```emacs-lisp
(setq org-capture-templates
  `(("l" "org-protocol-capture" entry
 (file "~/path/inbox.org")
"* TODO [[%:link][%:description]]\n\n %:initial"
:immediate-finish t)))
```

> 
> Goal is to have the capturing work in the background, with emacs started as
> a daemon, but with no opened emacsclient frame:
> capture, simply, silently, unobtrusively.
> 
> > Chris
> > 
> > 
> > [1] https://orgmode.org/manual/The-capture-protocol.html
> > [2]
> > https://github.com/emacs-mirror/emacs/blob/master/lisp/org/org-protocol.el
> 
> 
> [1] https://blog.jethro.dev/posts/capturing_inbox/




[1] https://orgmode.org/worg/org-contrib/org-protocol.html

Re: cut and paste not working after xdg-open "org-protocol://store-link?url=URL=TITLE"

2022-01-30 Thread chris
On Monday, 31 January 2022 04:49:59 CET chris wrote:
> On Monday, 31 January 2022 04:43:34 CET chris wrote:
> > On Monday, 31 January 2022 04:28:06 CET Ihor Radchenko wrote:
> > > chris  writes:
> > > >> What will happen if you try (kill-new "something") in your Emacs
> > > >> (preferably, emacs -Q)? Will "something" be present in your Wayland
> > > >> clipboard?
> > > > 
> > > > emacs -Q, then `M-: (kill-new "something")`
> > > > Then `C-y` in `*scratch*`, string "something" is pasted.
> > > > Then go to terminal (Konsole, specifically), `C-S-v`, string
> > > > "something"
> > > > is
> > > > pasted, too.
> > > 
> > > Got it. What about emacsclient -e "(kill-new \"test123\")"?
> > 
> > `~/path-to-emacs/lib-src/emacsclient -e "(kill-new \"test123
> > \")"`
> > 
> > Emacs side, `C-y` => "test123"
> > 
> > Terminal side, `C-S-v` => no trace of the "test123" string.
> 
> My, I missed one pivotal point:
> Right after that operation, I cannot cut and paste straight away from
> terminal to emacs.
> If I copy and paste some string "test567" from terminal to Firefox or
> whatever, it is working fine, but `C-y` in emacs is still "test123".
> 

Also, right now, emacs kill-ring is not very big, less than 10 items, so I can 
see all of them using `M-y`, and the most recent one, after several cut-and-
paste operations none of them emacs related, is still "test123".

And so now I do the converse operation and that works, and after that copying 
from terminal to emacs works again.

Bottom line, it seems org-mode independent.

> > (note that I don't have emacs system wide, only the emacs 29.0.50 build
> > from source, so there can be no conflict between two emacs)
> > 
> > > > Also, I understand your point, but the fact that the copying is
> > > > working
> > > > or
> > > > not working, in that direction, specifically, after using `xdg-open
> > > > "org-
> > > > protocol://store-link?url=URL=TITLE"`, etc...
> > > > Is really a detail in what is hindering the workflow there.
> > > 
> > > It seems that you don't (: To clarify, I am not trying to find a
> > > workaround for you yet, but trying to figure out if what you observe is
> > > a Emacs bug, an Org mode bug, or not bug at all.
> > 
> > Yeah, sorry about that.
> > 
> > > Best,
> > > Ihor







Re: cut and paste not working after xdg-open "org-protocol://store-link?url=URL=TITLE"

2022-01-30 Thread chris
On Monday, 31 January 2022 04:43:34 CET chris wrote:
> On Monday, 31 January 2022 04:28:06 CET Ihor Radchenko wrote:
> > chris  writes:
> > >> What will happen if you try (kill-new "something") in your Emacs
> > >> (preferably, emacs -Q)? Will "something" be present in your Wayland
> > >> clipboard?
> > > 
> > > emacs -Q, then `M-: (kill-new "something")`
> > > Then `C-y` in `*scratch*`, string "something" is pasted.
> > > Then go to terminal (Konsole, specifically), `C-S-v`, string "something"
> > > is
> > > pasted, too.
> > 
> > Got it. What about emacsclient -e "(kill-new \"test123\")"?
> 
> `~/path-to-emacs/lib-src/emacsclient -e "(kill-new \"test123
> \")"`
> 
> Emacs side, `C-y` => "test123"
> 
> Terminal side, `C-S-v` => no trace of the "test123" string.

My, I missed one pivotal point:
Right after that operation, I cannot cut and paste straight away from terminal 
to emacs.
If I copy and paste some string "test567" from terminal to Firefox or 
whatever, it is working fine, but `C-y` in emacs is still "test123".

> 
> (note that I don't have emacs system wide, only the emacs 29.0.50 build from
> source, so there can be no conflict between two emacs)
> 
> > > Also, I understand your point, but the fact that the copying is working
> > > or
> > > not working, in that direction, specifically, after using `xdg-open
> > > "org-
> > > protocol://store-link?url=URL=TITLE"`, etc...
> > > Is really a detail in what is hindering the workflow there.
> > 
> > It seems that you don't (: To clarify, I am not trying to find a
> > workaround for you yet, but trying to figure out if what you observe is
> > a Emacs bug, an Org mode bug, or not bug at all.
> 
> Yeah, sorry about that.
> 
> > Best,
> > Ihor







Re: cut and paste not working after xdg-open "org-protocol://store-link?url=URL=TITLE"

2022-01-30 Thread chris
On Monday, 31 January 2022 04:28:06 CET Ihor Radchenko wrote:
> chris  writes:
> >> What will happen if you try (kill-new "something") in your Emacs
> >> (preferably, emacs -Q)? Will "something" be present in your Wayland
> >> clipboard?
> > 
> > emacs -Q, then `M-: (kill-new "something")`
> > Then `C-y` in `*scratch*`, string "something" is pasted.
> > Then go to terminal (Konsole, specifically), `C-S-v`, string "something"
> > is
> > pasted, too.
> 
> Got it. What about emacsclient -e "(kill-new \"test123\")"?

`~/path-to-emacs/lib-src/emacsclient -e "(kill-new \"test123
\")"`

Emacs side, `C-y` => "test123"

Terminal side, `C-S-v` => no trace of the "test123" string.

(note that I don't have emacs system wide, only the emacs 29.0.50 build from 
source, so 
there can be no conflict between two emacs)


> > Also, I understand your point, but the fact that the copying is working or
> > not working, in that direction, specifically, after using `xdg-open "org-
> > protocol://store-link?url=URL=TITLE"`, etc...
> > Is really a detail in what is hindering the workflow there.
> 
> It seems that you don't (: To clarify, I am not trying to find a
> workaround for you yet, but trying to figure out if what you observe is
> a Emacs bug, an Org mode bug, or not bug at all.

Yeah, sorry about that.

> 
> Best,
> Ihor




Re: looking for examples of `org-capture-templates` working with `org-protocol://capture`

2022-01-30 Thread chris
On Monday, 31 January 2022 03:30:41 CET chris wrote:
> Hi,
> When you do
> `emacsclient "org-protocol://capture?
> template=X=URL=TITLE=BODY"`
> I don't understand at all how you make use of `url` `title` and `body` in
> `org- capture-template`.
> I understand there is some sort of "encoding" that doesn't make use of the
> keywords `url` `title` or `body`, but it's dense.
> There are no indications of how to do that here:
> https://orgmode.org/manual/The-capture-protocol.html[1]
> I haven't found any example that I've been able to reproduce in the whole
> web. I've spent hours on the documentation and the source code of
> https://github.com/emacs-mirror/emacs/blob/master/lisp/org/org-protocol.el[2
> ] And I have absolutely no idea of how to use `url` `title` and `body` in
> `org-capture- template`.


The last example in https://blog.jethro.dev/posts/capturing_inbox/[1], namely:
```emacs-lisp
(setq org-capture-templates
  `(("l" "org-protocol-capture" entry
 (file "~/path/inbox.org")
"* TODO [[%:link][%:description]]\n\n %i"
:immediate-finish t)))
```
Seems to work consistently with:
`xdg-open "org-protocol://capture?template=l=URL$(date 
--iso-8601=s)=TITLE$
(date --iso-86
01=s)=BODY$(date --iso-8601=s)"`


Provided I have opened at least one org buffer before hand, otherwise it opens 
a buffer 
named `"org-protocol://capture?template=l=URL=TITLE=BODY"
` at what point it can get messy. Probably I have to "start" somehow "org-mode" 
first, and 
it doesn't get enough started from my `init.el`.


Goal is to have the capturing work in the background, with emacs started as a 
daemon, 
but with no opened emacsclient frame:
capture, simply, silently, unobtrusively.


> Chris
> 
> 
> [1] https://orgmode.org/manual/The-capture-protocol.html
> [2]
> https://github.com/emacs-mirror/emacs/blob/master/lisp/org/org-protocol.el


[1] https://blog.jethro.dev/posts/capturing_inbox/


looking for examples of `org-capture-templates` working with `org-protocol://capture`

2022-01-30 Thread chris
Hi,
When you do 
`emacsclient "org-protocol://capture?
template=X=URL=TITLE=BODY"`
I don't understand at all how you make use of `url` `title` and `body` in `org-
capture-template`.
I understand there is some sort of "encoding" that doesn't make use of the 
keywords 
`url` `title` or `body`, but it's dense.
There are no indications of how to do that here:
https://orgmode.org/manual/The-capture-protocol.html[1]
I haven't found any example that I've been able to reproduce in the whole web.
I've spent hours on the documentation and the source code of
https://github.com/emacs-mirror/emacs/blob/master/lisp/org/org-protocol.el[2]
And I have absolutely no idea of how to use `url` `title` and `body` in 
`org-capture-
template`.
Chris


[1] https://orgmode.org/manual/The-capture-protocol.html
[2] https://github.com/emacs-mirror/emacs/blob/master/lisp/org/org-protocol.el


Re: cut and paste not working after xdg-open "org-protocol://store-link?url=URL=TITLE"

2022-01-30 Thread chris
On Monday, 31 January 2022 02:14:34 CET Ihor Radchenko wrote:
> chris  writes:
> > After doing `xdg-open "org-protocol://store-link?url=URL=TITLE"`.
> > The string "URL" is pushed into Emacs kill-ring.
> > But, this very string "URL", is not inserted into Wayland clipboard.
> 
> I am not using Wayland. However, if I just do (kill-new "test") in X and
> my select-enable-primary is nil (default) - "test" will not go to my X
> clipboard. It is the default behaviour of Emacs in X that has nothing to
> do with Org mode.
> 
> What will happen if you try (kill-new "something") in your Emacs
> (preferably, emacs -Q)? Will "something" be present in your Wayland
> clipboard?

emacs -Q, then `M-: (kill-new "something")`
Then `C-y` in `*scratch*`, string "something" is pasted.
Then go to terminal (Konsole, specifically), `C-S-v`, string "something" is 
pasted, too.

Also, I understand your point, but the fact that the copying is working or not 
working, in that direction, specifically, after using `xdg-open "org-
protocol://store-link?url=URL=TITLE"`, etc...
Is really a detail in what is hindering the workflow there. What is hindering 
the workflow is that the cut and past in the opposite direction, namely from 
the terminal to emacs, stops working from that point onward.
And that is really cumbersome.
And again, at that point the only workaround I've found to have the cut and 
past from terminal to emacs working again, is to perform one operation of 
copying from emacs to the terminal.
If ever I omit that workaround step, next time I'll copy something from the 
terminal to emacs, it will end up in pasting the string that has been 
initially inserted into the kill-ring by `xdg-open "org-protocol://store-link?
url=URL=TITLE"` possibly hours before, so to speak.

And no, even though `M-: (kill-new "something")` is putting "something" in 
both kill-ring and wayland-clipboard as stated above, `xdg-open "org-
protocol://store-link?url=URL=TITLE"`, is only putting "URL" in the 
kill-ring, or so I have observe to the best of my knowledge: and it is not the 
issue in my workflow, only an observation I've made.

> 
> Best,
> Ihor







Re: cut and paste not working after xdg-open "org-protocol://store-link?url=URL=TITLE"

2022-01-30 Thread chris
On Sunday, 30 January 2022 04:36:01 CET Ihor Radchenko wrote:
> chris  writes:
> > 3- if you do `C-y` you can see the URL is in the kill-ring
> > But obviously there is no reason for this URL to be also in the Wayland
> > (or
> > x11) clipboard? (there is no law of nature saying that what is in emacs
> > kill- ring must necessarily also be in wayland clipboard. I think there
> > is a law of nature for the other way around though)
> > In any case, in the case of Kde/Kwin/Wayland, it is not copied in the
> > Wayland clipboard.
> > Maybe it's in the description of org-protocol/store-link that the URL
> > should be copied in emacs kill-ring, in any case, it is.
> > But no it doesn't show in the kde/wayland clipboard (and why would it).
> 
> I am not 100% sure if I understand your message clearly. However, just
> letting you know about existence of the following Emacs customisations:

It is, only, in conjunction with `org-protocol`, that kill-ring and 
Wayland-clipboard get out 
of sync.

Not in some general case. General case is fine.

But in the case of org-protocol, as described in the original post and not 
present in the 
excerpt you quoted, they do get out of sync.

To summarize again there are two things that are happening:

After doing `xdg-open "org-protocol://store-link?url=URL=TITLE"`.
The string "URL" is pushed into Emacs kill-ring.
But, this very string "URL", is not inserted into Wayland clipboard.

That was the first thing, string pushed into kill-ring, but not pushed 
simultaneously, into 
Wayland clipboard.

Now second thing: from that point onward, the other way around is broken. (And 
that is 
the part that is really annoying.)

[Then] I mouse-select a string in Firefox, or any application not Emacs. I 
verify the string is 
indeed in Wayland clipboard, I paste it in Firefox, or in the terminal (not 
Emacs).

Now I do `C-y`: this later string is not pasted, even though it should have 
been. I do `M-y` 
to see if I can find the string in the kill-ring: I can't find the string in 
the kill-ring.

What, instead, is the string at the top of Emacs kill-ring: the string "URL" 
(from the initial 
org-protocol action).

So Emacs has now stopped inserting strings from Wayland-clipboard into Emacs 
kill-ring.

No matter how hard I try.

The labor-intensive workaround:

Now what I do is copy a string inside Emacs using `C-w`.

Then, I verify if I can past it in Firefox: I can. It really is in Wayland 
clipboard.

Now I copy a string from Firefox into Emacs: it is not broken anymore, until 
the next time I 
use org-protocol, at which point it gets broken again.

And now it really is also present in Emacs kill-ring.

> save-interprogram-paste-before-kill:
> Whether to save existing clipboard text into kill ring before
> replacing it. select-enable-primary:
> Non-nil means cutting and pasting uses the primary selection.
> 
> Best,
> Ihor




Re: cut and paste not working after xdg-open "org-protocol://store-link?url=URL=TITLE"

2022-01-29 Thread chris
On Friday, 28 January 2022 13:40:45 CET Max Nikulin wrote:
> On 27/01/2022 07:03, chris wrote:
> > First: `xdg-open "org-protocol://store-link?url=URL=TITLE"` from a
> > terminal.
> > Then `M-x org-insert-link` in emacs, or not (it makes no difference).
> > Then cut-and-paste from non-emacs-application (e.g., Kde's Konsole, or
> > Firefox) to emacs.
> > When doing `C-y` what it pastes is "URL", not what I have copied from
> > Firefox.
> 
> Just a data point: I can not reproduce it with X11, emacs-26.3, and Org
> from git main HEAD. Maybe I will try with emacs-27 and Wayland in a few
> days.
> 
> emacs -Q -L ~/src/org-mode/lisp/ \
>-l org-protocol --eval '(server-start)' test.org
> emacsclient 'org-protocol:/store-link?url=http://o.rg/=Tt1'
> copy from firefox
> C-y (org-yank) in Emacs pastes text that I copied from firefox.
> 
> In some aspects your problem looks similar to:
> 
> Max Nikulin. [PATCH] [BUG] org.el: Fix first call of `org-paste-subtree'
> Mon, 29 Nov 2021 19:02:35 +0700.
> https://list.orgmode.org/so2fh1$10kj$1...@ciao.gmane.io

Yes, yes, possibly
Just something I've noticed, which is obvious, but I didn't thought about, and 
which has probably no bearing:
1- click on the bookmarklet
2- `C-c C-l Ret Ret` in an org-buffer, so the link is created (this step not 
necessary though)
3- if you do `C-y` you can see the URL is in the kill-ring
But obviously there is no reason for this URL to be also in the Wayland (or 
x11) clipboard? (there is no law of nature saying that what is in emacs kill-
ring must necessarily also be in wayland clipboard. I think there is a law of 
nature for the other way around though)
In any case, in the case of Kde/Kwin/Wayland, it is not copied in the Wayland 
clipboard.
Maybe it's in the description of org-protocol/store-link that the URL should 
be copied in emacs kill-ring, in any case, it is.
But no it doesn't show in the kde/wayland clipboard (and why would it).

> 
> > But why is there a `nil` here:
> > 
> > https://github.com/emacs-mirror/emacs/blob/19dcb237/lisp/org/org-protocol.
> > el#L467
> > <https://github.com/emacs-mirror/emacs/blob/19dcb237b5b02b36580294ab30912
> > 4f346a66024/lisp/org/org-protocol.el#L467>
> > 
> > And why is it working at all from `xdg-open
> > "org-protocol://store-link?url=URL=TITLE"`, with a `nil` in that
> > position?
> > 
> > Note: `(org-protocol-store-link "U/T")` works, `(org-protocol-store-link
> > "url=U=T")` doesn't work. Produces link `[[url=U=T]]`
> > instead of `[[U][T]]`.
> 
> What is the problem with nil there? New-style URIs are parsed before
> they are passed to subprotocol handlers. Why are you trying to call
> org-protocol-store-link directly?

Right, right, right
I was only trying to see if there was something obviously sticking out about 
the cut and paste issue.
So you say "new style URIs are parsed before they are passed to subprotocol 
handler": so, no worries then.
Thanks a lot for saying so. I've been searching but haven't found were they 
were parsed. I've probably haven't searched enough, and anyway it's of no 
bearing. Thanks again.





cut and paste not working after xdg-open "org-protocol://store-link?url=URL=TITLE"

2022-01-26 Thread chris
Hi people,


First: `xdg-open "org-protocol://store-link?url=URL=TITLE"` from a 
terminal.
Then `M-x org-insert-link` in emacs, or not (it makes no difference).
Then cut-and-paste from non-emacs-application (e.g., Kde's Konsole, or Firefox) 
to emacs.
When doing `C-y` what it pastes is "URL", not what I have copied from Firefox.
For it to work again: one cut-and-paste operation from emacs to emacs.
Then it works again until the next time.
Doing `C-k` is enough, but it's still cumbersome.


My compositor is Wayland. It was like this, before, with `emacs-pgtk` 28.0.50.
It is still like that with: GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, 
GTK+ Version 
3.24.31, cairo version 1.16.0) of 2022-01-26
System is debian sid upgraded just before.


Thanks,
Chris


PS: some XY-problem:
What sort of argument to pass to `org-protocol-store-link`.
When I do `(org-protocol-parse-parameters "url=U=T" t '(:url :title))` it 
works.
It works when I do `xdg-open "org-protocol://store-link?url=URL=TITLE"
` from a terminal.
But why is there a `nil` here:
https://github.com/emacs-mirror/emacs/blob/19dcb237/lisp/org/org-protocol.el#L467[1]
And why is it working at all from `xdg-open "org-protocol://store-link?
url=URL=TITLE"`, with a `nil` in that position?


Note: `(org-protocol-store-link "U/T")` works, `(org-protocol-store-link 
"url=U=T")` 
doesn't work. Produces link `[[url=U=T]]` instead of `[[U][T]]`.


[1] https://github.com/emacs-mirror/emacs/blob/
19dcb237b5b02b36580294ab309124f346a66024/lisp/org/org-protocol.el#L467


[BUG] Emacs tries to recenter / rescroll when it hits hidden org emphasis [9.4.6 (9.4.6-798-g738759.dirty-elpaplus @ .emacs.d/elpa/develop/org-plus-contrib-20210929/)]

2022-01-07 Thread Chris Findeisen
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.


To reproduce this:
1. Load the repro emacs settings.
2. Scroll down in a buffer, such that top of buffer is not visible on
screen.
3. Create an emphasized word at the beginning of the 2nd visual-line in a
visually-wrapped line.
4. Move your point to the start of that emphasized word

It's a little difficult to describe, so I'll give an example. Assume
that the visual-line wrapping is happening at the place indicated by
"$".


```
So, if this were one long line, then this is the first visual line,$
/whereas/ this is the second visual line in the paragraph, and you'd place$
point on the italicized "w" in the word "whereas". That triggers the bug.
```

What happens next is that emacs thinks the point is no longer on screen
and tries to scroll to fix that. Under vanilla emacs, it will just
recenter the point. This still is misbehaving but not terribly. However,
with
smooth-scrolling as mentioned above, the behavior is worse. The window
scrolls up and point jumps to the top of the window.

Reproed this with the following: emacs -Q
with the following:
```
(setq org-hide-emphasis-markers t)

(org-mode)
(visual-line-mode 1)

;; Without this, emacs will still show bug by calling recenter, but the
effect is particularly egregious with these settings (i.e. smooth scrolling)
(setq scroll-conservatively 101
  scroll-preserve-screen-position t
  scroll-margin 0)
```

Emacs  : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5,
cairo version 1.16.0)
 of 2021-02-09, modified by Debian
Package: Org mode version 9.4.6 (9.4.6-798-g738759.dirty-elpaplus @
.emacs.d/elpa/develop/org-plus-contrib-20210929/)


Re: org-tag-persistent-alist AND per-file dynamic tags

2021-11-28 Thread chris
On Saturday, 6 November 2021 10:10:55 CET Victor A. Stoichita wrote:
> Greetings to all,
> 
> Reading the manual about setting glopal/per-file tags [1], I wonder if
> it is possible to use org-tag-persistent-alist AND per-file
> dynamic tags.

I use footnote 53 from https://orgmode.org/manual/Setting-Tags.html[1].
I put my tags in `tags-file.org`, using `#+TAGS:`.
I've put the next two lines in `init.el`.

(setq org-agenda-files (list "~/path-to/tags-file.org")
 org-complete-tags-always-offer-all-agenda-tags t)

And I have completion on both the tags in `tags-file.org` and tags in the 
current buffer.
I don't use `org-tag-alist`, so the comments made in 
https://emacs.stackexchange.com/q/
69369#comment111307_69369[2], would not apply.

I use a script to collect the tags, based on Kitchin's 
https://stackoverflow.com/a/
27527252[3], and help from `#emacs`.
I use `with-temp-buffer` because otherwise all the files accessed by 
`org-map-entries` are 
showing when I do `C-x C-b` and I find it cumbersome.
The tags are sorted by frequency, which is not necessary here, but it's really 
nice.
I suppose you could put a `defun nice-function-name` on top of it, but so far, 
it's only a 
hack.
`~/path-to-directory` and `tags-file.org` should be tweaked to your needs. 
`default-
directory` can be used for the former, too.
(caveat: the script makes use of `-flatten`, `-map` and `-uniq, from `dash.el`. 
It also 
makes use of `mapcar` where `-map` would do, `seq-sort` where `-sort` would do, 
`seq-
reduce` where `-reduce` would do. Standard elisp has `flatten-tree`, for 
`-flatten`, 
`mapcar` for `-map`, `delete-dups` for `-uniq`. https://github.com/Droogans/
unmaintainable-code[4])

(let* ((dir "~/path-to-directory")
   (all-tags
(-flatten
 (-map
  (lambda (fpath)
(with-temp-buffer
  (insert-file-contents fpath)
  (org-mode)
  (org-map-entries
   (lambda ()
 (let ((tag-string (car (last (org-heading-components)
   (when tag-string
 (split-string tag-string ":" t nil nil)))
  (directory-files-recursively dir "^[^#].*org$")
  (let ((tags-count
 (cl-loop for tag in (-uniq all-tags)
  collect (cons tag (cl-count tag all-tags :test 'string=)
(let ((tags-list
   (mapcar 'car (seq-sort (lambda (a b) (< (cdr b) (cdr a))) 
tags-count
  (let ((tags-string
 (cl-reduce (lambda (a b) (concat a " " b)) tags-list)))
(let ((filled-tags-string
   (with-temp-buffer
 (setq fill-column 70
   fill-prefix "#+TAGS: ")
 (insert (concat "#+TAGS: " tags-string)) (fill-paragraph) 
(buffer-string
  (with-temp-file "tags-file.org" (insert filled-tags-string)))


> 
> When using org-set-tags-command, I’d like to select from a list
> comprising both:
> 1. the list of predefined tags in org-tag-persistent-alist
> 2. the list of all the tags that are already in use in the current
>buffer (some of which might not be in the persistent alist). I don’t
>want to use the #+TAGS keyword at file-level, just the list of tags
>already attached to some headline in the buffer.
> 
> The manual says:
> > If you have globally defined your preferred set of tags using the
> > variable org-tag-alist, but would like to use a dynamic tag list in
> > a specific file, add an empty ‘TAGS’ keyword to that file
> 
> And then it says:
> > If you have a preferred set of tags that you would like to use in every
> > file, in addition to those defined on a per-file basis by ‘TAGS’
> > keyword, then you may specify a list of tags with the variable
> > org-tag-persistent-alist.
> 
> I tried to combine both behaviors by putting an empty ’TAGS’ keyword at
> the top of my file. But this still only gives me the tags in
> org-tag-persistent-alist. What would be the best way to add to it for
> completion the tags already used in the buffer?
> 
> Regards,

Re: Internal link broken when publishing (was org-id with ox-html)

2021-09-20 Thread chris
On Monday, 20 September 2021 16:13:24 CEST Max Nikulin wrote:
> On 20/09/2021 07:05, chris wrote:
> > On Tuesday, 14 September 2021 18:33:43 CEST Max Nikulin wrote:
> >> As a kind of summary:
> >> 
> >> During publishing of a project
> >> - "id:" links to headings from the same file are exported as short
> >> generated anchors like #org032777e or as anchors to custom ids when the
> >> latter are available
> >> - "Search heading" links to other files are exported as short generated
> >> anchors or as custom ids.
> >> - "id:" links to headings in external files are exported as ID value
> >> with "ID-" prefix. These links are *broken* currently.
> > 
> > Thanks a lot.
> > Perfectly functional org-id links between two files are broken when
> > published to HTML.
> > I suppose a bug should be opened about that?
> > (I can do that in a few weeks.)
> 
> It is already tracked on https://updates.orgmode.org/ as
> "Inconsistent handling of id: links to other file during publish"

How awesome!






Re: Internal link broken when publishing (was org-id with ox-html)

2021-09-19 Thread chris
On Tuesday, 14 September 2021 18:33:43 CEST Max Nikulin wrote:
> As a kind of summary:
> 
> During publishing of a project
> - "id:" links to headings from the same file are exported as short
> generated anchors like #org032777e or as anchors to custom ids when the
> latter are available
> - "Search heading" links to other files are exported as short generated
> anchors or as custom ids.
> - "id:" links to headings in external files are exported as ID value
> with "ID-" prefix. These links are *broken* currently.

Thanks a lot.
Perfectly functional org-id links between two files are broken when published 
to HTML.
I suppose a bug should be opened about that?
(I can do that in a few weeks.)

CUSTOM_ID solution is not good because you have to specify what file the ID is 
in. With plain ID, you specifically do not have to specify in which file the ID 
is, and therefore you can freely move around entries with ID, even beyond the 
file boundary, without troubling yourself. Because there is some sort of 
database behind, taking care of it for you.

For the exporting, considering the "ID-db" must be queried, and a translation 
process must be applied, I don't think there should be any specifications about 
the way it is implemented.

> Expected behavior is the same style of anchors for particular heading, e.g.
> - value of custom_id property is used even for "id:" links
> - either value of id property or short generated anchor is used for
> links to a heading having id property (maybe it should be possible to
> customize preferred style) but the same for search heading text fuzzy
> links and "id:" links, internal and external ones.
> 
> I do not mind to have both anchors with value of id and custom_id
> properties if they are defined for a header.
> 
> My opinion is that value of id property should be used for heading
> anchor when available to guarantee stable links from other sites. I
> admit that default behavior may be short (perhaps unstable) anchors.
> 
> On 07/09/2021 22:46, chris wrote:
> > On Tuesday, 24 August 2021 17:23:24 CEST Maxim Nikulin wrote:
> >> On 23/08/2021 03:42, inkbottle wrote:
> >>   From my point of view it looks like a bug.
> >> 
> >> https://code.orgmode.org/bzg/org-mode/src/master/lisp/ox.el#L4381
> 
> ...
> 
> > I believe it's a bug, plain and simple.
> 
> I am afraid that its fix would not be so simple.
> 
> > With a unique org file, the `:ID: e54113f9-2ad7-4a86-94be-68ffc696de0b`
> > are
> > resolved to `orgfa9c151` consistently.
> 
> My opinion (in contradiction to Nicolas) is that anchors should be as
> stable as possible even in the absence of cross-references withing the
> document. It allows links from other sites to particular sections. That
> is why value of ID property is better than random anchor despite the
> former is longer.
> 
> > There is a patch here:
> > https://gist.github.com/jethrokuan/d6f80caaec7f49dedffac7c4fe41d132
> > but, as I understand it, the workaround consists in treating `:ID:`
> > similarly as `:CUSTOM_ID:`, that is, exporting them "verbatim".
> 
> If it were a patch, it would be easier to spot the changed part. This
> approach may be implemented in a bit cleaner way but I do not think that
> it will allow to use custom_id value for "id:" link if a heading has
> both (see `org-html-link' and `org-export-resolve-id-link').
> 
> >> checks for ID property.
> >> https://code.orgmode.org/bzg/org-mode/src/master/lisp/ox-html.el#L1659
> >> queries CUSTOM_ID only. I suppose, ID should be here as well. A subtle
> >> point is which one (ID or CUSTOM_ID) should be used if both are defined
> >> for some headers.
> > 
> > Yes, "ID should be here as well" => No.
> > That is the point I'm advocating above.
> > `:CUSTOM_ID:` are meant to be treated in a so-called "stable" way. That is
> > to say, the `CUSTOM_ID` you see in your org-file, is what you get in your
> > HTML file (also I've done some tests with that method, and I recall it
> > wasn't working at all in a multiple org files setting).
> > On the other hand, `:ID:` are meant to be treated through a *translation
> > table*, and should result in some `orgfa9c151` thing, on the HTML side.
> > Weaving the two methods together doesn't seem like "road to success".
> 
> In a general case it is rather hard to get stable anchors, even having
> full history of changes. On the other hand I see no reason to avoid
> stable IDs where they exist. Looks like a reason for defcustom at least.
> I consider random anchors and the cache to make some of them stable as
> 

Re: Internal link broken when publishing (was org-id with ox-html)

2021-09-07 Thread chris
On Tuesday, 24 August 2021 17:23:24 CEST Maxim Nikulin wrote:
> On 23/08/2021 03:42, inkbottle wrote:
> > Links between two different files, like
> > `[[id:e54113f9-2ad7-4a86-94be-68ffc696de0b][hello]]`, get broken when
> > publishing. (whatever the settings).
> > 
> > I haven't found any workaround.
> > 
> > Being able to move around entries, functionality provided by
> > `org-id-link-to- org-use-id`, is pivotal, IMO.
> 
>  From my point of view it looks like a bug.
> https://code.orgmode.org/bzg/org-mode/src/master/lisp/ox.el#L4381

Thanks a lot for your help, I'm really struggling on this one. Sorry, I was 
afk for a few days.

I believe it's a bug, plain and simple.

With a unique org file, the `:ID: e54113f9-2ad7-4a86-94be-68ffc696de0b` are 
resolved to `orgfa9c151` consistently.

Which is the expected behavior: the translation table is consistent.

When there are multiple org files, in every example I've tried, every `org-id` 
based links was broken.

There is a patch here:
https://gist.github.com/jethrokuan/d6f80caaec7f49dedffac7c4fe41d132
but, as I understand it, the workaround consists in treating `:ID:` similarly 
as `:CUSTOM_ID:`, that is, exporting them "verbatim".

That method, would be different from the *upstream* way, consisting in creating 
a "translation table".

IMO the "patch" is more like a temporary workaround which can make the code 
confusing and difficult to maintain. Because a unique question is solved in 
different ways by different developers in different files.

I think that the fix should happen in
https://github.com/emacsmirror/org/blob/master/lisp/ox.el
where the translation table is created and used, but I failed to grasp how it 
works due to my insufficient understanding of emacs-lisp.

> checks for ID property.
> https://code.orgmode.org/bzg/org-mode/src/master/lisp/ox-html.el#L1659
> queries CUSTOM_ID only. I suppose, ID should be here as well. A subtle
> point is which one (ID or CUSTOM_ID) should be used if both are defined
> for some headers.

Yes, "ID should be here as well" => No.
That is the point I'm advocating above.
`:CUSTOM_ID:` are meant to be treated in a so-called "stable" way. That is to 
say, the `CUSTOM_ID` you see in your org-file, is what you get in your HTML 
file 
(also I've done some tests with that method, and I recall it wasn't working at 
all in a multiple org files setting).
On the other hand, `:ID:` are meant to be treated through a *translation 
table*, and should result in some `orgfa9c151` thing, on the HTML side.
Weaving the two methods together doesn't seem like "road to success".

> Maybe it is possible to create workaround as a custom config without
> touching of Org code. I guess, "nicer" ids may be replaced by values of
> ID property. Examples (I tried none of them):
> -
> https://tecosaur.github.io/emacs-config/config.html#nicer-generated-heading
> https://orgmode.org/list/e1jxajq-0004dk...@lists.gnu.org/ (TEC.
> [Interest] Determanistic Org IDs. Sun, 19 Jul 2020 22:27:31 +0800)
> -
> https://github.com/alphapapa/unpackaged.el#export-to-html-with-useful-anchor
> s
> https://orgmode.org/list/CA+G3_POCYTKR6M1K8XUPzUsg5EHd5Tv4FE4X-6MvadCSjSkHi
> a...@mail.gmail.com/ (Tom Gillespie. Tue, 8 Dec 2020 20:39:08 -0500, Re:
> stability of toc links) -
> https://github.com/zzamboni/dot-doom/blob/master/doom.org#capturing-and-crea
> ting-internal-org-links
> https://orgmode.org/list/CAGY83EcFExvco6TuTOQiywgdDO0cXE+db828LeiDdimxBroVs
> g...@mail.gmail.com/ (Diego Zamboni. Wed, 9 Dec 2020 09:45:52 +0100. Re:
> stability of toc links) -
> http://ivanmalison.github.io/dotfiles/#usemyowndefaultnamingschemefororghead
> ings
> https://orgmode.org/list/4698cfeb2e415f88bd25e71267f29...@isnotmyreal.name/
> (TRS-80. Sat, 12 Dec 2020 20:25:15 -0500. Re: Better heading links in
> org-mode exports)
> - https://writequit.org/articles/emacs-org-mode-generate-ids.html

The methods above are, as I understand it, all about making more beautiful 
links to export to HTML.
Not about the "translation table" devised in `ox.el` being broken when working 
with multiple org-files.
org-id is creating a neat framework for navigating between multiple org-files.
Also, if I remember correctly, when using `CUSTOM_ID` with several org-files, 
you have to specify the file, contrary to how org-id work, using a database to 
find all by itself, the correct file to jump to.










Re: Bug: Tildes in URL impact visible link text [9.3 (release_9.3 @ /usr/share/emacs/27.1/lisp/org/)]

2020-12-27 Thread Chris Hunt
> If it's just that case, you can try replacing each
> tilde with %7E (see
> https://www.w3schools.com/tags/ref_urlencode.asp). That way the
> link description would have to be formatted correctly, without spurious
> characters.

That's a good workaround, thank you. Manually replacing "~" in the URL
with "%7E" results in the expected
description ("metrics"). Using that link in Firefox navigates to the
page successfully, too.

I looked at the problem some more. I think the underlying behavior
leading to the bug is that `org-activate-links` sets an
`invisible` text property on the URL and brackets of link text.
`org-activate-code`, which runs afterwards, identifies
"code" in a way that isn't aware of links, then proceeds to drop the
"invisible" property. That behavior makes sense,
since in the usual case we're removing properties so the text is
displayed verbatim, but not when the whole text is contained
in the URL section of a link.



Bug: Tildes in URL impact visible link text [9.3 (release_9.3 @ /usr/share/emacs/27.1/lisp/org/)]

2020-12-27 Thread Chris Hunt
I'm trying to create a link in an org file with this URL:


https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#metricsV2:graph=~(view~'timeSeries~stacked~false~metrics~(~(~'CWAgent~'backup_time~'host~'desktop~'metric_type~'timing))~region~'us-east-1);query=~'*7bCWAgent*2chost*2cmetric_type*7d

and this description: "metrics".

To do it, I followed these steps:

1. run `emacs -Q test.org`, where test.org is not an existing file
2. emacs GUI displays, type `M-x org-insert-link`
3. a "Link" prompt is displayed, paste the link and press return
4. a "Description" prompt is displayed, type "metrics" and press return

At this point I expect to see only the text "metrics" in the buffer, with normal
link decoration (underline and highlight).

Instead, I see "~(~'CWAgent~metrics" with some mix of link decoration
and some other style, as shown in the following image:

https://i.imgur.com/vb9vE43.png

The actual text from the file is


[[https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#metricsV2:graph=~(view~'timeSeries~stacked~false~metrics~(~(~'CWAgent~'backup_time~'host~'desktop~'metric_type~'timing))~region~'us-east-1);query=~'*7bCWAgent*2chost*2cmetric_type*7d][metrics]]

This is emacs 27.1 from http://ppa.launchpad.net/kelleyk/emacs/ubuntu,
with org version 9.3.

Emacs  : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.22.30, cairo version 1.15.10)
 of 2020-09-19
Package: Org mode version 9.3 (release_9.3 @ /usr/share/emacs/27.1/lisp/org/)

current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
 org-src-mode-configure-edit-buffer)
 org-link-shell-confirm-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
 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-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3
"\n\n(fn ENTRY)"]
 org-babel-pre-tangle-hook '(save-buffer)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
  org-babel-header-arg-expand)
 org-occur-hook '(org-first-headline-recenter)
 org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines
  org-optimize-window-after-visibility-change)
 org-speed-command-hook '(org-speed-command-activate
  org-babel-speed-command-activate)
 org-confirm-shell-link-function 'yes-or-no-p
 org-link-parameters '(("attachment" :follow org-attach-open-link :export
org-attach-export-link :complete
org-attach-complete-link)
   ("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") ("shell" :follow org-link--open-shell)
   ("news" :follow
#[257 "\301\300\302 Q!\207" ["news" browse-url ":"] 5
  "\n\n(fn URL)"]
)
   ("mailto" :follow
#[257 "\301\300\302 Q!\207" ["mailto" browse-url ":"]
  5 "\n\n(fn URL)"]
)
   ("https" :follow
#[257 "\301\300\302 Q!\207" ["https" browse-url ":"]
  5 "\n\n(fn URL)"]
)
   ("http" :follow
#[257 "\301\300\302 Q!\207" ["http" browse-url ":"] 5
  "\n\n(fn URL)"]
)
   ("ftp" :follow
#[257 "\301\300\302 Q!\207" ["ftp" browse-url ":"] 5
  "\n\n(fn URL)"]
)
   ("help" :follow org-link--open-help)
   ("file" :complete org-link-complete-file)
   ("elisp" :follow 

Re: [O] Painfully Slow Export

2018-06-12 Thread Chris
Hello, Ken!

Ken Mankoff (mank...@gmail.com) 2018-06-12:
> Is there a way to speed up exporting?

I may be jumping to conclusions here, and if so, please excuse me. Have
you tried profiling the export? (As in M-x profiler-start, run the
export, then M-x profiler-report?) This can shed a surprising amount of
light on why things are slow. (In my case, exporting was slow because of
a slow hook that got triggered multiple times during the exportage.)

Regards,
Chris


signature.asc
Description: PGP signature


Re: [O] Suggestion: Add zero-width nbsp to emphasis-regexp-components

2018-06-06 Thread Chris
Hey,

Nicolas Goaziou (m...@nicolasgoaziou.fr) 2018-06-06:
> Marcin Borkowski  writes:
> This is already the case. 
>
> PRE and POST parts of `org-emphasis-regexp-components' contain
> "[:space:]", which matches zero width space.

Odd. I guess my version 9.1.6 is too old to get this change? In that
case, I'm looking forward to upgrade!

Regards,
Chris


signature.asc
Description: PGP signature


[O] Suggestion: Add zero-width nbsp to emphasis-regexp-components

2018-06-06 Thread Chris
Hello!

I'm not an experienced mailing list user, but I will try to be brief.
Please excuse my lack of common courtesy.


* Problem

  There needs to be a way to coax Org into interpreting something as an
  emphasis marker, even if it ordinarily would not look like it (for
  example, because it is in the middle of a regular word, when putting
  emphasis on only part of a word.)

  - Version of Org: 9.1.6
  - Version of Emacs: GNU Emacs 25.3.2 (x86_64-pc-linux-gnu)


* Suggested Solution

  Include the Unicode zero width no-break space character (U+feff) in
  both ~pre~ and ~post~ sections of ~org-emphasis-regexp-components~.

  I currently have trouble accessing code.orgmode.org (502 Bad Gateway),
  but I imagine the solution to look something like

  --- org.el  2018-06-06 09:33:56.602335268 +0200
  +++ org-zwnbsp-emphasis.el  2018-06-06 09:39:37.985958647 +0200
  @@ -4355,7 +4355,7 @@
   ;; set this option proved cumbersome.  See this message/thread:
   ;; http://article.gmane.org/gmane.emacs.orgmode/68681
   (defvar org-emphasis-regexp-components
  -  '("- \t('\"{" "- \t.,:!?;'\")}\\[" " \t\r\n" "." 1)
  +  '("- \ufeff\t('\"{" "- \ufeff\t.,:!?;'\")}\\[" " \t\r\n" "." 1)
 "Components used to build the regular expression for emphasis.
   This is a list with five entries.  Terminology:  In an emphasis string
   like \" *strong word* \", we call the initial space PREMATCH, the final

  This has the added tiny benefit that legacy documents that still use
  U+feff as a byte order mark may be able to get emphasis also on their
  first word... (Not sure if this is a problem, actually, just throwing
  it out there.)


* Discussion

  - Does this even make sense to begin with, or is it just me?

  - Is the zero-width no-break space the most sensible character to do
this with?

I see the zero-width joiner as the alternative – but that appears to
have more legitimate uses inside words, especially in some
non-Western scripts such as Arabic and Indic. I use U+feff mostly
because it is actually sort of a space but not quite.


* Related Reports

  I found an email in the archives which touches on the same point[1],
  but suggests a more radical change.

  [1]: https://lists.gnu.org/archive/html/emacs-orgmode/2017-09/msg00363.html

Regards,
Chris


signature.asc
Description: PGP signature


Re: [O] Adding single cell movement to org-table

2018-05-29 Thread Chris Kauffman
All-

Attached are the updated patches for single cell movement in org tables.

Notes:
- Implemented all of Nicolas Goaziou's suggestions on this with some
caveats described below

- Part of the logic of the code requires boundary checking. I used the
(org-table-analyze) to set variables org-table-current-ncol and
org-table-dlines which are the limits of the table. This eliminated an
internal helper function in the original version.

- I made several of the functions internal with the naming convention
`org-table--name' as per Nicolas' suggestion

- Checks for in-table and table alignment are in the top-level functions
`org-table-move-single-cell-up' etc.; I kept alignment in as otherwise the
table looks awful as cells move around

- Modified org.el to bind these to Shift-up and the like as per Carsten's
suggestion

- Tests defined in testing/lisp/org-test-table.el and I've done a fair
amount of interactive testing to ensure the behavior looks correct.

- Not sure if the patches will work exactly correctly due to the large gap
in time between my initial work and completion; let me know if things don't
look correct.

- Attempted to get close to a correctly formatted commit messages but do
make any necessary formatting changes for compliance.

Cheers,
Chris Kauffman

On Fri, May 4, 2018 at 7:18 PM, stardiviner  wrote:

> That's really great. Thanks.
>
> --
> [ stardiviner ] don't need to convince with trends.
>Blog: https://secure-web.cisco.com/1hJRqsuxlpwmP971H8dAeGulRNSKNY
> 87qhElIE0kGFNVU8wi5u2jTzEhayLSBa8GhYPZPyxSM3aWcEqi0yTtMPyedB
> ey2od2ROikNbAYTnTptEFLNGp6HovNx1ukbSykVmN4jthKPhqhL-
> zPqBtiblX6c8EibrNqBfI2YR_DfuTSNew8YeBmyRu0Mr_
> et5PfrTaMoyrIurSC1ogXRXRMh8ds6CXnNjU7bhWZeOcjRQfyLbssZQ-
> zuRp5pSm2JMyC0h7QmqikJC6pNGBrSYPaxd37aLkMNyqhF6LyEpq2LrpWkms4s56sq9R4_
> MUrvT16dpqMPPcp1pfA1DAaPt0DBOlZIDWuieyVZSmscuGyWN6hhiYyTc0EY-_
> iwmxe0UCfRK4t0adbHcAj0cYCdGjgliGOk9jHInQTGngBOSNT_htY/https%
> 3A%2F%2Fstardiviner.github.io%2F
>IRC(freenode): stardiviner
>GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
>
>
>
From 6f50526fa642ea74716dd4668e2b36b0ff9c6134 Mon Sep 17 00:00:00 2001
From: Chris Kauffman 
Date: Sun, 23 Jul 2017 00:13:11 -0400
Subject: [PATCH 1/8] org-table: Adding single cell movement functions and
 tests.

* org-mode/lisp/org-table.el: New functions for single table cell
  movement such as (org-table-move-single-cell-down)
* testing/lisp/test-org-table.el: Added tests for single table cell
  movement such as (test-org-table/move-single-cell-down)
---
 lisp/org-table.el  |  71 ++
 testing/lisp/test-org-table.el | 385 +
 2 files changed, 456 insertions(+)

diff --git a/lisp/org-table.el b/lisp/org-table.el
index 37e40de1e..2b80bfc3a 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -1436,6 +1436,77 @@ non-nil, the one above is used."
 			 (t (setq min mean)
 	   (if above min max))
 
+;;;###autoload
+(defun org-table-max-line-col ()
+  "Return the maximum line and column of the current table as a
+list of two numbers"
+  (when (not (org-at-table-p))
+(user-error "Not in an org-table"))
+  (let ((table-end (org-table-end)))
+(save-mark-and-excursion
+ (goto-char table-end)
+ (org-table-previous-field)
+ (list (org-table-current-line) (org-table-current-column)
+
+;;;###autoload
+(defun org-table-swap-cells (row1 col1 row2 col2)
+  "Swap two cells indicated by the coordinates provided"
+  (let ((content1 (org-table-get row1 col1))
+	(content2 (org-table-get row2 col2)))
+(org-table-put row1 col1 content2)
+(org-table-put row2 col2 content1)
+(org-table-align)))
+
+;;;###autoload
+(defun org-table-move-single-cell (direction)
+  "Move the current cell in a cardinal direction according to the
+parameter symbol: 'up 'down 'left 'right. Swaps contents of
+adjacent cell with current one."
+  (unless (org-at-table-p)
+(error "No table at point"))
+  (let ((drow 0) (dcol 0))
+(cond ((equal direction 'up)(setq drow -1))
+	  ((equal direction 'down)  (setq drow +1))
+	  ((equal direction 'left)  (setq dcol -1))
+	  ((equal direction 'right) (setq dcol +1))
+	  (t (error "Not a valid direction, must be one of 'up 'down 'left 'right")))
+(let* ((row1 (org-table-current-line))
+	   (col1 (org-table-current-column))
+	   (row2 (+ row1 drow))
+	   (col2 (+ col1 dcol))
+	   (max-row-col (org-table-max-line-col))
+	   (max-row (car max-row-col))
+	   (max-col (cadr max-row-col)))
+  (when (or (< col1 1) (< col2 1) (> col2 max-col) (< row2 1) (> row2 max-row))
+	(user-error "Cannot move cell further"))
+  (org-table-swap-cells row1 col1 row2 col2)
+  (org-table-goto-line row2)
+  (org-table-goto-column col2
+
+;;;###autoload
+(defun org-table-move-single-cell-up ()
+  "Move a single cell up in a tabl

Re: [O] Adding single cell movement to org-table

2018-05-04 Thread Chris Kauffman
I was the original person who was working on code for single cell movement
but got distracted by a move to the midwest, job change, and marriage. I
will attempt to complete the code in the next month to submit a patch.

Chris Kauffman

On Fri, May 4, 2018 at 7:29 AM, stardiviner <numbch...@gmail.com> wrote:

> Hi, dear Nicolas. Is this patch merged or not?
> I "git log --grep 'cell'", have not found this commit.
> Does this patch move single cell or move single row/column?
> Currently, Org-mode built-in movement support for row and column only.
>
> --
> [ stardiviner ] don't need to convince with trends.
>Blog: https://secure-web.cisco.com/1sdj-
> xZLR6NqcfmWcqPL8xws9NwGLGIqxtf3bLvpn-RTcdJC0NapZkgAE_S_L7_
> 7FQ8W1k3rTbTZzLaYAAiRF8n8fIQJT5s0Sr-4G3n3a-hyOiksPjPSA_1BnaCm-
> Fg7Amnwx2bB5F9wCuHrxtDhxEHh6RXVg03NeXnLzw_YjFaS8w5gvnhWqSIy9hZvn6aOWvlkP
> Dy1hes_WNng6C3Qxy6ihxmpaPnSxvogd_rE1Ze31NZLD9Sv78ivAZwFmVIo7XHM
> oqs7veAKqUQC34vVSTuuFOHTYwq6owLfaqIjwmM0PfF0pwhisMsEg9TUH_q11NPRKZmq_
> QDFgqNXgPAjptiFrPBU1l9t4IUw_Bv9YCoAoqT7ZLERUfLPj_
> 9osdz3g18A6DgpJuCUNJBlInzsqGSP5zv6-v7yXKRFHr61Q24_z0nNUeUzMneqeCHpRL13-
> i7admqXNqD-HAlBD1WxP1g/https%3A%2F%2Fstardiviner.github.io%2F
>IRC(freenode): stardiviner
>GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
>
>
>


[O] Attempting to automate worg build

2018-01-08 Thread Chris Keating
Hello fellow org-mode enthusiasts.

I noticed that the server move for orgmode.org has caused some of the docs
to 404.

In an attempt to automate finding broken docs I setup a travis build.
Unfortunately I can't even seem to build the docs:


> +emacs --batch -l etc/emacs.el -f org-publish-all
> Loading 00debian-vars...
> Loading /etc/emacs/site-start.d/50autoconf.el (source)...
> Loading /home/travis/build/pdex/worg/etc/emacs-custom.el (source)...
> Publishing file /home/travis/build/pdex/worg/org-faq.org using 
> `org-html-publish-to-html'
> Setting up indent for shell type bash
> setting up indent stuff
> Indentation variables are now local.
> Indentation setup for shell type bash
> Setting up indent for shell type bash
> setting up indent stuff
> Indentation variables are now local.
> Indentation setup for shell type bash
> Unable to resolve link: "id:facac2a6-3526-450d-ac42-8d36b16c6bab"
>
>
https://travis-ci.org/pdex/worg/builds/326147794#L1449

That link target exists in the org-faq.org file but isn't being resolved
for some reason.

I'm building with the master branch of org-mode. I had to go recreate the
.emacs.el file from an archive.org link as the original is no longer on the
site and it's not in the worg repo. I'm guessing that there may be other
random bits and bobbles that I'm missing. I'd like to find all of these
missing pieces and get the worg repo into such a state that it can be
easily redeployed and validated.

If anyone knows how to get worg building I would love some pointers, in the
mean time I'll dig into org-mode and figure out why it doesn't like id:
links.


[O] Bug: org-agenda-category-filter-preset in org-agenda-custom-commands with org-agenda-sticky does not work [9.1.2 (release_9.1.2-99-g4d828b @ /home/cperl/git/org-mode/lisp/)]

2017-10-12 Thread Chris Perl
When using org-agenda-custom-commands with
org-agenda-category-filter-preset and org-agenda-sticky, it seems as
though changes to org-agenda-category-filter are global, even though
the variable is made buffer local.

>From the limited digging I've done, it seems that setting the
:preset-filter property for org-agenda-category-filter affects all
agenda buffers, not just one.

To reproduce, take the following org file:

---8<---
* Foo
  :PROPERTIES:
  :CATEGORY: foo
  :END:
** TODO Foo todo one
   DEADLINE: <2017-10-13 Fri>
   - foo 1

* Bar
  :PROPERTIES:
  :CATEGORY: bar
  :END:
** TODO Bar todo one
   DEADLINE: <2017-10-13 Fri>
   - bar 1
--->8---

And the following elisp file to setup a minimal environment:

---8<---
(require 'org)
(setq org-agenda-files (list (expand-file-name "repro.org")))
(setq org-agenda-sticky t)
(setq org-agenda-custom-commands
  '(("f" "foo"
 ((agenda "" ())
  (tags-todo "+CATEGORY=\"foo\"" ()))
 ((org-agenda-category-filter-preset '("+foo"

("b" "bar"
 ((agenda "" ())
  (tags-todo "+CATEGORY=\"bar\"" ()))
 ((org-agenda-category-filter-preset '("+bar"))

(global-set-key (kbd "C-c a") #'org-agenda)
--->8---

Then run (something like):

emacs -nw -Q -L ~/git/org-mode/lisp -l repro.el repro.org

Followed by:

C-c a f
C-c a b
C-x o
r

I would expect pressing `r' in the `*Org Agenda(f)*' buffer would
keep the original `org-agenda-category-filter-preset' and that the
preset in `*Org Agenda(b)*' should have no bearing on it.  But, as you
can (probably) see from the mode line, the filter is set to "+bar", and
refreshing the buffer causes all the TODOs to be lost because it now has
the wrong filter.


Emacs  : GNU Emacs 25.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.22.17)
 of 2017-09-14
Package: Org mode version 9.1.2 (release_9.1.2-99-g4d828b @ 
/home/cperl/git/org-mode/lisp/)

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-agenda-sticky t
 org-agenda-custom-commands '(("f" "foo" ((agenda "" nil) (tags-todo 
"+CATEGORY=\"foo\"" nil))
   ((org-agenda-category-filter-preset (quote 
("+foo")
  ("b" "bar" ((agenda "" nil) (tags-todo 
"+CATEGORY=\"bar\"" nil))
   ((org-agenda-category-filter-preset (quote 
("+bar")
  )
 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 
: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 

Re: [O] Adding single cell movement to org-table

2017-07-28 Thread Chris Kauffman
Apologies for the earlier diff-blast: I did not see the advice on the
org-mode contributions page that patches generated via
  git format-patch master
are preferred.  Please find four patches attached which now include
modifications to ORG-NEWS, org.texi, orgguid.texi, and keybindings
suggested by Carsten: S-up, S-down, S-left, S-right in org.el (via
org-shiftup etc.).

Cheers,
Chris


On Fri, Jul 28, 2017 at 4:19 AM, Nicolas Goaziou <m...@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Chris Kauffman <kauff...@cs.gmu.edu> writes:
>
> > Greetings from a first-time contributor. Another patch contributor, Uwe
> > Brauer, recruited me after finding some code I had written to move single
> > org-table cells up/down/left/right.  I found this feature to be useful in
> > certain kinds of tables so wrote the functions for myself but am told
> that
> > others might benefit from it.
> >
> > I have formalized that code into a git repo with a feature branch on it
> > which may be found here:
> >   https://github.com/kauffman77/org-mode/tree/single-cell-table-move
> >
> > I have included documentation in org-table.el for the new functions and
> > tests for them.  If further work or documentation needs to be done,
> please
> > let me know. I am also not sure if I got the commit messages formatted to
> > the specification mentioned on the contributing page.  I am happy to
> > explain more if needed.
>
> Thank you.
>
> Could you send the patch here? It will ease reviewing it.
>
> It will also require an entry in ORG-NEWS and some documentation in
> org.texi.
>
> > I just mailed ass...@gnu.org to get the copyright for the code resolved
> but
> > thought I would put up this branch now so others can have a look.
>
> Great!
>
> Regards,
>
> --
> Nicolas Goaziou
>
From b43054c9892f7e08fa958bcb5d8df978e6392d57 Mon Sep 17 00:00:00 2001
From: Chris Kauffman <kauff...@ecs.gmu.edu>
Date: Fri, 28 Jul 2017 22:46:12 -0400
Subject: [PATCH 5/5] Modified orgguide.texi to include documentation of single
 cell movement functions.

---
 doc/orgguide.texi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/doc/orgguide.texi b/doc/orgguide.texi
index 8c91aae3a..fc5c0c22c 100644
--- a/doc/orgguide.texi
+++ b/doc/orgguide.texi
@@ -647,6 +647,12 @@ Re-align, move to previous field.
 @item @key{RET}
 Re-align the table and move down to next row.  Creates a new row if
 necessary.
+@c
+@item S-@key{up}
+@itemx S-@key{down}
+@itemx S-@key{left}
+@itemx S-@key{right}
+Move single cells up, down, left, and right by swapping with adjacent cells.
 
 @tsubheading{Column and row editing}
 @item M-@key{left}
-- 
2.12.2

From 6682b22642c34f61feee27cd44a503dd4c21e9cb Mon Sep 17 00:00:00 2001
From: Chris Kauffman <kauff...@ecs.gmu.edu>
Date: Fri, 28 Jul 2017 22:37:31 -0400
Subject: [PATCH 4/5] Modified org.texi to include documentation of single cell
 movement functions.

---
 doc/org.texi | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/doc/org.texi b/doc/org.texi
index 101d532e3..55c8ebd27 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -2156,6 +2156,12 @@ NEWLINE, so it can be used to split a table.
 Move to beginning of the current table field, or on to the previous field.
 @orgcmd{M-e,org-table-end-of-field}
 Move to end of the current table field, or on to the next field.
+@c
+@orgcmd{S-@key{up},org-table-move-single-cell-up}
+@orgcmd{S-@key{down},org-table-move-single-cell-down}
+@orgcmd{S-@key{left},org-table-move-single-cell-left}
+@orgcmd{S-@key{right},org-table-move-single-cell-right}
+Move single cells up, down, left, and right by swapping with adjacent cells.
 
 @tsubheading{Column and row editing}
 @orgcmdkkcc{M-@key{left},M-@key{right},org-table-move-column-left,org-table-move-column-right}
-- 
2.12.2

From 6be32b39c590d003be75a33033bb3301a11db483 Mon Sep 17 00:00:00 2001
From: Chris Kauffman <kauff...@ecs.gmu.edu>
Date: Fri, 28 Jul 2017 22:18:28 -0400
Subject: [PATCH 3/5] Updates to ORG-NEWS describing single-cell movement
 functions.

---
 etc/ORG-NEWS | 20 
 1 file changed, 20 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index d7bd3e2ce..05efce4f4 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -291,6 +291,11 @@ This variable allow computed durations in tables to be zero-padded.
 *** New mode switch for table formulas : =U=
 This mode omits seconds in durations.
 
+*** New single table cell movement options : ~org-table-move-single-cell-up~
+Shift-Up, Shift-Down, Shift-Right, and Shift-Left now move single
+table cells in the corresponding directions by swapping with the
+adjacent cell.
+
 ** Removed functions
 
 *** Org Timeline
@@ -368,6 +373,21 @@ It is the reciprocal of ~org-list-to-lisp~, which see.
 
 Call ~org-agenda-set-restriction-lock~ from the agenda.
 
+*** ~org-table-move-single-cell~ and rela

[O] Adding single cell movement to org-table

2017-07-27 Thread Chris Kauffman
Greetings from a first-time contributor. Another patch contributor, Uwe
Brauer, recruited me after finding some code I had written to move single
org-table cells up/down/left/right.  I found this feature to be useful in
certain kinds of tables so wrote the functions for myself but am told that
others might benefit from it.

I have formalized that code into a git repo with a feature branch on it
which may be found here:
  https://github.com/kauffman77/org-mode/tree/single-cell-table-move

I have included documentation in org-table.el for the new functions and
tests for them.  If further work or documentation needs to be done, please
let me know. I am also not sure if I got the commit messages formatted to
the specification mentioned on the contributing page.  I am happy to
explain more if needed.

I just mailed ass...@gnu.org to get the copyright for the code resolved but
thought I would put up this branch now so others can have a look.

Cheers,
Chris


Re: [O] The power of '-'

2016-06-24 Thread Chris Patti
Export is one of org's best features IMO.

You can take your outline and make a PDF, HTML, etc etc out of it.

Very handy for when you want to type some notes or something up and
make them look REALLY polished. Impress the boss :)

-Chris

On Fri, Jun 24, 2016 at 1:24 PM, Brenda Butler <b...@mojatatu.com> wrote:
> I'm not super advanced in org-mode, so take what I have to say as
> "non-authoritative", but:
>
> I don't think you need any prefix on lines in your org-mode file.
> Lines with some number of * are headers as you noted
> Lines that start with a - make a list of items.
>
> I'm not sure what you can do with lists ... but probably that has an effect
> on formatting.
> So you can have a paragraph (no prefix), then a list (list items start with
> -) then another paragraph ...
>
> I haven't tried to "export" my org files so I don't know how it would look.
> I just use the files as a todo/done list/database/thing.
>
> bjb
>
>
> On Fri, Jun 24, 2016 at 12:11 PM, Chris Patti <cpa...@gmail.com> wrote:
>>
>> So, this is one of those weird moments where I feel really stupid
>> saying this, but I can imagine others have dealt with this as well.
>>
>> When I first started using org-mode, I thought you prefixed every line
>> with some number of *.
>>
>> Then, I discovered that the *** were headings, and actual items under
>> those headings were prefixed with '-'.
>>
>> This is a simple thing, but WOW did it make a huge difference.
>>
>> * I kept wondering why exports to PDF or HTML looked like crud
>> * Things like beamer wouldn't render my slides properly
>>
>> etc etc.
>>
>> I'm going to go over the documentation and ensure I wasn't just
>> looking past something, but I wonder if others have had this problem.
>>
>> -Chris
>>
>> --
>> Christopher Patti - Geek At Large | GTalk: cpa...@gmail.com | AIM:
>> chrisfeohpatti | P: (260) 54PATTI
>> "Technology challenges art, art inspires technology." - John Lasseter,
>> Pixar
>>
>



-- 
Christopher Patti - Geek At Large | GTalk: cpa...@gmail.com | AIM:
chrisfeohpatti | P: (260) 54PATTI
"Technology challenges art, art inspires technology." - John Lasseter, Pixar



[O] The power of '-'

2016-06-24 Thread Chris Patti
So, this is one of those weird moments where I feel really stupid
saying this, but I can imagine others have dealt with this as well.

When I first started using org-mode, I thought you prefixed every line
with some number of *.

Then, I discovered that the *** were headings, and actual items under
those headings were prefixed with '-'.

This is a simple thing, but WOW did it make a huge difference.

* I kept wondering why exports to PDF or HTML looked like crud
* Things like beamer wouldn't render my slides properly

etc etc.

I'm going to go over the documentation and ensure I wasn't just
looking past something, but I wonder if others have had this problem.

-Chris

-- 
Christopher Patti - Geek At Large | GTalk: cpa...@gmail.com | AIM:
chrisfeohpatti | P: (260) 54PATTI
"Technology challenges art, art inspires technology." - John Lasseter, Pixar



[O] Bug: Incorrect type in ob-C.el for D code [8.3.4 (8.3.4-elpa @ ~/.emacs.d/elpa/org-20160222/)]

2016-02-25 Thread Chris Andrews
Issue is fairly straightforward.  When evaluating a D code block that
includes a table var, this error is thrown by the DMD compiler.

~\Temp\babel-1032v-N\C-src-1032Xig.d(25): Error: cannot implicitly convert
expression (row) of type ulong to uint
Failed: ["dmd", "-v", "-o-", "~/Temp/babel-1032v-N/C-src-1032Xig.d",
"-I~/Local/Temp/babel-1032v-N"]

The type `ulong` is not appropriate for the generated code, as it
represents an array index.  The fix is to change line 434 in ob-C.el from:

 "string %s_h (ulong row, string col) { return
%s[row][get_column_num(%s_header,col)]; }"

to read:

 "string %s_h (size_t row, string col) { return
%s[row][get_column_num(%s_header,col)]; }"


The use of `size_t` is correct for array indexes, and fixes the error in
the compiler.

Reference: http://dlang.org/spec/portability.html
"Array indices should be of type size_t."

System information follows.

Thank you!

Emacs  : GNU Emacs 24.4.1 (i686-pc-mingw32)
 of 2014-10-24 on LEG570
Package: Org-mode version 8.3.4 (8.3.4-elpa @ ~/.emacs.d/elpa/org-20160222/)

current state:
==
(org-babel-do-load-languages
 'org-babel-load-languages
 '((emacs-lisp . t)
   (C . t)
   ))

-- 
Chris Andrews
http://www.darkspiredesign.com
(337) 247-4860


[O] Which app was John Wegley referring to when he talked about opening Org-mode on IOS?

2015-12-14 Thread Chris Patti
In his "emacs Chat" with Sacha Chau, Mr. Wegley mentions being able to
open Org-mode files on IOS.

This would be awesome for me and I'm wondering if anyone knows what he
was referring to.

(I'm guessing it's not MobileOrg because that program on IOS seems to
want a rather odd method involving pushing files back and forth)

Thanks!
-Chris

-- 
Christopher Patti - Geek At Large | GTalk: cpa...@gmail.com | AIM:
chrisfeohpatti | P: (260) 54PATTI
"Technology challenges art, art inspires technology." - John Lasseter, Pixar



[O] Best way to edit org files via Dropbox on an IOS device?

2015-11-05 Thread Chris Patti
I've tried MobileOrg and the strange (to me :) push/pull workflow
doesn't fit my needs very well.

Dropbox has an excellent IOS client, I'd love to just be able to load
and edit my .org files from that with some app or other.

Does such exist?

Thanks!
-Chris

-- 
Christopher Patti - Geek At Large | GTalk: cpa...@gmail.com | AIM:
chrisfeohpatti | P: (260) 54PATTI
"Technology challenges art, art inspires technology." - John Lasseter, Pixar



Re: [O] org-mobile-push and MobileOrg compatibility issue

2015-10-13 Thread Chris Patti
I must confess I am not wild about the whole way MobileOrg purports to function.

I don't really want to have to push or pull my OrgFiles to/from
mobile.  With mechanisms like Dropbox what I *really* want is to be
able to access and manipulate Org content on my device directly.

-Chris

On Mon, Oct 12, 2015 at 1:42 PM, Vamsi Vytla <vamsi.vy...@gmail.com> wrote:
> Hi Nicolas,
>
> I can guarantee you that your suggestion did NOT work for me. I haven't
> heard anything from Sergey here. Looks like people at MobileOrg-Android
> maybe running into the same issue:
>
> https://github.com/matburt/mobileorg-android/issues/472#issuecomment-147403622
>
> Any thoughts?
>
> Vamsi
>
> On Sat, Sep 5, 2015 at 1:44 AM Nicolas Goaziou <m...@nicolasgoaziou.fr>
> wrote:
>>
>> Hello,
>>
>> Vamsi Vytla <vamsi.vy...@gmail.com> writes:
>>
>> > M-x 'org-mobile-push', with the latest org-mode leaves the files
>> > incompatible with MobileOrg Android application. There have been no
>> > changes
>> > in MobileOrg for over a year.
>> >
>> > I bisected the latest org-mobile related changes and noticed that
>> > reverting
>> > this one line below "fixes" the issue (at least for me). Since there
>> > aren't
>> > any tests, it's hard to validate changes and understand things easily.
>> >
>> > If anybody can point me in the right direction, I would love to look
>> > into
>> > it further.
>> >
>> > Cheers!
>> >
>> > diff --git a/lisp/org-mobile.el b/lisp/org-mobile.el
>> > index 6c7c8d0..7e1127c 100644
>> > --- a/lisp/org-mobile.el
>> > +++ b/lisp/org-mobile.el
>> > @@ -446,7 +446,7 @@ agenda view showing the flagged items."
>> >  x))
>> >(cdr entry)))
>> > (insert "#+TODO: " (mapconcat 'identity kwds " ") "\n")
>> > -   (setq dwds (or (member "|" kwds) (last kwds))
>> > +   (setq dwds (member "|" kwds)
>> >   twds (org-delete-all dwds kwds)
>> >   todo-kwds (org-delete-all twds todo-kwds)
>> >   done-kwds (org-delete-all dwds done-kwds)))
>>
>> IIRC this change was introduced to fix another bug. It might be useful
>> to discuss with the author of this change. Another option is to use
>>
>>   (or (member "|" kwds) (cons "|" (last kwds)))
>>
>>
>> Regards,
>>
>> --
>> Nicolas Goaziou



-- 
Christopher Patti - Geek At Large | GTalk: cpa...@gmail.com | AIM:
chrisfeohpatti | P: (260) 54PATTI
"Technology challenges art, art inspires technology." - John Lasseter, Pixar



[O] Valid use cases for lists?

2015-08-20 Thread Chris Patti
Can anyone give me an example of when it's a good idea to use lists
rather than headlines?

They feel rather like a violation of the principle of least surprise
to me, because when you use them, and then try to use pretty much any
other Org feature on them (marking them as a TODO item, tagging, etc.)
it doesn't work because lists aren't meant to be used that way.

I'm guessing I'm missing something obvious here, and that's why I'm asking.

Thanks in advance!
-Chris

-- 
Christopher Patti - Geek At Large | GTalk: cpa...@gmail.com | AIM:
chrisfeohpatti | P: (260) 54PATTI
Technology challenges art, art inspires technology. - John Lasseter, Pixar



Re: [O] Org-Mode and Mac OS X advice

2015-03-27 Thread Chris Willard
Hello All,

Just a quick email to say thanks for all the advice and tips.

Regards,

Chris





[O] Org-Mode and Mac OS X advice

2015-03-26 Thread Chris Willard
Hello All,

I am thinking about changing to a Mac from Windows and wanted to check
that there are no issues with using org-mode in OS X.

I would like to know what version of Emacs people use (e.g. Aquamacs)
and also if there are any issues using org-mode on a Mac. For example,
I export to PDF frequently so would like to know if I need any other
software for this.

Many thanks,

Chris






[O] Error with Org Export

2015-03-06 Thread Chris Drane
I'm trying to export to HTML a file with this snippet of text:


call_function 0; store 1 (a)


Doing so gives me the error: *Variable store must be assigned a default
value*

This goes away if I remove the underscore. I've tried using #+OPTIONS: ^:{}
to address this, but it doesn't have any effect, nor does #+OPTIONS: ^:nil

Org is version 8.2.10. Emacs is 25.0.50.1.

What seems to be the matter here and how can I fix it?


[O] Filter by tags issues

2015-02-27 Thread Chris Henderson
I'm having an annoying issue with filter by tag.

I filter everything that has @computer, process one item and send it to the
archive file; as soon as I archive it, the next item on the list pops up -
this item might be a @home item.

How do I stop this from happening?

Thanks.


[O] Tag filter inheritence

2014-12-09 Thread Chris Henderson
When I filter by tag (C-c / m) for, say, @internet, the tag for the parent
also shows up (which might have a different tag, say, @errands). Is there
any way to see _only_ tags that have @internet and filter out tags
inherited from the parent?


[O] Mute tasks in agenda weekly view

2014-10-26 Thread Chris Drane
I think it would be helpful if on the weekly agenda view there were a way
to hide a task for one day only. For example, if there were a task that I
knew I wouldn't get to today, I could hit 'm', the status would stay as
TODO, but it wouldn't show up under this particular agenda view.

The only semi-relevant discussion I could find is this:
http://thread.gmane.org/gmane.emacs.orgmode/10229/focus=10233. However,
this discussion pertained more to tasks that were being scheduled at day
zero , and which wouldn't be completed until day twenty.

Any thoughts on how to do this?


Re: [O] how to avoid item expansion when changing status?

2014-10-26 Thread Chris Drane
You could hide the state changes if you put (setq org-log-into-drawer
LOGBOOK) in your init file. I don't know how to hide the CLOSED tag
though.

On Sun, Oct 26, 2014 at 11:32 AM, Maciej Kalisiak mkalis...@gmail.com
wrote:

 When I do C-c t d (TODO - DONE) or similar status change on a TODO item,
 it accumulates meta-data like:
   CLOSED: [2014-10-26 Sun 11:25]
   - State DONE   from TODO   [2014-10-26 Sun 11:25]
 So each such item blows up on screen from 1 line to 3 lines.

 I do want to collect this data, but I do not want to necessarily see it
 when I'm just marking things DONE... there is no value to me seeing this at
 that point.

 However, in some situations, I wish I knew which, when I change the
 status, the metadata is added BUT the item remains collapsed. I'd like to
 have this always happen. Can anyone suggest how to achieve this?




Re: [O] org-lookup formula missing

2014-10-21 Thread Chris Drane
No, that does not do anything. I see the macro that is supposed to define
the functions in my org-table.el, so I don't think version is an issue. Org
is 7.9.3f. Emacs is 24.3.1.

On Mon, Oct 20, 2014 at 6:39 PM, Rasmus ras...@gmx.us wrote:

 Hi,

 Chris Drane csdr...@gmail.com writes:

  For some reason, the org-lookup formula [1] are not available to me. I
  don't see anything that I'm supposed to enable to have access to them,
 and
  I don't think there's anything in my config that would be blocking them.
  Does anyone know why this might be?

 In my Org-mode version 8.3beta (release_8.3beta-422-gb54ad3 @
 /usr/share/emacs/site-lisp/org/) they are defined in org-table.el.

 Are the functions available when you explictly require that file?

 M-: (require 'org-table) RET

 —Rasmus

 --
 Together we will make the possible totay impossible!





[O] org-lookup formula missing

2014-10-20 Thread Chris Drane
For some reason, the org-lookup formula [1] are not available to me. I
don't see anything that I'm supposed to enable to have access to them, and
I don't think there's anything in my config that would be blocking them.
Does anyone know why this might be?

Thanks

[1] http://orgmode.org/manual/Lookup-functions.html


[O] Scheduler propose dates?

2014-10-18 Thread Chris Drane
My work flow for org mode requires that I schedule when I will due a task
when I capture it. Many of my tasks don't actually have deadlines, but if I
don't give them a date I end up not following through. Therefore the date I
pick is somewhat arbitrary. Instead, I try to smooth my tasks out across
the week to make sure that I don't have too many on any particular day.

I was thinking that it might be nice if Org could propose a date when I
capture a task by looking at how many tasks I have scheduled over the
course of the next few days. Has anyone ever tried to do this before?

Thanks,

Chris


[O] Filter by tags

2014-10-04 Thread Chris Henderson
I have 4 * items (* Tasks, * Projects, * Someday/ maybe and * Read and
Review) - how do I select tags (e.g. @internet, @home, @work etc.) only
from * Tasks and * Projects?

Thanks.


[O] Adding items in table

2014-10-02 Thread Chris Henderson
I have a table and would like to add all costs (in $) in column 3 as a
total. Wondering how do I do that. I have done =vsum($2..$9) - but this
hangs my org file and I have to kill it with the -9 switch.

Thanks.


Re: [O] Fwd: Re: Adding items in table

2014-10-02 Thread Chris Henderson
Here's an example of the table (hope the line breaks are ok)

|Item | Model | price |
| x | v  | $323.98
| y | x  | $184.45|
| Total |   | ??  |

On Thu, Oct 2, 2014 at 7:01 PM, Christian Moe m...@christianmoe.com wrote:


 Christian Moe writes:

 You probably don't really want to replace the contents of column 3 ($3)
 with a sum of columns including column 3 ($2..$9)?

 To get useful help you'll need to provide the table, or a minimal
 example of a table with the same structure.

 Yours,
 Christian

 
  Chris Henderson writes:
 
  I have a table and would like to add all costs (in $) in column 3 as a
  total. Wondering how do I do that. I have done =vsum($2..$9) - but
 this
  hangs my org file and I have to kill it with the -9 switch.
 
  Thanks.





[O] Org habit graph can't see

2014-08-29 Thread Chris Henderson
I can't see graph in org-agenda. At the moment, I only have one entry from
todo to done - is one entry too little information to develop graph and
will it develop later as I put in more entries?

* Habits
*** TODO Do dishes
SCHEDULED: 2014-08-31 Sun +1d
- State DONE   from TODO   [2014-08-30 Sat 12:09]
:PROPERTIES:
:STYLE:habit
:LAST_REPEAT: [2014-08-30 Sat 12:09]
:END:


[O] OS X mail message linking

2014-08-24 Thread Chris Henderson
I'm looking at http://orgmode.org/worg/org-contrib/org-mac-message.html

How do I setup multiple Gmail accounts with this? As in,  (setq
org-mac-mail-account account) - what should be the account name?

Thanks.


[O] Tab completion for link to file

2014-08-10 Thread Chris Henderson
How can I get auto tab completion for links to files?

e.g. [[file+sys:///Users/chris/projects/marketing 2014]]

Thanks.


Re: [O] Tab completion for link to file

2014-08-10 Thread Chris Henderson
yep, thanks.


On Sun, Aug 10, 2014 at 6:49 PM, Daimrod daim...@gmail.com wrote:

 Chris Henderson henders...@gmail.com writes:

 Hi Chris,

  How can I get auto tab completion for links to files?

 Is C-u C-c C-l what you're looking for?

 From the *Help* of `org-insert-link':
  With a C-u prefix, prompts for a file to link to.  The file name can
  be selected using completion.


 
  e.g. [[file+sys:///Users/chris/projects/marketing 2014]]
 
  Thanks.

 --
 Daimrod/Greg




Re: [O] File name with space

2014-07-26 Thread Chris Henderson
Yes it does. Thanks!


On Sat, Jul 26, 2014 at 7:38 AM, Nick Dokos ndo...@gmail.com wrote:

 Chris Henderson henders...@gmail.com writes:

  How do I link a local file or folder that has space? Looks like the link
 goes broken.
 
  e.g. file+sys:///Users/chris/projects/marketing plan for 2014 --
 doesn't work.
 
  I tried:
 
  file+sys:///Users/chris/projects/marketing\ plan\ for\ 2014 -- which
 also doesn't work.

 file+sys:///Users/chris/projects/marketing%20plan%20for%202014

 should work at least in the buffer and HTML export.

 Nick






[O] Advanced video tutorial

2014-07-26 Thread Chris Henderson
Is there any Advanced video tutorial (beyond the basics) for org-mode
published in the last 1 year or so? By Advanced, I mean things archiving/
note taking/ drawers and various other new efficiency gains features that
have come out with recent orgs.

Most tutorials I found on the net only state the basics.

Thanks.


[O] File name with space

2014-07-25 Thread Chris Henderson
How do I link a local file or folder that has space? Looks like the link
goes broken.

e.g. file+sys:///Users/chris/projects/marketing plan for 2014 -- doesn't
work.

I tried:

file+sys:///Users/chris/projects/marketing\ plan\ for\ 2014 -- which also
doesn't work.


Re: [O] Printing org file in color

2014-06-27 Thread Chris Henderson
On Wed, Jun 25, 2014 at 6:25 PM, Bastien b...@gnu.org wrote:

 Hi Chris,

 Chris Henderson henders...@gmail.com writes:

  I'd like to print out my org file in expanded mode in color. How do I
  do that?

 I suggest M-x htmlize-buffer RET then printing from your web browser.


I can't find  htmlize-buffer in my org 8.2.5g. Is this recently been
introduced?

Also, I have created a HTML file using htmlfontify-buffer but can't seem to
open this file using Firefox or Safari (it shows blank). The file, however,
opens file in Lynx.

Thanks.


[O] Printing org file in color

2014-06-25 Thread Chris Henderson
I'd like to print out my org file in expanded mode in color. How do I do
that?

Thanks.


[O] Get total number of items

2014-06-22 Thread Chris Henderson
Is there a way to get the total number of items at the parent level? I have
lots of ** under a * and I'd like to see the number at a glance.

Thanks.


[O] Bulk select and tag

2014-06-20 Thread Chris Henderson
Wondering how can I select multiple ** items and apply tag on them.

Thanks.


Re: [O] org-weather for openweathermap.org

2014-06-15 Thread Chris Raschl

Hi Thorsten,
first of all, thanks for your suggestions, I really appreciate it.

tjol...@gmail.com writes:

 Chris Raschl c...@kautsig.org writes:

 Hi everybody,

 recently I wanted to add a weather forecast to my org-agenda. I found
 org-google-weather, but this package is obsolete since 2012, because the
 API is not available any more. So I wrote my own version which is backed
 by the openweathermap.org API.

 I implemented the minimal usecase which works for me, if somebody else
 dares to use it, its available here:

 https://github.com/kautsig/org-weather

 Nice, thank you, never made org-google-weather, but this works
 out-of-the-box:

   ,-
   | City: Weather: light rain, 10.43°C - 17.58°C
   `-

 A few suggestions wrt

[...]

 - why not use (round ...) for the temperature data, 10-17°C would be
   more than accurate enough?

I added this. Additionally I removed the temperature unit being
displayed twice, this was unnecessary and looks much nicer in the format
you suggested.

 - why not include city/country info in the weather string? I added

   * Weather
 :PROPERTIES:
 :CATEGORY: City
 :END:
   %%(org-weather)

   to get the above, but it would be much better to take the return
   values for city/country and include them in the weather string, to
   make sure one did not mess up the configuration and gets the weather
   from another place than expected.

Also thought about this, but I think I will go with the method which was
also used in org-google-weather. It looks like:

* Weather
%%(org-google-weather New York)

This is much simpler for me, as I'm not so familiar with lisp and the
org-mode api. But I'll have to change the data structure for caching the
data a bit, so it might take a while.

 - maybe make the whole thing a bit customizable by adding a few
   defcustoms, so the user can decide which info he wants to print in the
   agenda

   the return string looks like this, there are many options:

[...]

I improved result processing a little bit and added a formatting string
(org-weather-format). You can now also add different temperature fields,
as well as humidity, pressure and wind speed.

Regards,
Chris



[O] org-weather for openweathermap.org

2014-06-14 Thread Chris Raschl

Hi everybody,

recently I wanted to add a weather forecast to my org-agenda. I found
org-google-weather, but this package is obsolete since 2012, because the
API is not available any more. So I wrote my own version which is backed
by the openweathermap.org API.

I implemented the minimal usecase which works for me, if somebody else
dares to use it, its available here:

https://github.com/kautsig/org-weather

Regards,
Chris



Re: [O] Export to iCalendar only not DONE, scheduled tasks?

2014-06-01 Thread Chris Poole
On Wed, May 14, 2014 at 11:31 PM, Arun Persaud apers...@lbl.gov wrote:

 had another look and org-export-filter-final-output-functions is the
 wrong function to use. ...


So, I ended up solving my problem, via an alternative route. The code is
here:

https://github.com/chrispoole643/org-gtd/blob/dcfe7122fa496de51a8de3a8f02184bc7aec05b9/org-gtd.el#L143

Essentially, the icalendar function that combines the agendas and exports
stuff just calls a function that happens to accept a restricted list of
items to export. So, I use this function directly, but first I look through
my agenda files and mark where the scheduled tasks are. I then pass these
as the restricted list, and all works well :)

Thanks for the help,
Chris


[O] How to find the headline matching a string

2014-05-31 Thread Chris Poole
Hi all,

Suppose I have a string, my first task, that I know is tagged with
laptop.

I want to search through the agenda files for a headline that matches this
string, to be able to mark it as DONE (in an automated fashion).

I can't find a function to search through for the headline --- is there one?

Else, is it best to concat all the agenda files into a larger buffer, then
parse the buffer and iterate through the headlines with org-element-map?


Cheers,
Chris


Re: [O] How to find the headline matching a string

2014-05-31 Thread Chris Poole
Eric Abrahamsen:
 the `org-map-entries' function can be given a scope of 'agenda

That worked perfectly, thanks. Here's what I ended up with:

(org-map-entries (lambda ()
   (when (equal title (org-get-heading t t))
 (org-entry-put (point) TODO DONE)))
 tag 'agenda)


Cheers,
Chris



On Sat, May 31, 2014 at 4:27 PM, Eric Abrahamsen e...@ericabrahamsen.net
wrote:

 Chris Poole li...@chrispoole.com writes:

  Hi all,
 
  Suppose I have a string, my first task, that I know is tagged with
  laptop.
 
  I want to search through the agenda files for a headline that matches
  this string, to be able to mark it as DONE (in an automated fashion).
 
  I can't find a function to search through for the headline --- is
  there one?
 
  Else, is it best to concat all the agenda files into a larger buffer,
  then parse the buffer and iterate through the headlines with
  org-element-map?
 
 
  Cheers,
  Chris

 Depending on how automated you need this to be, the `org-map-entries'
 function can be given a scope of 'agenda (see its docstring). You could
 call it with the agenda scope and a matcher for the laptop tag -- that
 would at least get you all the headings in all the agenda files with the
 laptop tag. Then the actual mapping function could call
 `org-get-heading' on each of the matching headings, and check the text.

 In these cases, though, I generally try to find a way to know the
 heading's ID property, and use `org-id-goto'.

 Hope that helps,
 Eric





Re: [O] How to find the headline matching a string

2014-05-31 Thread Chris Poole
Igor Sosa Mayor:
 could you maybe send a little more of the code? I would like to
 understand how it exactly works.

Sure --- it's part of a quick setup file for the GTD methodology that I'm
writing. The specific function in question is here:

https://github.com/chrispoole643/org-gtd/blob/6b13d4fdf024923756653e75c0ba313898ff7a9d/org-gtd.el#L111

Cheers,
Chris


[O] Filter tasks when exporting to iCalendar

2014-05-17 Thread Chris Poole
Hi,

I'm trying to filter tasks such that only tasks that aren't done, but are
scheduled or have deadlines, are exported to iCalendar.

I have this so far:


(setq org-icalendar-use-scheduled '(todo-start)
org-icalendar-use-deadline '(todo-due)
org-icalendar-include-todo t
org-icalendar-include-body nil
org-icalendar-alarm-time 15
org-icalendar-with-timestamps 'active)

(defun gtd-filter-scheduled-todo-tasks (data backend info)
  Filter iCalendar export to include only TODO tasks that are
not done, but which are scheduled or have a deadline.
  (when (eq backend 'icalendar)
(org-element-map data 'headline
  (lambda (hl)
(when (or (not (equal 'todo (org-element-property :todo-type hl)))
  (equal DONE (org-element-property :todo-keyword hl))
  (not (or (org-element-property :scheduled hl)
   (org-element-property :deadline hl
  (org-export-ignore-element hl info))) info) data))

(defun gtd-export-agendas-and-calendar ()
  Store agenda views as plain text files, and export scheduled
events to a combined iCalendar file. Filter the calendar using
`gtd-filter-scheduled-todo-tasks', only allowing tasks that
aren't DONE, but are scheduled.
  (interactive)
  (org-store-agenda-views)
  (let ((org-export-filter-parse-tree-functions
'(gtd-filter-scheduled-todo-tasks)))
(org-icalendar-combine-agenda-files)))


But it leaves an empty calendar.ics file. Anyone know where I'm going wrong?
I assume that org-export-ignore-element is updating `info' in place.

I can't work out why it's not working...


Cheers,
Chris


Re: [O] Export to iCalendar only not DONE, scheduled tasks?

2014-05-16 Thread Chris Poole
That's very helpful, thanks — I'll get experimenting.


Cheers,
Chris


Re: [O] Export to iCalendar only not DONE, scheduled tasks?

2014-05-10 Thread Chris Poole
On Mon, May 5, 2014 at 11:08 PM, Arun Persaud apers...@lbl.gov wrote:

 pretty sure this can be done. I export only events to an ics file that
 have a start and an end date and are not in a certain category. For this
 I use


That's great, thank you. I have this, but it doesn't work:

(defun filter-scheduled-todo-tasks (content backend info)
  Filter iCalendar export to include only TODO tasks that are
not done, but which are scheduled or have a deadline.
  (when (eq backend 'icalendar)
(if (and (org-entry-is-todo-p)
 (not (org-entry-is-done-p))
 (or (org-get-scheduled-time (point))
 (org-get-deadline-time (point
content nil)))

... called with:

(let ((org-export-filter-final-output-functions
 '(filter-scheduled-todo-tasks)))
(org-icalendar-combine-agenda-files))

I have (setq org-icalendar-include-todo t) too.

Using edebug, it seems that the `content' argument only iterates through
the top-level headings of each of my agenda files. I was assuming it'd
iterate through each subheading too --- do I need to do this manually?


Re: [O] Export to iCalendar only not DONE, scheduled tasks?

2014-05-07 Thread Chris Poole
On Tuesday, May 6, 2014, Bastien b...@gnu.org wrote:
 (setq org-icalendar-include-todo t)

I tried that, but it has the unfortunate effect of adding all my TODO
entries into the calendar.

I want unscheduled TODO items to be in tags-todo lists only (for @contexts
in GTD parlance), and scheduled TODO items to appear in the weekly agenda
and iCalendar files. (And nothing else going to iCalendar.)

I have been able to set everything up except for the last piece in
parentheses above.

Any other thoughts?

Cheers,
Chris


[O] Export to iCalendar only not DONE, scheduled tasks?

2014-05-04 Thread Chris Poole
Hi,

I've been searching round the manual, and blogs, to find a way to do this.

I want to export all of the scheduled/deadline tasks that are not in a DONE
state to an iCalendar file.

Can this be done?


Cheers,
Chris


[O] Update from exported agendas?

2014-04-27 Thread Chris Poole
Hi,

I export my agenda custom views to plain text, so I can check things off as
I go (without access to Emacs).

I use `(org-agenda-prefix-format  [ ] )` so I can easily add an X with
my text editor on my phone.

Is there any way to have this update the todo items that the exported
agenda file was created from? (Say, changing NEXT state to DONE.)


Cheers,
Chris


Re: [O] Update from exported agendas?

2014-04-27 Thread Chris Poole
The only way I can think of doing it is, for each completed task out of the
exported file, pull up the agenda view (that corresponds to that file),
find that item, and mark it as DONE.

Perhaps have this action on the opening of any file in the org-agenda-files
list.

I was just hoping it might have already been done so I don't have to start
from scratch, seems like a logical thing --- presumably people just
manually open up the agenda view for what they've just done away from the
laptop, and mark things done, again...

(Incidentally, I actually wrote this functionality years ago (and it'd also
switch the next TODO task to NEXT), in a GTD library I made for myself, but
recently decided to switch to org mode, as it has a ton of advantages to my
simple system. I'm now seeing if I can build a GTD layer on top of org
mode, to provide a kind of automatic setup for those new to org-mode, who
want to use it with the GTD methodology.)


On Sun, Apr 27, 2014 at 12:16 PM, Thorsten Jolitz tjol...@gmail.com wrote:

 Chris Poole li...@chrispoole.com writes:

 Hi,

  I export my agenda custom views to plain text, so I can check things
  off as I go (without access to Emacs).
 
  I use `(org-agenda-prefix-format  [ ] )` so I can easily add an X
  with my text editor on my phone.
 
  Is there any way to have this update the todo items that the exported
  agenda file was created from? (Say, changing NEXT state to DONE.)

 I don't think this is possible. Without having looked at org-agenda.el I
 guess that the connection between agenda entries and items in .org files
 is realised with Emacs Lisp markers (enabling cmds like
 `org-agenda-show' in agenda mode). These markers are lost when you simply
 copy the agenda contents to a plain text file, so there is no connection
 anymore with the Org files.

 Maybe the elisp markers could be replaced by unique IDs for each entry
 or links that allow the look-up of the associated entries, and you are
 lucky and somebody aready figured out how to do this?

 --
 cheers,
 Thorsten





[O] Drawer items showing up on tab cycle

2014-04-20 Thread Chris Henderson
According to http://orgmode.org/manual/Drawers.html, drawer items should
only show when cursor is on the drawer and tab is pressed. But my drawer
items shows up when I do tab cycling.

I have * Tasks ** buy book *** Book note :book note: my notes on books
:END:

When I press tab on * Tasks, drawer items show up.

Thanks


Re: [O] Drawer items showing up on tab cycle

2014-04-20 Thread Chris Henderson
Sorry but not sure what you mean. I don't seem to have any space character
in the drawer's name. I inserted the drawer using M-x org-insert-drawer.

Thanks for further clarification.


On Sun, Apr 20, 2014 at 6:08 PM, Nicolas Goaziou n.goaz...@gmail.comwrote:

 Hello,

 Chris Henderson henders...@gmail.com writes:

  According to http://orgmode.org/manual/Drawers.html, drawer items should
  only show when cursor is on the drawer and tab is pressed. But my drawer
  items shows up when I do tab cycling.
 
  I have * Tasks ** buy book *** Book note :book note: my notes on books
  :END:
 
  When I press tab on * Tasks, drawer items show up.

 You cannot have a space character in drawer's name.


 Regards,

 --
 Nicolas Goaziou



Re: [O] Shortcut to file

2014-04-12 Thread Chris Henderson
C-u C-c C-l solves all problems. Now I can link any file (PDF etc.) from
anywhere within org and with tab completion. Thanks.


On Sat, Apr 12, 2014 at 1:58 PM, Nick Dokos ndo...@gmail.com wrote:

 Chris Henderson henders...@gmail.com writes:

  Looks like org-insert-link doesn't have any tab completion feature to
 list files on the
  system. How do I get that?
 
  I can tab complete file+sys: but then can't do ~/directory/file.txt
 
  Thanks.
 
  On Sun, Mar 16, 2014 at 3:31 PM, Eric Abrahamsen 
 e...@ericabrahamsen.net wrote:
 
  Chris Henderson henders...@gmail.com writes:
 
   Is there any way to quickly add a file's location rather than
 typing
   the whole file://path/to/location. The files are mostly freemind or
   libreoffice calc/ word files.
  
   If the file or the directory is not there, it can also be created
   from within org easily.
  
   Thanks
 
  Are these links to files? You can use `org-insert-link' with a prefix
  argument, to get the usual find-file interface, and a link inserted
 once
  you've found it.

 You must have missed the prefix argument part of Eric's answer: C-u C-c
 C-l

 --
 Nick





  1   2   3   4   >