Re: <> and ?font-lock? fly-check, ...

2021-05-02 Thread Diego Zamboni
I don't think there's an easy way to fix this - since src blocks are
fontified using the mode for the corresponding language. Particularly in
shell script, since << has a meaning in the language ("here" input), I
assume this is why the rest of the block gets fontified differently.

Best,
--Diego


On Sun, May 2, 2021 at 2:29 PM Greg Minshall  wrote:

> hi, all.
>
> using a <> reference in a bash source block, the buffer's font
> lock colors go south on lines folowing the <> reference.  (in my
> case, all remaining lines in the buffer are colored bright yellow).  the
> major and minor modes are as listed below.
>
> is there an obvious thing to do to either get whatever syntax checker is
> running to ignore the <> reference, or some such?
>
> thanks in advance, Greg
>
> major mode: Shell-script[bash]
>
> Enabled minor modes: Async-Bytecomp-Package Auto-Composition
> Auto-Compression Auto-Encryption Blink-Cursor Electric-Indent
> File-Name-Shadow Flycheck Font-Lock Global-Eldoc Global-Flycheck
> Global-Font-Lock Line-Number Marginalia Menu-Bar Mouse-Wheel
> My-Global-Subword Org-Src Override-Global Selectrum
> Sh-Electric-Here-Document Shell-Dirtrack Straight-Package-Neutering
> Straight-Use-Package Subword Tooltip Transient-Mark Yas Yas-Global
>
>


Re: Separator "::" -> what is it for in headlines?

2021-05-01 Thread Diego Zamboni
Why does the separator "::" work with headlines?
>
It doesn't seem to have any effect for me, it gets handled as part of the
headline, both in fontification and in exports:

[image: image.png]
[image: image.png]

Which is, as I understand it, as it should be, since it doesn't have any
special meaning in headlines.

In your case it seems indeed to be getting fontified as if it were a list.
What version of Org do you have? I am using 9.5 on Emacs 27.2.

--Diego


Re: How to use `open` to handle `message:*` links on macOS

2021-04-29 Thread Diego Zamboni
Hi Tim,

Cool - thanks for the code! I may use it to improve my email capture
workflow :)

--Diego


On Thu, Apr 29, 2021 at 6:23 PM Tim Visher  wrote:

> Hi Diego and Alexander,
>
> Thanks for the tips here. I finally got around to trying them out. Here's
> what I ended up with and it's working perfectly.
>
> (defun timvisher-org-link-mac-mail-open-link
> (mid _)
>   (start-process "open-link" nil "open" (format "message://%%3C%s%%3E"
> mid)))
>
> (defun timvisher-org-link-mac-mail-add-message-links
> ()
>   (org-link-set-parameters
>"message" :follow #'timvisher-org-link-mac-mail-open-link))
>
> (eval-after-load 'org
>   '(timvisher-org-link-mac-mail-add-message-links))
>
> Pairing that with my org-capture TODO Current Mail Template is a dream
> come true. :)
>
> (defun timvisher-org-current-mail-get-selected-message-subject
> ()
>   (with-temp-buffer
> (call-process
>  "osascript" nil t nil
>  "-e" "tell application \"Mail\" to get subject of item 1 of (selection 
> as list)")
> (buffer-substring-no-properties (point-min) (- (point-max) 1
>
> (defun timvisher-org-current-mail-get-selected-message-id
> ()
>   (with-temp-buffer
> (call-process
>  "osascript" nil t nil
>  "-e" "tell application \"Mail\" to get message id of item 1 of 
> (selection as list)")
> (browse-url-url-encode-chars
>  (buffer-substring-no-properties (point-min) (- (point-max) 1))
>  "[/]")))
>
> (defun timvisher-org-current-mail-get-link-string
> ()
>   (let ((subject (timvisher-org-current-mail-get-selected-message-subject))
> (message-id (timvisher-org-current-mail-get-selected-message-id)))
> (org-link-make-string (format "message:%s" message-id)
>   subject)))
>
> (defun timvisher-org-current-mail-get-body-quote-template-element
> ()
>   (let ((body (setq body (with-temp-buffer
>  (call-process
>   "osascript" nil t nil
>   "-e" "tell application \"Mail\" to get content of item 1 of 
> (selection as list)")
>  (buffer-substring-no-properties (point-min) (- (point-max) 
> 1))
> (format "
>   #+begin_quote%s  #+end_quote"
> (string-join
>  (seq-reduce
>   (lambda (acc next)
> (if (string= next (or (car (last acc)) ""))
> acc
>   (append acc (list next
>   (mapcar (lambda (string)
> (let ((string (string-trim string)))
>   (if (string= "" string)
>   string
> (format "  %s" string
>   (split-string body "\n"))
>   '())
>  "\n"
>
> (setq org-capture-templates
>   '(…
> ("twcm" "TODO Work Current Mail" entry
>  (file+headline "~/Dropbox/todo/work.org" "Inbox")
>  "* TODO %(timvisher-org-current-mail-get-link-string)
>   %U%(timvisher-org-current-mail-get-body-quote-template-element)" :prepend t 
> :immediate-finish t)
> …))
>
> Thanks so much! :)
>


Re: Repository of Org files with important dates?

2021-04-16 Thread Diego Zamboni
Hi Rodrigo,

There are a few packages that define things like this, which can be added
to the agenda view. You can see as examples the ones I use for national
holidays in my config here:
https://github.com/zzamboni/dot-doom/blob/master/doom.org#tasks-and-agenda

I'm sure many others are available in MELPA and elsewhere.

--Diego

On Fri, 16 Apr 2021 at 04:21, Rodrigo Morales 
wrote:

>
> Hello everyone,
>
> Do any of you know whether there is a repository that contain Org files
> whose main purpose is to list important dates of a given context
> (specific countries, areas such as technology, biology, mathematics,
> computer science, etc.)?
>
> I'm asking this because I would like to have important dates of my
> country in the Org Agenda, so before creating that file on my own I
> wanted to know whether there are repositories that have already done
> that.
>
> ---
> alias: rdrg109
>
>


Re: Choosing a LaTeX Compiler (my predilection for LuaTeX)

2021-04-07 Thread Diego Zamboni
Hi Juan Manuel,

Thank you for writing this, which is the clearest explanation I have seen
of the advantages of LuaLaTeX/XeLaTeX. I have been using LaTeX for nearly
30 years, but stopped using it intensively every day when pdfLaTeX was
still the bleeding edge. When I started again in the last couple of years,
it has been a bit confusing to understand why and what all these different
versions are. These days I use LuaLaTeX as well, but most of the documents
I process are exported from Org-mode.

Best,
--Diego


On Mon, Apr 5, 2021 at 10:49 PM Juan Manuel Macías 
wrote:

> Hi all,
>
> There have been some threads recently about exporting to LaTeX, but I
> think something that I consider interesting for novice Org/LaTeX users
> has not been commented: the choice of the TeX engine. I think this is
> important because although people often say they "use LaTeX", what they
> actually use is TeX via the La-TeX format. What TeX engine to choose? I
> would dare to say the following: unless you want to maintain some
> backward compatibility with old documents, I highly recommend using
> LuaTeX or XeTeX, especially LuaTeX. Although pdfTeX is very popular
> among average or veterans LaTeX users, I think using it nowadays doesn't
> make much sense (IMHO). LuaTeX is the natural evolution of pdfTeX and
> adds the great advantage of accesing the TeX internals through Lua
> scripting.
>
> (What follows is specially intended for those Org users who haven't used
> XeTeX or LuaTeX yet).
>
> LuaTeX and XeTeX are *100% Unicode-based* and you can use your system
> fonts (open type, true type, etc.) in your documents in a simple way
> through the fontspec (https://www.ctan.org/pkg/fontspec) package, which
> provides a very neat interface and manages all OpenType features (LuaTeX
> and XeTeX use HarfBuzz as otf rendering engine). In LuaTeX also you can
> use any font that is not installed in your system: just indicate the
> path to the fonts files. This is very useful to test new fonts without
> installing them... In all modern word processing systems the user has
> always been able to pick a font easily, and that has been historically
> quite complex, hard and complicated in the (La)TeX ecosystem.
>
> For example, if we want to use globally the Palatino Linotype family in
> our LuaLaTeX document:
>
> \setmainfont{Palatino Linotype}
>
> We can add some OpenType features, like old style numbering:
>
> \setmainfont{Linux Libertine O}[Numbers=LowerCase]
>
> And if we want to use another font for italics, with certain properties
> (color[1] and scaling):
>
> \setmainfont{Crimson}
> [Numbers=Lowercase,
> ItalicFont=MinionPro-It.otf,
> ItalicFeatures={Color=red,
> Scale=MatchLowercase}]
>
> ([1] Requires the xcolor package)
>
> We can also define our own family with its properties (for example, with
> upper case numbers and letters tracking):
>
> \newfontfamily\myfamily{crimson}
> [Numbers=Lining,LetterSpace=3.0]
>
> Furthermore (for more advanced users), in LuaTeX we can define new
> opentype features on the fly, both positional and of substitution (as
> long as the typeface includes the glyphs needed to replace). For
> example, if I use the Crimson typeface, a contextual substitution for
> character Q + u can be defined, by including some Lua code through the
> LuaTeX primitive `directlua':
>
> \directlua{
>fonts.handlers.otf.addfeature{
> name = "mycontextual",
> type = "chainsubstitution",
> lookups = {
>   {
> type = "substitution",
> data = {
>   ["Q"] = "Q.alt01",
> },
>   },
> },
> data = {
>   rules = {
> {
>   after  = { { "u" } },
>   current = { { "Q" } },
>   lookups = { 1 },
> },
>   },
> },
>   }
> }
>
> ... And add anywhere in the text:
>
> \addfontfeature{RawFeature=+mycontextual}
>
> If I had to choose, finally, between XeTeX and LuaTeX, I would choose
> LuaTeX, for things like these and many other reasons. In addition, there
> are emerging cool new packages that only work with LuaTeX.
>
> Anyway, XeTeX is another very good option too, especially for users who
> prefer something that works more "out of the box" and is less esotheric
> than LuaTeX.
>
> To export to PDF always with LuaTeX we can put in our ~ /.emacs:
>
> (setq org-latex-pdf-process
>   '("lualatex -shell-escape -interaction nonstopmode -output-directory
> %o %f"
> "lualatex -shell-escape -interaction nonstopmode -output-directory
> %o %f"
> "lualatex -shell-escape -interaction nonstopmode -output-directory
> %o %f"))
>
> Or with latexmk, which will take care of compiling as many times as
> necessary for indexes, bibliographies, etc .:
>
> (setq org-latex-pdf-process
>   '("latexmk -lualatex -e '$lualatex=q/lualatex %%O -shell-escape
> %%S/' %f"))
>
> Best regards,
>
> Juan Manuel
>
>


Re: First steps exporting to tex

2021-04-03 Thread Diego Zamboni
>
>
> The org export to latex only needs to be as complicated as you need it
> to be. Org has variables which can be used to add/remove things from the
> preamble and once you have those configured, you don't have to put
> anything in the org file itself. Start simple and add as you find a need
> rather than try to start with something complex which might not be
> necessary.
>

I fully agree with Tim here - don't make things more complicated than
necessary! Start with standard Org and the standard export, see how it
works and adjust from there. At the far end you can end up with a custom
exporter based on ox-latex, but which gives special meanings to certain
elements - this is what I ended up with for my CV in ox-awesomecv (
https://gitlab.com/zzamboni/org-cv/-/tree/awesomecv), but this was after a
lot of experimentation and playing with the default Org exporters.
Ultimately it depends on what type of document you are producing, so there
can be no single all-encompassing solution.

But really, start simple. Org and LaTeX are both complex enough as they are.

--Diego


Re: Using backticks for the inline code delimeter?

2021-03-31 Thread Diego Zamboni
The approach I've taken is to try and stop using Markdown altogether and
write everything in Org, exporting to Markdown for those destinations that
need it.

You could even use https://github.com/tecosaur/org-pandoc-import to
automatically convert/reconvert other formats as needed, and
https://github.com/tecosaur/emacs-everywhere to do it even in other
applications.

It's not perfect - I still have to type Markdown sometimes, but you
can eventually start losing the ingrained backtick habit :)

--Diego



On Wed, Mar 31, 2021 at 8:49 PM George Mauer  wrote:

> Markdown uses backticks to denote inline code which should get special
> (typically monospace) formatting, org uses the tilde character.
>
> Now I know that org is not markdown, is far more powerful than markdown,
> and is not (mostly) the same use cases as markdown. But this one use case
> *does* overlap. And the backticks thing is becoming so ingrained that not
> only do I reach for it all the time, but I've seen it crop up on this very
> mailing list and even in some README.org documents.
>
> I would like to submit that org consider adopting backticks as an
> alternate way of denoting inline code.
>
> Aside from any official movement, I would like to add this to my own files
> - is there a straightforward way to extend the org parser to do this?
>


Re: MacOS (emacsformacosx) c-spc, does not run set-mark-command

2021-03-25 Thread Diego Zamboni
On Thu, 25 Mar 2021 at 08:28, Uwe Brauer  wrote:

> Right, it seems and issue of the OS shortcuts as C-space is for
> switching keyboards (US->spanish>etc etc).[1]
>
> Do you know how to change or disable them?
>
> Uwe
>
>
>
> Footnotes:
> [1]  the same happens on Linux/KDE


On macOS, these shortcuts can be changed in the Keyboard preference panel.

--Diego


>
>


Re: MacOS (emacsformacosx) c-spc, does not run set-mark-command

2021-03-24 Thread Diego Zamboni
I have seen differences in this behavior depending on the Emacs build. The
emacs-mac port (https://github.com/railwaycat/homebrew-emacsmacport) seems
to intercept certain Mac-specific keybindings such as C-space and C-M-space
and gives them their "Mac meaning", e.g. to bring up Spotlight or the
symbol chooser. I could never figure out how to disable this behavior.

Now I use emacs-plus (https://github.com/d12frosted/homebrew-emacs-plus)
and this no longer happens.

--Diego



On Wed, Mar 24, 2021 at 10:34 PM Tim Cross  wrote:

>
> Uwe Brauer  writes:
>
> > Hi
> >
> > Does anybody know how to achieve the traditional binding of
> > C-space to set-mark-command on MacOS (for emacsformacos)?
> >
> > Shift arrow down works, but will not work for a lot of features in org
> > mode.
> >
>
> Have you verified c-space is not being used by the macOS UI as a
> shortcut for something like spotlight search?
>
> I now use spacemacs, but when I used my own setup, I don't recall having
> to do anything special to get this behaviour apart from disabling macOS
> shortcuts.
>
> --
> Tim Cross
>
>


Re: Exam LaTeX class

2021-03-24 Thread Diego Zamboni
Hi Xianwen,

I think the easiest way to conditionally include text in the preamble of
the document would be by including a file which can be empty sometimes, and
contain the appropriate text when needed. For example, you could have
something like this in your Org file:

#+include: ./printanswers.org
#+TITLE: Test
...


Then the following function will automatically export the file twice, one
with the \printanswers command inserted then rename the resulting file, and
export again without:

(defun org-latex-export-exams ()
  (interactive)
  (write-region "#+latex_header: \\printanswers" nil "printanswers.org")
  (org-latex-export-to-pdf)
  (rename-file (org-export-output-file-name ".pdf")
(org-export-output-file-name "-with_answers.pdf"))
  (write-region "" nil "printanswers.org")
  (org-latex-export-to-pdf))


You can then run M-x org-latex-export-exams to generate both files.

Hope this helps,
--Diego


On Wed, Mar 24, 2021 at 11:21 AM Xianwen Chen (陈贤文) 
wrote:

> Dear Christine (and CC list),
>
> Thank you!
>
>
>
> On 2021-03-19 10:13, Christine Köhn wrote:
>
> Here is one way to do the latex part. You could pass a jobname to latex.
>
> I have this
>
> \IfEndWith*{\jobname}{withsolution}{%
>   \usepackage{todonotes}
>   \printanswers
> }{\usepackage[disable]{todonotes}}
>
> in a myexam.sty file to switch between modes (with or without solutions
> and todo notes) and use it in the latex file with
>
> \usepackage{myexam}
>
> You could add your own latex class to org-latex-classes and add this
> line there.
>
> The jobname has to be passed to latex with something like -jobname
> withsolution if you want it to be with solutions. I use a Makefile for
> this purpose which calls latexmk
>
> latexmk -pdf -pdflatex="pdflatex --interaction=errorstopmode" -use-make
>
> and adds -jobname=$(basename $@) if asked to create a pdf ending with
> withsolution.pdf. I can send you the Makefile if you're interested.
>
>
> That's very interesting way to solve the problem using LaTeX. Thank you
> for sharing this. At the moment I'm leaning more towards solving it using
> emacs lisp.
>
>
> To use the jobname from within orgmode, you'll have to change
> org-latex-pdf-process to use the jobname if needed. I think one way to
> achieve this is to add a new export backend which is derived from latex
> (see org-export-define-derived-backend) and which sets
> org-latex-pdf-process accordingly (and resets it afterwards).
>
>
> Thank you again. I'm thinking of a function like following. I'm using
> comments to express the programming detail that I don't know how to do yet.
>
> (deffun org-latex-export-to-pdf-exam ()
>   (interactive)
>   # do some emacs lisp to add \printanswers to the end of org document
> header, i.e., adding a line of #+LATEX_HEADER: \printanswers
>   (org-latex-export-to-pdf)
>   # do some emacs lips to move the foo.pdf to foo-with_solutions.pdf
>   # do some emacs lisp to add \noprintanswers to the end of org document
> header, i.e., removing the line of #+LATEX_HEADER: \printanswers and adding
> a line of #+LATEX_HEADER: \noprintanswers
>   (org-latex-export-to-pdf)
>   # remove the line of #+LATEX_HEADER: \noprintanswers
> )
>
> I don't know enough emacs lisp to fill in the details here for now.
> However, I think this would be a way to do it within emacs. So each time I
> call org-latex-export-to-pdf-exam, it would export two PDF files, one with
> solutions and one without.
>
> What do you think?
>
> Yours sincerely,
> Xianwen
>


Re: Org as a book publisher

2021-03-07 Thread Diego Zamboni
Hi Juan Manuel,

Thanks for sharing this - the output looks very nice.

I think with Org and a setup like you describe, we are one step closer to
separating content (what) from form (how) in a document. This was one of
the original goals of LaTeX, but of course in a LaTeX document much of the
"how" is still visible through the "what". With Org the separation becomes
clearer, by hiding the LaTeX structures (almost) completely, and by
allowing to produce multiple formats from the same source document.

I have done something similar with my books, which I publish through
Leanpub. I keep the source of each book in Org, and from there the exporter
takes care of producing the Leanpub markup and format, which in turn takes
care of converting it to PDF, ePub or other formats.

Best,
--Diego



On Sat, Mar 6, 2021 at 8:35 PM Juan Manuel Macías 
wrote:

> Hi,
>
> I would like to share here two samples of one of the most intense uses
> that I give Org Mode: for typesetting, layout and editorial design. In
> other words, I use Org (and Org-Publish) where publishers today use DTP
> proprietary software like InDesign or QuarkXpress (a type of software,
> on the other hand, that was never intended to compose books but rather
> magazines, posters, brochures and so on). The samples are from a book
> on classical philology, recently published here in Spain, and from a
> fairly extensive dictionary, still work in progress:
>
> https://imgur.com/gallery/yxAVkrY
>
> Naturally, what acts in the background here is TeX and LaTeX
> (specifically Lua(La)TeX), so what I really do is use Org and
> Org-Publish as a sort of high-level interface for LaTeX. But I don't
> mean to avoid LaTeX: in fact, I've been working with LaTeX for a long
> time. I like LaTeX and behind these jobs there is a lot of LaTeX code.
> But Org gives me a much more light and productive workflow, allowing me
> to work at two levels.
>
> The main advantages that I see for this workflow with Org/Org-Publish
> are:
>
> 1. Lightness: LaTeX is too verbose.
> 2. Control of the composition process at various points. One of the
>qualities of LuaTeX is the possibility to control TeX primitives
>through scripts in Lua, and to act at various points in the pre- or
>post-process. But I have realized that with the happy fusion of Elisp
>and Org we can be much more precise and "surgical" ;-). Here,
>Org/LaTeX is much more powerful than LuaLaTeX.
> 3. Org's synaptic and org-anizational ability to control and manage the
>entire process of the creation of a book, from when the originals are
>received until everything is prepared to send to the printer.
> 4. An unique origin. The book can be produced on paper from a single
>source, but you can also export, from that source consistently, to
>other formats (HTML or Epub).
>
> Best regards,
>
> Juan Manuel
>
>


Re: 'false' list item

2021-02-21 Thread Diego Zamboni
Juan Manuel,

YMMV depending on your needs and habits, but another workaround for this
problem would be to use visual-line-mode instead of filling paragraphs.

--Diego




On Sun, Feb 21, 2021 at 8:34 PM Juan Manuel Macías 
wrote:

> Kyle Meyer  writes:
>
> > It seems that your approach would do a good job of helping you catch
> > cases that you don't want to be treated as lists.  I'm not aware of any
> > related functionality in Org, so I don't think you're missing something
> > there.
> >
> > Once you know that there is a particular spot that you want to prevent
> > from being interpreted as a list, you could add a zero-width space in
> > front of it:
> >
> > (info "(org)Escape Character")
> >
> > I'm not sure if that's the sort of solution you're asking for, though.
>
> Thanks for your advice, Kyle. Adding the U+200B char. works fine to
> avoid false positives. Anyway, like Tim Cross says, that situation
> maybe should be considered as a bug. I think the ideal behavior would
> be for Org to consider a list only when there is a blank line above.
> But, well thought out, I am afraid that it would not prevent false
> positives, as one may want perfectly write a list at the beginning of
> the document, or start a plain paragraph with (for example) a digit + a
> period + a space...
>
> Best regards,
>
> Juan Manuel
>
>


Re: Where has the manual on one html page gone?

2021-02-16 Thread Diego Zamboni
I'm not the OP, but I find the one-page manual useful when I'm not sure
what I'm looking for or where in the manual it might be, makes it easier to
search through the whole document iteratively.

--Diego

On Mon, Feb 15, 2021 at 11:47 PM Nick Dokos  wrote:

> Christine Köhn  writes:
>
> > Hi,
> >
> > I always used the manual online as one html page but it does not seem to
> > be available since (?) the website revamp. I prefer the manual as one
> > page for many reasons. Is it still available online?
> >
>
> I've always used the one-page per section version on the web (although
> I tend to use Info much more often), primarily because I thought that
> downloading the whole manual to just look at a section or two or five
> would be inefficient - in fact, I've wondered why the single-page
> versions of various manuals (particularly the larger ones: emacs and
> elisp) are made available. So it is idle curiosity on my part, but
> what are the the reasons for your preference?
>
> --
> Nick
>
> "There are only two hard problems in computer science: cache
> invalidation, naming things, and off-by-one errors." -Martin Fowler
>
>
>


Re: Where has the manual on one html page gone?

2021-02-12 Thread Diego Zamboni
Hi Christine,

I found it here: https://orgmode.org/org.html

But it doesn't seem to be linked from the new website.

--Diego


On Fri, Feb 12, 2021 at 5:13 PM Christine Köhn  wrote:

> Hi,
>
> I always used the manual online as one html page but it does not seem to
> be available since (?) the website revamp. I prefer the manual as one
> page for many reasons. Is it still available online?
>
> Best,
> Christine
>
>


Re: 2 Surprises and 2 Questions Regarding Org Tangle

2021-02-11 Thread Diego Zamboni
Jia,

#2 is known (maybe documented? Not sure) behavior: using :noweb-ref
accumulates multiple blocks with the same name, whereas #+NAME uses only
the first one. I think #+NAME's are supposed to be unique within a document.

I don't know about #1, the output from your P1 example seems surprising to
me as well.

--Diego



On Thu, Feb 11, 2021 at 5:13 PM Lee Jia Hong  wrote:

> (First time posting to a mailing list, please correct me if I did
> something wrong.)
>
> TLDR:
> Surprise 1: Different Noweb reference placing styles produces different
> tangled results.
> Question 1: Is it a bug?
>
> Surprise 2: Source block naming with #+NAME: and :noweb-ref produce
> different tangled results.
> Question 2: Is it a bug?
>
> 
>
> Hi,
>
> I stumble upon this article (https://www.hhyu.org/posts/literate_config/),
> and there are two things that standout:
> 1. the way author places the Noweb reference, i.e.:
>   (setq org-capture-templates
>   '(
> <>
>)
>   )
> 2. the way he uses :noweb-ref to tangle multiple code blocks to the same
> Noweb reference.
>
>
>
> * Surprise 1: Different Noweb Reference Placing Styles Produces Different
> Tangled Results
>
> 
> The way he places the Noweb reference intrigues me, so I try writing it in
> different (placing) styles:
> P1:
> (setq org-capture-templates '(<>))
>
> P2:
> (setq org-capture-templates
>   '(<>))
>
> P3:
> (setq org-capture-templates
>   '(
> <>))
>
> P4:
> (setq org-capture-templates
>   '(
> <>
> ))
>
> Tangled results using P3 and P4 styles match my expectations. But the
> results of P1 and P2 styles surprise me.
>
> Expected result for P1:
> #+begin_example
> (setq org-capture-templates '(("t" "TODO inbox"
>entry
>(file "~/gtd/capture.org")
>"* TODO %?
>SCHEDULED: %t")
>   ("n" "notes inbox"
>entry
>(file "~/gtd/inbox.org")
>"* %T\n%i%?")))
> #+end_example
>
> Actual result:
> #+begin_example
> (setq org-capture-templates '(("t" "TODO inbox"
> (setq org-capture-templates '( entry
> (setq org-capture-templates '( (file "~/gtd/capture.org")
> (setq org-capture-templates '( "* TODO %?
> (setq org-capture-templates '(SCHEDULED: %t")
> (setq org-capture-templates '(("n" "notes inbox"
> (setq org-capture-templates '( entry
> (setq org-capture-templates '( (file "~/gtd/inbox.org")
> (setq org-capture-templates '( "* %T\n%i%?")))
> #+end_example
>
> Expected result for P2:
> #+begin_example
> (setq org-capture-templates
>   '(("t" "TODO inbox"
>  entry
>  (file "~/gtd/capture.org")
>  "* TODO %?
> SCHEDULED: %t")
> ("n" "notes inbox"
>  entry
>  (file "~/gtd/inbox.org")
>  "* %T\n%i%?")))
> #+end_example
>
> Actual result:
> #+begin_example
> (setq org-capture-templates
>   '(("t" "TODO inbox"
>   '( entry
>   '( (file "~/gtd/capture.org")
>   '( "* TODO %?
>   '(SCHEDULED: %t")
>   '(("n" "notes inbox"
>   '( entry
>   '( (file "~/gtd/inbox.org")
>   '( "* %T\n%i%?")))
> #+end_example
>
> Question 1: Is this a bug? If not, how can I make sure that style P1 and
> P2 produce the expected results?
>
>
>
> * Surprise 2: Source Block Naming with #+NAME: and :noweb-ref Produce
> Different Tangled Results
>
> ---
> I have been naming my source blocks with #+NAME, and it's my first time
> realising that it's possible to tangle multiple source blocks to a single
> Noweb reference. To try it out, I write the reference holder like this:
> #+begin_src emacs-lisp
> (setq org-capture-templates
>   '(
> <>))
> #+end_src
> (Note: Use placing style P3 because styles P1 and P2 doesn't work as
> expected, see Surprise 1 above)
>
> Then follow by source blocks named with #+NAME:
> #+NAME: ORG_CAPTURE
> #+begin_src emacs-lisp
> ("t" "TODO inbox"
>  entry
>  (file "~/gtd/capture.org")
>  "* TODO %?
> SCHEDULED: %t")
> #+end_src
>
> #+NAME: ORG_CAPTURE
> #+begin_src emacs-lisp
> ("n" "notes inbox"
>  entry
>  (file "~/gtd/inbox.org")
>  "* %T\n%i%?")
> #+end_src
>
> Expected result:
> #+begin_example
> (setq org-capture-templates
>   '(
> ("t" "TODO inbox"
>  entry
>  (file "~/gtd/capture.org")
>  "* TODO %?
> SCHEDULED: %t")
> ("n" "notes inbox"
>  entry
>  (file "~/gtd/inbox.org")
>  "* %T\n%i%?")))
> #+end_example
>
> Actual result:
> #+begin_example
> (setq 

Re: Exporting from Org to Gift/Aiken or other quiz formats

2021-02-09 Thread Diego Zamboni
Hi Eric,

Thanks for the pointer! I had not seen it. It would seem delightfully
convoluted to go Org -> LaTeX -> Moodle, but it might just work :) I'll
take a look when I have some more time to devote to this. For now I've been
semi-manually converting my quizzes into Gift format for import into Moodle.

Best,
--Diego


On Tue, Feb 9, 2021 at 10:58 AM Eric S Fraga  wrote:

> On Wednesday, 13 Jan 2021 at 12:31, Diego Zamboni wrote:
> > Hi everyone,
> >
> > I've started to develop online teaching materials with Moodle (
> > https://moodle.com/), and I'm looking for ways to generate my content
> > using Org as much as possible.
>
> Diego,
>
> did you have a look at the LaTeX package for moodle quizzes?
>
> https://anorien.csc.warwick.ac.uk/mirrors/CTAN/macros/latex/contrib/moodle/
>
> It may be possible (albeit probably non-trivial) to use org to export to
> suitable LaTeX that uses this package, along the lines of beamer
> piggy-backing on the LaTeX export?
>
> I'm done using moodle for the academic year now (as of today!) so won't
> be looking at this any time soon (really must get back into my research
> after the COVID-19 disruption...)  but that LaTeX package seems to cover
> all the cases I would need.
>
> HTH,
> eric
>
> --
> : Eric S Fraga via Emacs 28.0.50, Org release_9.4.4-213-g49364f
>


Re: Account for latex snippet width in fill paragraph

2021-02-09 Thread Diego Zamboni
I can only agree with Eric - I think visual-line-mode is the best way to
deal with variable-length content in paragraphs.

--Diego

On Tue, Feb 9, 2021 at 10:47 AM Eric S Fraga  wrote:

> On Monday,  8 Feb 2021 at 22:43, Matt Huszagh wrote:
> > Before I take a crack at this, has anyone else attempted to remedy this?
>
> I don't have this issue because I use visual-line-mode (together with
> org-indent-mode) and text reflows automatically.  Every paragraph is a
> single "line" in the org file but is (soft) wrapped automatically at the
> window edge.  But this may not suit you, of course.
>
> --
> : Eric S Fraga via Emacs 28.0.50, Org release_9.4.4-213-g49364f
>
>


Re: How to avoid generating the Table of Contents when exporting to markdown?

2021-01-30 Thread Diego Zamboni
You can disable export of the TOC by setting the toc option to nil, with a
line like this at the top of the file:

#+options: toc:nil

See https://orgmode.org/manual/Table-of-Contents.html

--Diego


On Sat, Jan 30, 2021 at 11:21 PM Rodrigo Morales <
moralesrodrigo1...@gmail.com> wrote:

>
> When answering questions in Emacs Stack Exchange, I usually write my answer
> in Org Mode and then export it to Markdown so that I can copy it to the
> answer textbox in Stack Exchange. For this reason, I don't need the
> export to contain a Table of Contents because the Markdown content is
> not big enough to require it.
>
> For this reason, I don't want the Table of Contents to be included when
> exporting.
>
> --
> Greetings,
> Rodrigo Morales.
>
>


Re: what happened to org-insert-structure-template

2021-01-27 Thread Diego Zamboni
Also works for me, Org version 9.5.

Could it be that just the keybinding got un/redefined somehow? Have you
tried running M-x org-insert-structure-template?

--Diego

On Wed, Jan 27, 2021 at 10:45 PM  wrote:

> On Wed, Jan 27, 2021 at 09:29:14PM +, JRSS wrote:
> > Hi,
> >
> > This has been missing for a while for me and I recently checked the
> manual. It seems like org-insert-structure-template doesn't exist. I tried
> Emacs -q, same thing. I also loaded org-tempo, thought it has something to
> do with it, but nothing.
>
> Hm. Works for me (Org 9.4.4).
>
> > How do I activate is so that C-c C-, works?
>
> Strange. C-h f org-insert-structure-template turns up empty?
>
> Cheers
>  - t
>


Re: Exporting from Org to Gift/Aiken or other quiz formats

2021-01-13 Thread Diego Zamboni
Hi Eric,


> I did not manage to develop an exporter for moodle.  I did write a very
> hackish awk script that takes a sort of org document (i.e. it is an org
> document but has to follow a strict layout) and creates a Moodle XML
> format file.
>
> Lots of introspection of exported Moodle quizzes to figure out some of
> the basics...  What I've got does the job so long as you only want
> multiple choice questions and numeric answer questions (with tolerances)
> and provides question specific feedback.  As I said, very hackish...
>

Thanks! I found there is http://www.qml2xml.pro/, which is a custom markup
language for quizzes, and from which Moodle XML can be exported.
Unfortunately the tool seems to be online-only, no downloadable version I
could find. And also, the QML format is a bit strange.

I also started exploring the Moodle XML format, but I was happy to discover
Moodle can also import other formats. I think I might stick to GIFT, Aiken
or some other text-based format, since they seem easier to manipulate
(albeit of course less powerful).

My ultimate ideal goal would be to be able to export a whole Org document
into the whole contents of a course, including Books/pages (not sure yet if
Moodle can import Markdown or something else), quizzes, etc. But quizzes
would be a good start :)

I'll keep you posted if I come up with anything.

--Diego


Exporting from Org to Gift/Aiken or other quiz formats

2021-01-13 Thread Diego Zamboni
Hi everyone,

I've started to develop online teaching materials with Moodle (
https://moodle.com/), and I'm looking for ways to generate my content using
Org as much as possible.

For quizzes, Moodle can import various known question/answer formats,
including GIFT, Aiken, Moodle's own XML format, and a few others:

- Aiken format
- Blackboard
- Embedded answers (Cloze)
- Examview
- GIFT format
- Missing word format
- Moodle XML format
- WebCT format

I was wondering if anyone has any experience or pointers to existing ways
of exporting from Org to some of these formats.

Eric: I found this old thread:
https://lists.gnu.org/archive/html/emacs-orgmode/2015-08/msg01219.html -
did you ever develop or find a way to do the export? Otherwise I might take
a shot at it, using Marcin's code as a starting point.

Thanks in advance!
--Diego


Re: How to use `open` to handle `message:*` links on macOS

2021-01-11 Thread Diego Zamboni
Hi Tim,

Look at the org-mac-link package from org-contrib, it allows doing this for
Mail.app and other Msc apps.

--Diego

On Mon, 11 Jan 2021 at 20:47, Tim Visher  wrote:

> Hi Everyone,
>
> I'd like to be able to whack `C-c C-o` on `message:*` links on macOS and
> have it call `open` on the contents. Is there a way to make that happen?
>
> My intent is to be able to save a deep link to a Mail.app message in an
> org document.
>
> Thanks in advance!
>
> --
>
> In Christ,
>
> Timmy V.
>
> https://blog.twonegatives.com
> http://five.sentenc.es
>


Re: xclip/pbcopy/clipboard 'target' for export backends?

2021-01-05 Thread Diego Zamboni
Hi Tim,

Funny - just a few minutes ago, before reading your message, I learned
while installing https://github.com/stig/ox-jira.el, about =
org-export-copy-to-kill-ring=:

org-export-copy-to-kill-ring is a variable defined in ox.el.

Non-nil means pushing export output to the kill ring.

This variable is ignored during asynchronous export.


In my brief testing, it does exactly what you want: regardless of the
export output or method (to a file or to a temporary buffer), the result is
placed in the clipboard.

Best,
--Diego


On Tue, Jan 5, 2021 at 3:03 PM Tim Visher  wrote:

> Hi Everyone,
>
> I'm interested in adding something to the export dispatcher that would
> automatically put the exported text (or perhaps even file?) onto my
> clipboard.
>
> Preferably I'd like to define this once and have it available to each
> backend. So maybe I want markdown this time but rather than to a buffer or
> file I want it to go straight to my clipboard. Next time I want HTML or
> Plain Text but the same thing.
>
> Can anyone give me some hints on where to start looking for that? Or maybe
> it's already been done?
>
> Thanks in advance!
>
> --
>
> In Christ,
>
> Timmy V.
>
> https://blog.twonegatives.com
> http://five.sentenc.es
>


Re: ist here a :post header arg for tangling?

2021-01-04 Thread Diego Zamboni
Agree. It should be possible to make the hook file-local, but still it's
not trivial to have good control over where and how the changes are made.

--Diego


On Mon, Jan 4, 2021 at 3:51 PM Immanuel Litzroth <
immanuel.litzr...@gmail.com> wrote:

> There's that, but you're not gonna do much with that since it is
> global to emacs. If you're brimming
> with vigour you might achieve what you want by rebinding that each
> time you tangle to do the correct
> thing. Not much information is available in that hook, you get dropped
> into a temp buffer containing the
> result of tangling.
> Immanuel
>
> On Mon, Jan 4, 2021 at 3:07 PM Diego Zamboni  wrote:
> >
> > There's =org-babel-post-tangle-hook=, which AFAICT specifies hooks that
> will be run with the tangled code in a temporary buffer. I couldn't find
> much documentation nor examples, but it is mentioned at
> https://orgmode.org/manual/Extracting-Source-Code.html#Hooks-3
> >
> > --Diego
> >
> >
> >
> >
> >
> > On Fri, Jan 1, 2021 at 1:31 PM Immanuel Litzroth <
> immanuel.litzr...@gmail.com> wrote:
> >>
> >> I don't think there is an arg for that. I have written a tangler that
> >> reuses a lot
> >> of the org-babel machinery and has a more flexible mechanism to decide
> what
> >> to do with the tangled code -- I use it for example to not write a
> >> tangled file if it
> >> hasn't changed, meaning that it will not trigger recompile.
> >> The project is private now but if you're interested I can give you
> access to it.
> >> What exactly are you trying to do?
> >> Immanuel
> >>
> >> On Fri, Jan 1, 2021 at 2:09 AM George Mauer  wrote:
> >> >
> >> > I'd like to run some code to post-process files after they are
> tangled. Is there a header-arg for that?
> >>
> >>
> >>
> >> --
> >> -- Researching the dual problem of finding the function that has a
> >> given point as fixpoint.
> >>
>
>
> --
> -- Researching the dual problem of finding the function that has a
> given point as fixpoint.
>


Re: ist here a :post header arg for tangling?

2021-01-04 Thread Diego Zamboni
There's =org-babel-post-tangle-hook=, which AFAICT specifies hooks that
will be run with the tangled code in a temporary buffer. I couldn't find
much documentation nor examples, but it is mentioned at
https://orgmode.org/manual/Extracting-Source-Code.html#Hooks-3

--Diego





On Fri, Jan 1, 2021 at 1:31 PM Immanuel Litzroth <
immanuel.litzr...@gmail.com> wrote:

> I don't think there is an arg for that. I have written a tangler that
> reuses a lot
> of the org-babel machinery and has a more flexible mechanism to decide what
> to do with the tangled code -- I use it for example to not write a
> tangled file if it
> hasn't changed, meaning that it will not trigger recompile.
> The project is private now but if you're interested I can give you access
> to it.
> What exactly are you trying to do?
> Immanuel
>
> On Fri, Jan 1, 2021 at 2:09 AM George Mauer  wrote:
> >
> > I'd like to run some code to post-process files after they are tangled.
> Is there a header-arg for that?
>
>
>
> --
> -- Researching the dual problem of finding the function that has a
> given point as fixpoint.
>
>


Re: How to reload org agenda files without restarting emacs...?

2020-12-29 Thread Diego Zamboni
Maybe a bit of a shotgun approach, but M-x org-revert-all-org-buffers
reloads all org buffers from disk, after which a simple refresh of the
agenda view will display the changed items.

This will of course discard any unsaved changes in open buffers, so use
with caution :)

--Diego


On Tue, Dec 29, 2020 at 5:22 PM Carlo Tambuatco 
wrote:

> Suppose I share agenda files with other computers on the network, and
> someone else changes an org
> agenda file that I use, how do I update the agenda view to see those
> changes reflected within
> emacs without having to restart emacs?
>
> Is there an org mode command for this?
>


Re: Org to ConTeXt exporter?

2020-12-28 Thread Diego Zamboni
By the way, I just realized that the ox-pandoc exporter (
https://github.com/kawabata/ox-pandoc) has a number of "context" options,
since Pandoc itself supports ConTeXt output. I have no idea how well it
works, but it could be an option for ConTeXt users for the time being.

--Diego


On Mon, Dec 28, 2020 at 7:03 PM Juan Manuel Macías 
wrote:

> Hello, Diego,
>
> Diego Zamboni  writes:
>
> > I have never used ConTeXt, but from what I've seen, despite its many
> > differences, a lot is still similar to TeX/LaTeX (e.g. math). Given
> > this, I think it might be easier to create a new derived exporter from
> > ox-latex, and override the parts that differ, instead of creating a
> > new one completely from scratch.
>
> You are right, maybe it is better to start with ox-latex, since LaTeX
> and ConTeXt are related.
>
> > You can see an example in my own
> > https://github.com/zzamboni/ox-leanpub/blob/master/ox-leanpub-markua.el,
> > which uses ox-md as a backend for defining the new ox-markua exporter.
>
> Thank you very much for the link. As soon as I have some time I will
> study your code
>
> Regards,
>
> Juan Manuel
>


Re: Org to ConTeXt exporter?

2020-12-28 Thread Diego Zamboni
I have never used ConTeXt, but from what I've seen, despite its many
differences, a lot is still similar to TeX/LaTeX (e.g. math). Given this, I
think it might be easier to create a new derived exporter from ox-latex,
and override the parts that differ, instead of creating a new one
completely from scratch.

You can see an example in my own
https://github.com/zzamboni/ox-leanpub/blob/master/ox-leanpub-markua.el,
which uses ox-md as a backend for defining the new ox-markua exporter.

There is also already some documentation at
https://orgmode.org/worg/dev/org-export-reference.html

--Diego


On Mon, Dec 28, 2020 at 4:09 PM Marcin Borkowski  wrote:

>
> On 2020-12-28, at 14:38, Juan Manuel Macías 
> wrote:
>
> > Hi,
> >
> > Just out of curiosity, I am wondering if there are plans to create an
> > Org to ConTeXt exporter in the future, or if there is already some work
> > in progress on this front.
> >
> > I have to say that among TeX formats I tend to prefer LaTeX to ConTeXt;
> > but ConTeXt has very interesting features (grid typesetting, for
> > example) that LaTeX lacks (for now) and has a more monolithic structure,
> > that is, it does not need to be extended through packages as in LaTeX.
>
> Creating an exporter from scratch is probably easier than you think.
> A few years ago I planned a tutorial about this, but another job
> happened, then covid happened etc.  Now that I finished some big project
> taking me a lot of time, I might be tempted to revisit that.  Would
> there be demand for a DYI Org-exporter-from-scratch tutorial?
>
> Best,
>
> --
> Marcin Borkowski
> http://mbork.pl
>
>


Re: Let emacs align all columns automatically on-the-fly within orgmode.

2020-12-28 Thread Diego Zamboni
Normally, pressing TAB in any cell will align the whole table and move  the
cursor to the next cell.

--Diego

On Mon, 28 Dec 2020 at 02:06, Hongyi Zhao  wrote:

> When editing a table in orgmode, the columns become no longer aligned.
> How to let emacs align all columns automatically on-the-fly within
> orgmode?
>
> Regards
> --
> Assoc. Prof. Hongyi Zhao 
> Theory and Simulation of Materials
> Hebei Polytechnic University of Science and Technology engineering
> NO. 552 North Gangtie Road, Xingtai, China
> 
>
>


Re: A way to avoid unwanted new lines when using paragraph quotes?

2020-12-27 Thread Diego Zamboni
>
> Hmm, that fixes the new line before the "sub bullet under test 3, with
> a quote".  However, a new line still remains after the quote ends (and
> before the "Test 4" starts).  Is it possible to nuke that too?  If
> not, that's okay, I can live with it. :-)
>

That should be possible with CSS as well, but as I'm not a CSS expert, I'll
leave it for you to figure out :)

--Diego


Re: M-s is undefined.

2020-12-27 Thread Diego Zamboni
>
> M-S-LEFT (org-table-delete-column)
> Kill the current column.
>
> But the keystroke combination doesn't work as expected, instead it
> triggers the following info in the bottom minibuffer:
> M-s  is undefined.


Which keys, exactly, are you pressing?

M-S-Left in Emacs Key Notation (
https://www.emacswiki.org/emacs/EmacsKeyNotation) refers to
Meta-Shift-Left, which in my testing works as expected, but the message you
see, as posted, corresponds to what happens when you press Meta-s (the
letter S) followed by "Left".

Best,
--Diego


Re: A way to avoid unwanted new lines when using paragraph quotes?

2020-12-27 Thread Diego Zamboni
Hi Kashyap,

The problem seems to be that when the HTML exporter finds more than one
element within a list item, it wraps each one in its own set of
=...= tags, which creates the additional space. You can see that
this has nothing to do with the quotes, just inserting a second paragraph
within the list item triggers this, e.g.:

--
3. Test 3
   - sub bullet under test 3, with a quote:

 another paragraph within the bullet
--

As Juan Manuel suggested, one way to fix the visual difference is with CSS.
To be more selective, you could style only  items with a , like this:

#+HTML_HEAD: li p { margin: 0em; }

In my test, this eliminates the spacing before those items, making them all
look the same in the browser.

Looking at the ox-html code, there doesn't seem to be a way to prevent this
from happening at the moment, a plain paragraph is always wrapped in 
tags.

Hope this helps,
--Diego


On Sun, Dec 27, 2020 at 2:03 PM Kashyap Chamarthy 
wrote:

> Hi, folks —
>
> First of all, many thanks to the contributors for their work on
> Org-Mode.  I'm a happy (novice) user; first time poster here. :-)
>
> I have a seemingly trivial aesthetic problem. I've attached the
> reproducer .org file and its HTML export to demonstrate it.  I'm sure
> advanced users might recognize the problem immediately. As you notice
> in my HTML export: An unwanted new line is added between "Test 3" and
> "sub bullet under test 3, with a quote" (which uses
> BEGIN_QUOTE/END_QUOTE in the .org file). Likewise, a new line is added
> before "Test 4" starts.   And yet again, a new line under "Test 6" and
> its sub bullet.
>
> Is there a way to avoid the said new lines in the above mentioned
> examples? (NB: A space right _before_ the quote starts is okay.)  Or
> alternatively, is there a way to consistently force a new line in the
> HTML export, after each of "Test 1", "Test 2", et al?
>
> Many thanks in advance!
>
> Regards,
> Kashyap
>


Re: tabs turned into space when going into Org Src...?

2020-12-23 Thread Diego Zamboni
Greg,

I just did a quick test and I cannot reproduce this, the tabs remain on
entering, modifying and exiting block-edit mode.

One question: do you see "Makefile" as the mode when you are editing the
source block? Otherwise I imagine tab-to-space conversion might be taking
place.

--Diego


On Wed, Dec 23, 2020 at 8:05 AM Greg Minshall  wrote:

> hi.  it seems going into Org Src, at least from a "makefile" source
> block, changes the tabs (the the base org mode added for me) into
> spaces, and leaves them as spaces when i merge back into the main .org
> file (and, so, make(1) complains, "missing separator").
>
> is this intentional?
>
> #+begin_src makefile
>   all:
> echo all done
> #+end_src
>
> note that the first character of the "echo" line is a  (or, was,
> when i composed this message, sigh).  do a C-', and note that in the Org
> Src buffer, the "echo" line will start with a string of spaces.
>
> cheers, Greg
>
> ps -- is there some way i should escape/mime'ify such source blocks in
> e-mail (to this list, at least)?
>
>


Re: org-capture user-error: Abort

2020-12-13 Thread Diego Zamboni
>
>
> > Emacs fires "user-error: Abort" after pressing "q" to abort org-capture.
>
> This is intended. Normally, it just shows up as a message in the
> minibuffer. Or do you have debug-on-error enabled?
>

Same as Ihor, when I press `q` in the org-capture screen I only see "Abort"
in the minibuffer. Where do you see the `user-error`?  As long as the
effect is what you need (getting out of the capture screen), what is the
problem with the code using the `user-error` function to achieve this
effect?


Re: stability of toc links

2020-12-09 Thread Diego Zamboni
In case it's useful, I have put together (just last week) some config to
help in creating and using human-readable CUSTOM_IDs in conjunction with
`counsel-org-link`, but which could just as easily be used to apply the IDs
to every heading in the current document:
https://github.com/zzamboni/dot-doom/blob/master/doom.org#capturing-and-creating-internal-org-links

Now I have to look at TEC's ID-generation code, seems much nicer :)

--Diego


On Wed, Dec 9, 2020 at 3:54 AM TEC  wrote:

>
> Hi Sam, link stability is a concern I've had too. I currently have a fix
> (or at the very least, an improvement) for this in my config where I
> overwrite org-export-get-reference. (see:
> https://tecosaur.github.io/emacs-config/config.html#nicer-generated-heading
> ).
>
> I raised this on the list a while ago ---
> https://orgmode.org/list/e1jxajq-0004dk...@lists.gnu.org/ but there
> didn't seem to be much interest.
>
> All the best,
> Timothy
>
> Samuel Wales  writes:
>
> > when you link to a section using toc, you get a link like
> >
> >
> https://thekafkapandemic.blogspot.com/2020/02/crimes-against-humanity_3.html#org080f0ab
> >
> > will these links break if somebody copies them and pastes them
> > elsewhere?  what if you add a section?
> >
> > there doesn't seem to be a perfect solution, short of adding custom id
> > or id to everything, but perhaps a fuzzy hash of the header and
> > contents of the section could be used?  or a strict hash of the
> > header?  is anything like this being done?  just curious.
>
>
>


Re: Exporting .org to .md for Sourcehut (sr.ht); ox-md not following Markdown spec?

2020-12-02 Thread Diego Zamboni
Hi TRS-80,

Note that according to https://man.sr.ht/markdown/#post-processing,
Sourcehut uses CommonMark, not plain Markdown, so I guess that's why it
doesn't allow all HTML tags.

(note: Markdown allows embedded HTML, so ox-md's behavior is not incorrect)

There seems to be no ox-commonmark (that I could find) but pandoc does
support it, so you could probably use ox-pandoc (
https://github.com/kawabata/ox-pandoc) to export your documents in
CommonMark format.

--Diego


On Wed, Dec 2, 2020 at 7:54 PM TRS-80  wrote:

> Hallo,
>
> I became quite interested in what Drew Devault was doing with his
> Sourcehut project, so I decided to join.  I was really enjoying
> everything except for the fact that .org files are not supported insofar
> as automatic rendering into nice looking HTML in the same way that
> Markdown files are for the README at the root of the project.  And the
> official word is that only Markdown is to be supported.[0]
>
> So I start digging into this, my first try was to use
> org-md-export-to-markdown function to generate the supported Markdown.
> However, doing it that way broke all inter-page links (to headings,
> footnotes, etc.).
>
> Some further digging revealed that the ox-md exporter (which itself is
> derived from the HTML exporter(?) makes extensive use of the id
> attribute in links.  And Sourcehut's HTML sanitizer only allows href and
> title attributes (not id).[1]
>
> For example, here are the sort of links that the ox-md exporter create:
>
> ToC:
>
> ```
> 1.  [rofi-in-elisp](#orgdbf2274)
> ```
>
> Body:
>
> ```
> 
>
> # rofi-in-elisp
> ```
>
> Above was copied straight from Eli Schwartz reply to me in my post to
> Sourcehut mailing list about this[0] (although I had already noticed the
> same thing as well).
>
> I tend to agree with him that this is not following the Markdown spec,
> where links should instead become simply:
>
> ToC:
>
> ```
> 1.  [rofi-in-elisp](#rofi-in-elisp)
> ```
>
> And if so, then the Right Thing to do would be to fix that in the ox-md
> exporter?
>
> However OTOH, I can't help but venture a guess that there must have been
> some reason to do it that way in the first place.
>
> So before I invest any more time going down this path, I thought I would
> take a step back and seek some advice whether this is actually the
> correct path or not?
>
> Cheers,
> TRS-80
>
> [0]
>
> https://lists.sr.ht/~sircmpwn/sr.ht-discuss/%3Cfe7aa296-9c90-463d-b4e6-50eeb7e57428%40localhost%3E
> [1] https://man.sr.ht/markdown/#post-processing
>
>


Re: How to preserve empty headings

2020-11-30 Thread Diego Zamboni
What are RET and C-j bound to?

In my setup, RET is bound to =org-return=, which does not delete spaces,
but C-j is bound to =org-return-and-maybe-indent=, which does. So I have
the opposite behavior as yours.

There were some recent changes in behavior of Org with respect to
electric-indent-mode (long discussion in the list), I think this might have
something to do with it but did not follow the full discussion.

Hope this helps,
--Diego


On Mon, Nov 30, 2020 at 7:38 PM Titus von der Malsburg 
wrote:

>
> On 2020-11-30 Mon 19:25, Diego Zamboni wrote:
> >>
> >> I’m aware of several workarounds and this one is perhaps the best.
> >> However, I’d prefer if RET would just work as expected.  Org sometimes
> >> inserts extra material on RET which I think is okay (e.g. indentation),
> but
> >> is there any precedent, in Org or Emacs more broadly, for RET deleting
> >> text?  It seems very counter-intuitive to me.
> >>
> >
> >  Could it be that the space is being deleted not when you press RET but
> > when you save the file? I don't see any space deletion when entering an
> > empty headline, but in my config, whitespace at end of lines is deleted
> > on save. In Doom Emacs this is enabled by default, and even before I was
> > using =delete-trailing-whitespace= as part of my =before-save-hook=.
> > --Diego
>
> The space is deleted immediately.  But the fact that it’s not happening on
> your system perhaps means that there *is* a setting that prevents it.  The
> question is: which?
>
> By the way, I’m using the master branch from
> https://code.orgmode.org/bzg/org-mode.git as installed by straight.el.
>
>   Titus
>
>


Re: How to preserve empty headings

2020-11-30 Thread Diego Zamboni
>
> I’m aware of several workarounds and this one is perhaps the best.
> However, I’d prefer if RET would just work as expected.  Org sometimes
> inserts extra material on RET which I think is okay (e.g. indentation), but
> is there any precedent, in Org or Emacs more broadly, for RET deleting
> text?  It seems very counter-intuitive to me.
>

 Could it be that the space is being deleted not when you press RET but
when you save the file? I don't see any space deletion when entering an
empty headline, but in my config, whitespace at end of lines is deleted
on save. In Doom Emacs this is enabled by default, and even before I was
using =delete-trailing-whitespace= as part of my =before-save-hook=.

--Diego


Re: Multiple named code blocks

2020-11-29 Thread Diego Zamboni
Hi Felix,

You need to use the noweb-ref header argument instead of #+NAME, then the
block are all concatenated on output.

Best,
--Diego


On Sat, 28 Nov 2020 at 23:35, mooss  wrote:

> Hi,
>
> I have been using org-mode for almost three years and I loved it so much
> that I started working on a literate programming tool based on it.
> One particular technique that I use is having multiple named code blocks,
> like so:
>
> #+begin_src perl :noweb yes :results output
> <>
> sub foo {
> <>
> }
> foo;
> #+end_src
>
> #+name: Before foo
> #+begin_src perl
> print "Before foo definition.\n";
> #+end_src
>
> #+name: Before foo
> #+begin_src perl
> my $value = 'Inside foo call';
> #+end_src
>
> #+name: In foo
> #+begin_src perl
> print $value . "\n";
> #+end_src
>
> This technique worked without issue until I recently updated Emacs and
> org-mode with it.
> I do not know the version of org-mode I was using before, but this was
> with Emacs 26.3 and I upgraded to Emacs 27.1 with org-mode 9.4 according to
> the information at the top of elpa/org-plus-contrib-20201116/org.el.
>
> Before the update, the code block after expansion (obtained with
> org-babel-expand-src-block via the C-c C-v C-v shortcut) looked like this:
> #+begin_src perl
> print "Before foo definition.\n";
> my $value = 'Inside foo call';
> sub foo {
> print $value . "\n";
> }
> foo;
> #+end_src
>
> Now the definition of $value is gone:
> #+begin_src perl
> print "Before foo definition.\n";
> sub foo {
> print $value . "\n";
> }
> foo;
> #+end_src
>
> I have looked at the info manual so I realise that according to "15.2
> Structure of Code Blocks": "For duplicate names, Org mode’s behavior is
> undefined" so it follows that:
> - Up until now, I was incorrectly assuming that duplicated named code
> blocks were supposed to result in them being concatenated in the noweb
> expansion phase.
> - This is not a bug report, org-mode is working as documented.
>
> I find this technique pretty useful for two reasons:
> 1. Importing packages right when they are needed.
> 2. Declaring variables in a broader scope than the one where they are
> first used.
> Here is an short example of this kind of situation:
>
> #+begin_src perl :noweb no
> # Expansion of <>:
> my $even_counter = 0;
> my @array = (4, 8, 15, 16, 23, 42);
> # A
> # lot
> # of
> # other
> # code
> # [...]
> foreach my $n (@array) {
> # Expansion of <>:
> $even_counter++ if $n % 2 == 0;
> }
> print "$even_counter";
> #+end_src
>
> In this example, $even_counter could not have been declared on the
> spot.
> Of course, this example is too basic to really paint the usefulness of
> this technique but an actual example would be too long, the goal here is
> just to explain the general idea.
>
> With all that being said I would suggest to define the behaviour for
> multiple named code blocks as resulting in a concatenation of the code
> blocks, in the order of their apparition.
> If you agree about defining this behaviour but think adapting the
> implementation is of low priority, I could try to implement it myself
> though I have little experience in emacs-lisp development beyond basic
> configuration and no experience whatsoever in contributing to FOSS, but I'm
> willing to start in both domains.
>
> Best regards,
> Félix
>
>


Re: Differentiate source blocks in export?

2020-11-24 Thread Diego Zamboni
And even (a bit) shorter:

#+html:
#+BEGIN_SRC python
print(5)
#+END_SRC
#+html:

--Diego

On Tue, Nov 24, 2020 at 5:16 PM John Kitchin 
wrote:

> Nice! Here is a little more compact way to do that I think:
>
> @@html:@@
> #+BEGIN_SRC python
> print(5)
> #+END_SRC
> @@html:@@
>
>
> John
>
> ---
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
>
>
> On Tue, Nov 24, 2020 at 11:08 AM Marvin ‘quintus’ Gülker <
> post+orgmod...@guelker.eu> wrote:
>
>> Hi!
>>
>> Am Dienstag, dem 24. November 2020 schrieb Joost Kremers:
>> > I was wondering if there's a way to distinguish between different kind
>> of source
>> > code blocks when exporting to HTML.
>> >
>> > Specifically, I would like a way to mark certain code blocks in my Org
>> file so
>> > that those code blocks get a specific class in the HTML export.
>>
>> You can use the BEGIN_EXPORT/END_EXPORT pair to include a literal HTML
>> DIV tag around your target code block. Try this:
>>
>> Wrapped code block in a div with a custom class:
>>
>> #+BEGIN_EXPORT html
>> 
>> #+END_EXPORT
>>
>> #+BEGIN_SRC c
>> #include 
>> int main(int argc, char* argv[])
>> {
>> printf("This is wrapped in the div\n");
>> return 0;
>> }
>> #+END_SRC
>>
>> #+BEGIN_EXPORT html
>> 
>> #+END_EXPORT
>>
>> Normal codeblock without:
>>
>> #+BEGIN_SRC c
>> #include 
>> int main(int argc, char* argv[])
>> {
>> printf("This is not wrapped in anything unusual\n");
>> return 0;
>> }
>> #+END_SRC
>>
>> Note how one of the EXPORT blocks wraps the opening tag of the DIV and
>> the other one wraps the closing tag.
>>
>>   -quintus
>>
>> --
>> Dipl.-Jur. M. Gülker | https://mg.guelker.eu |For security:
>> Passau, Germany  | kont...@guelker.eu| () Avoid HTML e-mail
>> European Union   | PGP: see homepage | /\ http://asciiribbon.org
>>
>>


Re: One vs many directories

2020-11-24 Thread Diego Zamboni
>
> So I think this is bug in Emacs as Local-variables should be on the
> end of the file.


According to the manual (
https://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html#Specifying-File-Variables
):

The start of the local variables list should be no more than 3000
> characters from the end of the file


Given the length of the email, I guess this is why Emacs saw the variables
as being within the correct range.

--Diego


On Tue, Nov 24, 2020 at 12:57 PM Eric S Fraga  wrote:

> On Tuesday, 24 Nov 2020 at 12:51, Jean Louis wrote:
> > So I think this is bug in Emacs as Local-variables should be on the
> > end of the file.
>
> "end of file" is a rather loose term when it comes to local variables...
> --
> : Eric S Fraga via Emacs 28.0.50, Org release_9.4-118-g2a4578.dirty
>
>


Re: Bring up a screen giving option to open a series of orgmode files

2020-11-23 Thread Diego Zamboni
Hi Gerardo,

Apart from what others have suggested, what you can do if you have a fixed
list of files you want to quickly access, you could manually define
keybindings for them. I have four main files where I capture things, so I
define a submenu that allows me to access them quickly:

(note: I got this idea originally from Sacha Chua's
https://sachachua.com/blog/2015/02/learn-take-notes-efficiently-org-mode/)

First, I define a helper function to define keybindings that open files.
Note that this requires lexical binding to be enabled, so that  the
=lambda= creates a closure, otherwise the keybindings don't work.

#+begin_src emacs-lisp
(defun zz/add-file-keybinding (key file  desc)
  (let ((key key)
(file file)
(desc desc))
(map! :desc (or desc file)
  key
  (lambda () (interactive) (find-file file)
#+end_src

(note #2: the map! macro is Doom Emacs-specific, should be replaced with
`bind-key` or equivalent if you are not using Doom)

Now I define keybindings to access my commonly-used org files.

#+begin_src emacs-lisp
(zz/add-file-keybinding "C-c z w" "~/Work/work.org.gpg" "work.org")
(zz/add-file-keybinding "C-c z i" "~/org/ideas.org" "ideas.org")
(zz/add-file-keybinding "C-c z p" "~/org/projects.org" "projects.org")
(zz/add-file-keybinding "C-c z d" "~/org/diary.org" "diary.org")
#+end_src

This results in a submenu bound to "C-c z" which looks like this, and which
allows me to quickly open my files:

[image: image.png]

--Diego


On Sun, Nov 22, 2020 at 11:01 AM Gerardo Moro 
wrote:

> Basically that :)
> I'm looking for some setup that allows me to open a menu with a list of
> files and shortcut access keys to open them.
>
> Probably somebody has done this before.
>
> Thank you,
> GM
>


Re: quick thanks

2020-11-21 Thread Diego Zamboni
I would like to second this.

We often come to this list only when something is not working, but it's
also good to recognize how cool, powerful and indispensable Org is for many
of us. Thanks to the maintainers and developers, and also to the community
for the good discussion and great feedback.

--Diego


On Sat, Nov 21, 2020 at 7:14 AM Stephen Burke 
wrote:

> Just wanted to say a quick thanks for the website updates, it looks
> great.  I'm glad org-mode is still available because it's just a joy to use
> and super powerful.  Thanks.
>
> --
> Stephen Burke
>


Re: Changed list indentation behavior: how to revert?

2020-11-17 Thread Diego Zamboni
On Tue, Nov 17, 2020 at 10:06 AM Stefan Nobis  wrote:

> But on the other side: What are we talking about?
> ...
> But ranting so loudly and insistent and continuously over such a minor
> details is really beyond me.
> ...
> So, everyone, please calm down and try not to overreact over really
> simple, negligible details.
>

+100 - nicely put Stefan. This extremely long thread really puzzles me.

--Diego


Re: Changed list indentation behavior: how to revert?

2020-11-14 Thread Diego Zamboni
Jean,

On Sat, Nov 14, 2020 at 8:53 AM Jean Louis  wrote:

> As that is how ugly and less visible it should look like if the same
> principle should be followed. As if somebody forces me to indent list
> items like that, then they shall also force headings. So consistency
> is lacking. /s
>

No one is forcing you to do anything, particularly given that there are
ways to disable it.

If it had bothered you so much, why had you not looked into it, or asked
about it?

Please send that to those people to reconsider taking it back.
>

I'm not sure to whom you are referring. I guess "those people" would be the
developers and maintainers and other users who do a lot of work *for free*
so that we can all use the tools we love. And furthermore, to whom you can
talk directly through this mailing list.

Best,
--Diego


Re: Changed list indentation behavior: how to revert?

2020-11-14 Thread Diego Zamboni
Hi Gustavo,

Thanks for the pointer! I noticed this change some time ago, but it hadn't
bothered me so much as to go look how to fix it - now you gave me the
solution :)

Cheers,
--Diego


On Fri, Nov 13, 2020 at 10:11 PM Gustavo Barros 
wrote:

> Hi Karl,
>
> On Fri, 13 Nov 2020 at 18:30, Karl Voit  wrote:
>
> > Hi!
> >
> > I'm on Org mode maint git repo, currently v9.3.6.
> >
> > I recently upgraded from an older git commit version.
> >
> > Since the upgrade I do have a different behavior:
> >
> > - Consider this list itemX
> > A 1
> > 2
> >
> > When I press RET at the "X" above, I end up at position "1". With
> > another RET, cursor ends up at "2". I'd love to get back the
> > previous behavior where RET at "X" always ended up at "A".
> >
> > Unfortunately, there are tons of org*indent* variables out there.
> > I'd appreciate it very much if somebody knows what variable I need
> > to modify to get back to the previous behavior.
> >
> > Thanks!
>
> I'll answer, because I feel somewhat responsible for your upgrade. ;-)
>
> Since recently Org is set to respect Emacs' `eletric-indent-mode'.  If
> I'm not mistaken, it made to the 9.4 release, I presume that's what you
> are getting.
>
> You can find the Org News entry, and how to get the previous behavior
> back in:
> https://code.orgmode.org/bzg/org-mode/src/master/etc/ORG-NEWS#L323
>
> A couple of threads that might help understand the change and the
> reasoning behind it:
> https://orgmode.org/list/877dxpazbo.fsf...@gmail.com/
> https://orgmode.org/list/878sfbycip@iki.fi/
>
> HTH,
> Gustavo.
>
>


Re: How to wrap Org code generated by a source block?

2020-11-10 Thread Diego Zamboni
Hi Chuck,

Thanks! =:results drawer= is exactly what I was looking for :)

I tried also with =:wrap src org=, but then upon export it's exported
literally as Org src code, instead of interpreted as such. The drawer was
exactly what I needed, and allows reevaluation of the block, replacing all
the results correctly.

Cheers,
--Diego


On Tue, Nov 10, 2020 at 6:41 PM Berry, Charles 
wrote:

>
>
> > On Nov 10, 2020, at 6:13 AM, Diego Zamboni  wrote:
> >
> > I want to generate some parts of my document programmatically from an
> emacs-lisp src block - i.e. the code produces Org markup which I want to
> then export. Is there a way to wrap the #+RESULTS block in an environment
> that still gets evaluated as Org text (e.g. when exporting)?
> >
> >
>
>
> Try `:results drawer'
>
> You can also do fancy stuff using `:wrap "src ..."' where `...' is a
> language and additional header args. One language choice is `org', but I
> don't think this approach is what you need.
>
> HTH,
> Chuck
>


How to wrap Org code generated by a source block?

2020-11-10 Thread Diego Zamboni
Hi everyone,

I want to generate some parts of my document programmatically from an
emacs-lisp src block - i.e. the code produces Org markup which I want to
then export. Is there a way to wrap the #+RESULTS block in an environment
that still gets evaluated as Org text (e.g. when exporting)?

More details:

Here's a sample src block which shows the kind of thing I need to do:

#+begin_src emacs-lisp :results value raw :exports results
(mapconcat
 (lambda (b) (format "#+begin_%s
Generated %s block at %s
,#+end_%s" b b (current-time-string) b))
 '("example" "quote") "\n")
#+end_src

Using =:results value raw= in the header produces the result from the block
without wrapping it in any blocks, which is exactly what I need. E.g.:

#+RESULTS:
#+begin_example
Generated example block at Tue Nov 10 15:07:45 2020
#+end_example
#+begin_quote
Generated quote block at Tue Nov 10 15:07:45 2020
#+end_quote

HOWEVER, this has the problem that when I re-evaluate the code block, only
the first block below #+RESULTS gets replaced, pushing the others downward,
so I end up with something like this after a couple of times:

#+RESULTS:
#+begin_example
Generated example block at Tue Nov 10 15:08:42 2020
#+end_example
#+begin_quote
Generated quote block at Tue Nov 10 15:08:42 2020
#+end_quote
#+begin_quote
Generated quote block at Tue Nov 10 15:08:39 2020
#+end_quote
#+begin_quote
Generated quote block at Tue Nov 10 15:07:45 2020
#+end_quote

If I remove the "raw" then the results get wrapped in an example block (or
any other that I specify with =:wrap=), which means they get correctly
replaced every time, but not evaluated as Org text:

#+RESULTS:
: #+begin_example
: Generated example block at Tue Nov 10 15:09:46 2020
: #+end_example
: #+begin_quote
: Generated quote block at Tue Nov 10 15:09:46 2020
: #+end_quote

So again, my question is: is there a way to wrap the #+RESULTS block in an
environment that still gets evaluated as Org text (e.g. when exporting), so
that I can rerun the code block without having to manually trim the results
block afterwards?

Thanks!
--Diego


Re: Viewing link information

2020-11-09 Thread Diego Zamboni
Hi Russell,

I am using Doom Emacs, and in its default Org configuration it does exactly
that: the link target is shown in the minibuffer after a brief delay, when
the cursor is on the link. A bit of investigation reveals that it's using
org-eldoc. This seems to be the code responsible for it:

https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/org/config.el#L167-L171

  (defadvice! +org-display-link-in-eldoc-a ( _)
"Display full link in minibuffer when cursor/mouse is over it."
:before-until #'org-eldoc-documentation-function
(when-let (link (org-element-property :raw-link (org-element-context)))
  (format "Link: %s" link)))

--Diego


On Fri, Oct 30, 2020 at 5:15 PM Russell Adams 
wrote:

> Are there other ways to view information about an org link that I
> don't list below?
>
>  - M-x org-insert-link, the prompts for link and description show the
>current values. Requires interacting with the prompts.
>
>  - Switch to fundamental mode
>
>  - M-x org-toggle-link-display
>
> Are there ways to see this information live while navigating? Maybe on
> the modeline, or messages?
>
> --
> Russell Adamsrlad...@adamsinfoserv.com
>
> PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/
>
> Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3
>
>


Re: New website - back to the old unicorn!

2020-10-26 Thread Diego Zamboni
The new website looks great. Thanks Timothy for all your work!

--Diego


On Mon, Oct 26, 2020 at 10:42 AM Bastien  wrote:

> Dear all,
>
> thanks to the initiative and the patient efforts of Timothy, our
> website has been revamped: new contents, new look and... the old
> unicorn!
>
> Thanks very much to Timothy and to everyone who contributed with
> feedback and ideas.
>
> This is a new basis that we will continue to polish and enhance.
>
> Enjoy :)
>
> https://orgmode.org
>
> --
>  Bastien
>
>


Re: best practices query: non-emacs packages based on tangled source

2020-10-16 Thread Diego Zamboni
Hi Greg,

What I do with my Elvish modules (https://github.com/zzamboni/elvish-modules
, https://github.com/zzamboni/elvish-completions) is to just include the
Org files together with the tangled .elv files.

--Diego


On Thu, Oct 15, 2020 at 8:28 PM Greg Minshall  wrote:

> hi.  i apologize if this has been asked before (especially if by me).
> but, since i had a question recently about Org Src... buffers, this came
> up.
>
> i'm wondering what people do who want to release a non-emacs'y package
> (an R package, say, or ...), and who did their development "from within"
> a .org file.
>
> i can "build" whatever files are needed to release the package.  but,
> it's nice to be able to let people look at the sources, maybe submit
> 'pull requests', etc.
>
> if anyone has any techniques they've used, liked (or hated), i'd love to
> hear.
>
> thank you very much, Greg
>
>


Re: [matlab src is always exported to latex!!]

2020-10-13 Thread Diego Zamboni
Uwe,

In my testing (using octave since I don't have matlab, but I hope it's
similar), using = :exports none :results output raw= seems to produce the
desired output:

#+begin_src octave :exports results :results output raw
close all
N = 3; % number of chebyshev nodes
n = 1; % polytropic index
iters = 1; % iterations
j=[0 1 2 3];
z=cos((pi*j)/3);
y=1-(0.5*(z+1)).^2;
a=n*(8);
a2=eye(3+1)*a;
disp('\begin{align*}')
disp('A_{1,k-1}&=')
disp('\begin{pmatrix}')
fprintf('%g &%g &%g &%g\n',a2')
disp('\end{pmatrix}=OK\\')
disp('\end{align*}')
#+end_src

#+RESULTS:
\begin{align*}
A_{1,k-1}&=
\begin{pmatrix}
8 &0 &0 &0\\
0 &8 &0 &0\\
0 &0 &8 &0\\
0 &0 &0 &8\\
\end{pmatrix}=OK\\
\end{align*}

Which renders the matrix correctly. I first tried with =:exports results=,
but that for some reason results in the results being included twice in the
LaTeX output. I'm not sure why.

Hope this helps,
--Diego


On Tue, Oct 13, 2020 at 1:36 PM Uwe Brauer  wrote:

> >>> "AB" == Arne Babenhauserheide  writes:
>
> > Uwe Brauer  writes:
>
> >> That did not work: I tried
> >> #+begin_src matlab  :results output
> >>
> >> But when I exported the org file to latex, the matlab code was also
> >> exported. Strange
>
> > Do you use :exports results?
>
> > :results output switches to show what is printed to stdout
>
> See my answer to Eric
>
> It does not do want I want
> #+begin_src matlab :exports results
> close all
> N = 3; % number of chebyshev nodes
> n = 1; % polytropic index
> iters = 1; % iterations
> j=[0 1 2 3];
> z=cos((pi*j)/3);
> y=1-(0.5*(z+1)).^2;
> a=n*(8);
> a2=eye(3+1)*a;
> disp('\begin{align*}')
> disp('A_{1,k-1}&=')
> disp('\begin{pmatrix}')
> fprintf('%g &%g &%g &%g\n',a2')
> disp('\end{pmatrix}=OK\\')
> disp('\end{align*}')
> #+end_src
>
> Leads to
>
> \begin{verbatim}
> \begin{align*}
> A_{1,k-1}&=
> \begin{pmatrix}
> 8 &0 &0 &0\\
> 0 &8 &0 &0\\
> 0 &0 &8 &0\\
> 0 &0 &0 &8\\
> \end{pmatrix}=OK\\
> \end{align*}
> \end{verbatim}
>
> So at the moment the only solution I can think of is to use the code I
> posted
>
> (defun my-latex-filter-src-blocks (text backend info)
>   "Remove source blocks from latex export."
>   (when (org-export-derived-backend-p backend 'latex)
> "%% [removed source block]\n"))
>
> (add-to-list 'org-export-filter-src-block-functions
>  'my-latex-filter-src-blocks)
>


Re: org mode with babel source: execute all source blocks, don't export them to latex

2020-10-13 Thread Diego Zamboni
Hi Uwe,

1. Is there any equivalent to org-update-all-dblocks for the source
> blocks?
>

I think you want org-babel-execute-buffer:


Documentation
Call org-babel-execute-src-block on every source block in

the current buffer.

 2. I want to export the org file to latex, in the current setting
>the source blocks are also exported. I tried
>#+begin_src matlab  :results output raw   :eval never-export
>but it did not help.
>

Normally, =:results output= should be enough, but there might be some
peculiarities with matlab blocks that change this behavior.

--Diego


Re: official orgmode parser

2020-09-15 Thread Diego Zamboni
There's also org-ql (https://github.com/alphapapa/org-ql), which also
provides a query-based API against Org structures.

--Diego


On Tue, Sep 15, 2020 at 2:59 PM  wrote:

> On Tue, Sep 15, 2020 at 01:15:56PM +0200, Przemysław Kamiński wrote:
>
> [...]
>
> > There's the org-json (or ox-json) package but for some reason I
> > wasn't able to run it successfully. I guess export to S-exps would
> > be best here. But yes I'll check that out.
>
> If that's your route, perhaps the "Org element API" [1] might be
> helpful. Especially `org-element-parse-buffer' gives you a Lisp
> data structure which is supposed to be a parse of your Org buffer.
>
> From there to S-expression can be trivial (e.g. `print' or `pp'),
> depending on what you want to do.
>
> Walking the structure should be nice in Lisp, too.
>
> The topic of (non-Emacs) parsing of Org comes up regularly, and
> there is a good (but AFAIK not-quite-complete) Org syntax spec
> in Worg [2], but there are a couple of difficulties to be mastered
> before such a thing can become really enjoyable and useful.
>
> The loose specification of Org's format (arguably its second
> or third strongest asset, the first two being its incredible
> community and Emacs itself) is something which makes this
> problem "interesting". People have invented lots of usages
> which might be broken should Org change to a strict formal
> spec. You don't want to break those people.
>
> But yes, perhaps some day someone nails it. Perhaps it's you :)
>
> Cheers
>
> [1] https://orgmode.org/worg/dev/org-element-api.html
> [2] https://orgmode.org/worg/dev/org-syntax.html
>
>  - t
>


Re: "text mode" org mode

2020-09-15 Thread Diego Zamboni
Hi Emmanuel,

Nearly everything in org-mode is configurable, so I think what you want is
definitely doable.

In addition to using `visible-mode` as suggested by Gustavo (this is maybe
the easiest), you can also configure Org to show the emphasis markup
characters:

(setq org-hide-emphasis-markers nil)

And to show the full markup of links:

(setq org-link-descriptive nil)

--Diego


On Tue, Sep 15, 2020 at 3:35 PM Emanuel Berg via General discussions about
Org-mode.  wrote:

> Russell Adams wrote:
>
> > I believe you can set your #+STARTUP on your file
> > to "showall".
>
> Can I prevent hyperlinks from folding back and forth?
>
> I mean, with [[][]] ?
>
> Hm, maybe this will just go on and on if there is no
> option to do it for real. The font-lock idea was
> perhaps not so bad...?
>
> --
> underground experts united
> http://user.it.uu.se/~embe8573
> https://dataswamp.org/~incal
>
>
>


Re: [Announcement] New package ox-leanpub

2020-09-10 Thread Diego Zamboni
Hi Bastien,

Thanks! I agree it would be nice to have a comprehensive list of org
exporters in worg - although usually a search for "org export "
points in the correct direction :)

Best,
--Diego


On Thu, Sep 10, 2020 at 3:53 PM Bastien  wrote:

> Hi Diego,
>
> Diego Zamboni  writes:
>
> > I'm happy to announce that my package ox-leanpub is now available in
> > MELPA.
>
> I added a link to https://orgmode.org/worg/org-tools/
>
> Links to Org external exporters should perhaps have a dedicated
> section and/or page, especially if/when we will move some out of
> Org's core.
>
> Thanks for writing and sharing this!
>
> --
>  Bastien
>


Re: idea for capture anywhere in x

2020-09-08 Thread Diego Zamboni
Doom Emacs has an 'org-capture' script that uses emacsclient to externally
invoke a new frame with 'org-capture' in it. Maybe this could be a good
starting point?

https://github.com/hlissner/doom-emacs/blob/develop/bin/org-capture


--Diego

On Tue, Sep 8, 2020 at 9:19 AM Maxim Nikulin  wrote:

> 08.09.2020 12:21, Tim Cross wrote:
> >
> > How you add this to a window manager menu or key binding will depend on
> > your window manager, but essentially, you just calling emacscleint with
> > the argument -e (org-capture). You may need to quote the command to
> > prevent shell interpolation of the command and you may need to add other
> > arguments, such as -n or --no-wait etc.
>
> Good point. However playing with a script for org protocol, I realized
> that there could be no emacs frame yet, so I added --create-frame
> depending on output of
>
> emacsclient --quiet --eval \
>"(seq-some (lambda (f) (if (eq 'x (framep f)) 'has-frame 'no-frame))
> (frame-list))" \
>2>&1
>
> Another point is to provide feedback (notify-send, kdialog, zenity,
> etc.) if emacs server is not running at all (non-zero exit code of the
> shell command above). Though since Samuel is already using org-protocol,
> it should not be a problem.
>
>
>


Re: Adaptive Org faces in headings?

2020-09-05 Thread Diego Zamboni
Hi Protesilaos,

I had seen the same in my setup. I recently started using Doom Emacs (
https://github.com/hlissner/doom-emacs/) and was pleasantly surprised to
discover that todo and tag faces scale according to the headline in which
they are. I don't know precisely how this is done, but there are some hints
here, you might use it as a starting point:
https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/org/config.el#L146-L175

(tangentially: I am very happy with Doom Emacs. After 30+ years of
handcrafting my Emacs config, I decided to give it a try and I can highly
recommend it).

--Diego


On Sun, Apr 26, 2020 at 9:01 AM Protesilaos Stavrou 
wrote:

> Dear all,
>
> I have noticed that Org faces that combine with headings do not adapt to
> their context.  This applies to keywords, priority cookies, links, and
> possibly other elements as well.
>
> For example, a "todo" keyword (`org-todo' face) will not scale in size
> to match that of the heading level (`org-level-N' face) if the latter
> uses a `:height' property.  Same principle for keywords not inheriting
> the heading's background, overline, etc.
>
> My expectation is to allow `org-level-N' to pass its attributes to any
> element on the same line, unless that element has conflicting face
> attributes of its own.  So, in my example, the heading could pass its
> height to the "todo" keyword when the `org-todo' face does not define a
> `:height' of its own.  Otherwise it would refrain from overriding that
> attribute.
>
> Does the community know of a solution to this issue?
>
> I am running:
>
> * Org mode version 9.3.
>
> * GNU Emacs 27.0.91 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.17,
>   cairo version 1.17.3) of 2020-04-20.
>
> Best regards,
> Protesilaos
>
>
> --
> Protesilaos Stavrou
> protesilaos.com
>
>


Re: How to expand macros in tangled code blocks?

2020-08-25 Thread Diego Zamboni
To follow up on my own question, I figured out a solution. I added three
hooks with the following local variables:

# Local Variables:
# eval: (add-hook 'org-babel-pre-tangle-hook (lambda () (setq
zz/saved-macro-templates org-macro-templates)) :append :local)
# eval: (add-hook 'org-babel-post-tangle-hook (lambda () (makunbound
'zz/saved-macro-templates)) :append :local)
# eval: (add-hook 'org-babel-tangle-body-hook (lambda () (when (boundp
'zz/saved-macro-templates) (org-macro-replace-all
zz/saved-macro-templates))) :append)
# End:

This works! The first hook saves the current buffer's macros to a temporary
variable before starting the tangle, which gets unbound by the second hook,
and the third one uses it on each code block's body to expand the macros.

This feels a bit clunky, because of the need to define multiple hooks, but
also because the third hook (and the temporary variable) cannot be made
buffer-local, because the operation happens across different buffers (each
=org-babel-tangle-body-hook= runs in a new temporary buffer with that
block's body in it). So the third hook will remain in effect for any other
org buffers I edit in the same session. Since the first two hooks are
buffer-local, it will have no effect, but it still feels hacky.

If anyone has ideas for how this could be done in a better/cleaner way, I'd
love to hear about it.

Cheers,
--Diego


On Tue, Aug 25, 2020 at 9:59 AM Diego Zamboni  wrote:

> Hi everyone,
>
> Is it possible to expand Org macros in tangled code blocks? I found this
> old message:
> https://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg00857.html,
> but the mentioned org-export-preprocess-apply-macros doesn't seem to exist
> anymore.
>
> Thanks for any tips,
> --Diego
>
>


How to expand macros in tangled code blocks?

2020-08-25 Thread Diego Zamboni
Hi everyone,

Is it possible to expand Org macros in tangled code blocks? I found this
old message:
https://lists.gnu.org/archive/html/emacs-orgmode/2011-03/msg00857.html, but
the mentioned org-export-preprocess-apply-macros doesn't seem to exist
anymore.

Thanks for any tips,
--Diego


Re: New package: Org Pandoc Import

2020-08-15 Thread Diego Zamboni
This look very neat - I will definitely give it a try!

On Sat, Aug 15, 2020 at 9:30 PM TEC  wrote:

> Hi Everyone,
>
> I've just pushed the initial version of a package I think is pretty nifty
> (no
> bias here ;) and thought it might me nice to mention it to the mailing
> list.
>
> https://github.com/tecosaur/org-pandoc-import
>
> This leverages Pandoc to reduce my interaction with other formats.
> Hopefully
> it's of interest to a few of you :)
>
> Enjoy!
>
> Timothy.
>
>


Re: Document containing different text colours?

2020-08-05 Thread Diego Zamboni
Hi Sharon,

I'm not sure I understand what is it that you are trying to do. But color
(or any other visual) is a feature of the exporter you use rather than of
Org-mode itself. For example, if you are exporting to HTML, you can use the
following at the top of the document:

#+html_head_extra: body { color: white; background-color: black;
}

For LaTeX export, you should be able to add the correct settings using #+
LATEX_HEADER_EXTRA.

Hope this helps,
--Diego


On Wed, Aug 5, 2020 at 2:37 PM Sharon Kimble 
wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA512
>
>
> In a book that I am writing, the text is white on black background which
> I like. But this is only the first draft, when its ready I shall go onto
> the second draft and then third draft, as many as necessary to polish
> the book before it goes to the beta-readers.
>
> So the first draft is white text on a black background, is it possible
> for all the second draft text to be in a different colour that I assign
> to it? And ditto third draft onwards?
>
> I envisage something like setting the text with 'M-x second-draft-text'
> which will then display the new text with its assigned colour. Which
> will also mean that the document will have multi-coloured text in it?
>
> Is this possible?
>
> And if it is possible, how do I do it please?
>
> Thanks
>   Sharon.
> - --
> Debian 10.2, fluxbox 1.3.7, emacs 27.1, org 9.3.7
> -BEGIN PGP SIGNATURE-
>
> iQJPBAEBCgA5FiEELSc/6QwVBIYugJDbNoGAGQr4g1sFAl8qp/YbHGJvdWRpY2Nh
> c0Bza2ltYmxlLnBsdXMuY29tAAoJEDaBgBkK+INbXdsP/RWZdu+1N1V+ZCXUmnX3
> deLkWS5APBK1zltakwg4Mm7ZxgkTLjEaXrVvpm4i8zMcTXqT38U7HUiUW870hTAC
> aH9bEDku+R/F79ibBOZxasEl8S5DnLhK7skplbKBHp8OftV3GWPDTntBr8+F6cre
> /tQvVxkd/GDeGZxDvKRuRNEAZN1a05dnfmv6/O0XJ2PpI7rAqMOAEigxpV8G3elk
> fFbBmqObJLcJdTOlHu3b3MljnVbo2ePv7q/6Xwgez0g0Q0+Bj6ZW01IMfTr5aRd2
> 9He+l+ds64M8m2M5NZAME2O7PutgM4IjF6ccp7MAfAkHCWy9t+H1BG6u7xxcT4Oh
> ys9wEb2PW6bxl3YPjsx3ByNPup0dZpufudDvNqk2IX4t6qIea/1v6AEwqfic1s5O
> DrWX3A6TDj9RcLZN5sPHXC9e4WMfGkbngGwdNo5nkquULwUg91ySBAWEJ3z2TohZ
> 9/U6W8eV0rvm12GTe3wNssNcrDSfvXXT70Bm8ii94u4w44zBCWiq/puLqgFivutl
> u5sNPIedyULbdj+n8SKfmpRZFnfClQA1cVLl6wiTOZx1WubZR++C9IsJhhaLp7kP
> ZaLh1Q2zIVYJxp7OolUsdJ40AFrcDI8Y6ra6YWYnpuq7Cgza+l2UI7YFWSXfJLMC
> RDz4BPP61uqJQqQ9GKq09EMd
> =3YW5
> -END PGP SIGNATURE-
>
>


Re: use-package examples?

2020-06-27 Thread Diego Zamboni
Hi Bill,

Glad you found my config already. For custom faces, I do a lot of
configuration interactively with =customize-face=, because it allows me to
play more freely with them. But you can see some examples in my config, and
also in my post at https://zzamboni.org/post/beautifying-org-mode-in-emacs/.

One tip I have found very useful when customizing org's faces is to use the
=what-cursor-position= command (bound by default to C-u C-x =) to show
information about the character under the cursor, including the face which
is being used for it. This helps a lot to know which face you have to
customize to fix something.

Have fun :)

--Diego


On Mon, Jun 22, 2020 at 11:06 PM William Denton  wrote:

> It could be useful to have some documentation about installing and
> configuring Org with use-package [1].
>
> I just redid my Org config this way, and I'm happy to say it works, though
> a
> use-package wizard would probably cut it in half.  (To me use-package is
> advanced magic, and I don't understand all the incantations.)
>
> If anyone can suggest some good examples to look at, I'll try starting
> some
> documentation about it.  I know about Diego Zamboni [2] and Sacha Chua
> [3], but
> there must be more.  Things with custom faces and such would be especially
> welcome.
>
> Bill
>
> [1] https://github.com/jwiegley/use-package
> [2] https://github.com/zzamboni/dot-emacs/
> [3] https://github.com/sachac/.emacs.d
> --
> William Denton :: Toronto, Canada   ---   Listening to Art:
> https://listeningtoart.org/
> https://www.miskatonic.org/ ---   GHG.EARTH: https://ghg.earth/
> Caveat lector.  ---   STAPLR: https://staplr.org/
>
>


Re: org-mode as a logging target

2020-06-21 Thread Diego Zamboni
This is actually pretty cool! Thanks for the tip,
--Diego


On Sun, Jun 21, 2020 at 5:39 PM Meng Weng Wong  wrote:

> I've been enjoying a featherweight alternative to log levels, made
> possible by org-mode.
>
> Try this the next time you write a little throwaway command-line utility
> script:
>
> Step 1: Add asterisks to the front of your printf traces.
>
> Step 2: Tee your STDOUT / STDERR to a file named log.org
>
> Step 3: Open the log file in org-mode.
>
> Step 4: Rejoice!
>
> Optional: You can tail the logfile with M-x auto-revert-mode.
>
> This illustration uses a Github scraper as an example:
> https://github.com/mengwong/git-scrape
> https://twitter.com/mengwong/status/1274236595109982208
>
> This is no substitute for real structured logging, of course :)
>
> That is all.
>
>


[Announcement] New package ox-leanpub

2020-06-14 Thread Diego Zamboni
Hi everyone,

I'm happy to announce that my package ox-leanpub is now available in MELPA.

Ox-leanpub contains Org-mode export backends to produce books in the
correct structure and format for publication with Leanpub
(https://leanpub.com/). It allows you to write your book entirely in
Org mode, and completely manages the production of the necessary files
for Leanpub to be able to render your book. I use this package to
publish most of my books published on Leanpub
(https://leanpub.com/u/zzamboni).

You can find full documentation at
https://github.com/zzamboni/ox-leanpub (original source is kept in
GitLab, but the documentation is more readable in GitHub).

Please check it out! Let me know if you have any feedback or questions.

I would also like to thank everyone in this community for your support
and willingness to answer my questions :)

All the best,
--Diego



Re: Get Grades Done: the joys of Org's simple power

2020-06-13 Thread Diego Zamboni
Hi Leo,

> Well the changelog in org-web hasn't been updated in quite a while:
> https://github.com/DanielDe/org-web/blob/master/changelog.org
> wheras organice seem to actively developed
> https://github.com/200ok-ch/organice/blob/master/changelog.org .
>
> The have a section in their readme that shows how they differ: 
> https://github.com/200ok-ch/organice#org-web

Awesome, thanks for the additional pointers!

Devin: Organice supports online editing of files hosted on Dropbox,
Google Drive or WebDAV - maybe this would fit your use case?

--Diego
--Diego



Re: Get Grades Done: the joys of Org's simple power

2020-06-12 Thread Diego Zamboni
Hi Leo,

Thanks - I had seen that one too, and couldn't figure out which one
was a fork of the other one. Both have recent activity - do you know
what are the main differences between them?

--Diego

On Fri, Jun 12, 2020 at 5:54 PM Leo Okawa Ericson
 wrote:
>
> Diego Zamboni  writes:
>
> > Hi Devin,
> >
> > Your could try https://org-web.org/ - it allows online editing of Org files
> > and a quick test shows that it supports the automatic update of checkbox
> > counts.
>
> Or you could try https://github.com/200ok-ch/organice - it is a friendly
> fork of org-web.



Re: Get Grades Done: the joys of Org's simple power

2020-06-10 Thread Diego Zamboni
Hi Devin,

Your could try https://org-web.org/ - it allows online editing of Org files
and a quick test shows that it supports the automatic update of checkbox
counts.

--Diego

On Wed, 10 Jun 2020 at 22:39, Devin Prater  wrote:

> So, I’ll try to not turn this into a novella. I am a “Technical
> Assistant”, and I teach at an adult education sort of trade school. This
> probably sounds normal, but the only sort of catch is that I am blind, and
> so are  many of my students, the rest having some vision loss.
>
> So, I have to find workarounds for just about everything I do. I teach
> Assistive Technology, which is basically how to use tech as a
> blind/visually impaired person. We have our courses on Moodle, because
> apparently no one has created a learning system that deals with directories
> and config files for those who do best in that environment, instead of
> freaking databases, and web interfaces even fatter than I am. I do hate web
> interfaces, and web interfaces wrapped in “apps” too. It shouldn’t be an
> app if its built on web tech. Yes, you too, Electron!
>
> Anyways, I have some manual tests I do. I have the questions in an
> Org-mode file, with checkboxes I can check or leave unchecked. Up until
> recently, I went down the list and graded them manually. But I thought “Now
> wait, can’t the computer do this for me? I mean, Org-mode is so powerful,
> why not make a Lisp thing that does that for me?” So, being a very beginner
> programmer who still finds it daunting to move my blog from Jekyll to
> Hugo—I’m almost done with that—and can only print stuff with Python, that
> didn’t work out so well. I’ll have to actually read through the Elisp Intro
> to get better at that.
>
> Then, I thought I’d look into the Org manual and see if there was a way to
> “count” checkboxes. And there is
> !  So, I can just put [%] on
> the heading where I want the grade, and my goodness, it works! I no longer
> have to manually grade the assignments! That saves so much time for me, and
> now I just wish the world was in Org-mode so I could just manage everything
> else through its power as well.
>
> Now, I do wish I could share these “self-grading” performance tests with
> others. I’ve tried exporting one to HTML, but the grade doesn’t seem to
> update automatically like it does in Org-mode. And no, other teachers
> around me are *not* going to switch to Org-mode, let alone Emacs, for this.
> So, does anyone have any ideas for how this can be shared? I don’t know any
> Javascript or anything.
>
> So, thanks so much to the Org maintainers, and the community that keeps
> Org alive. It’s allowed me to write and share so much, and soon I’ll be
> using it even more with Hugo.
>


Re: ox-* vs org-* naming convention?

2020-06-10 Thread Diego Zamboni
Hi everyone,

Just a quick update: issue
https://github.com/purcell/package-lint/issues/89 submitted by Kaushal
has been closed through the PR I submitted, so now package-lint
officially accepts "org-" symbols in "ox-" and "ob-" packages :)

--Diego

On Tue, Jun 9, 2020 at 9:13 PM Diego Zamboni  wrote:
>
> Hi again,
>
> > Given the special meanings of both the org- and ox- prefixes, I will
> > insist on keeping the current naming, and maybe take a stab at coming
> > up with a PR for https://github.com/purcell/package-lint/issues/89.
>
> I submitted a PR to allow certain package-to-symbol prefix mappings in
> package-lint: https://github.com/purcell/package-lint/pull/177
>
> Feel free to comment!
>
> --Diego



Re: ox-* vs org-* naming convention?

2020-06-09 Thread Diego Zamboni
Hi again,

> Given the special meanings of both the org- and ox- prefixes, I will
> insist on keeping the current naming, and maybe take a stab at coming
> up with a PR for https://github.com/purcell/package-lint/issues/89.

I submitted a PR to allow certain package-to-symbol prefix mappings in
package-lint: https://github.com/purcell/package-lint/pull/177

Feel free to comment!

--Diego



Re: ox-* vs org-* naming convention?

2020-06-08 Thread Diego Zamboni
Hi Kaushal and Jens,

Thanks for your feedback, and also for the idea for the workaround
used in ox-re-reveal - that's a nice one :)

Given the special meanings of both the org- and ox- prefixes, I will
insist on keeping the current naming, and maybe take a stab at coming
up with a PR for https://github.com/purcell/package-lint/issues/89.

Cheers,
--Diego

On Mon, Jun 8, 2020 at 7:54 AM Jens Lechtenboerger
 wrote:
>
> On 2020-06-07, Diego Zamboni wrote:
>
> > Hi,
> >
> > I am working on submitting a new set of exporters I've been working on
> > (https://gitlab.com/zzamboni/ox-leanpub) to MELPA, and I received
> > feedback [1] about the discrepancy between the package names
> > (ox-leanpub-*) and the functions they define (org-leanpub-*). This is
> > also flagged by =package-lint=.
> >
> > [1] https://github.com/melpa/melpa/pull/6942
> >
> > [...]
> >
> > I would appreciate any feedback about this - what are strong arguments
> > for or against insisting in this convention vs just adapting to the
> > rules suggested by package-lint?
>
> Hi there,
>
> for org-re-reveal, I use a small wrapper ox-re-reveal.el [2], whose
> commentary explains this:
>
> ;; Org export back-ends have file names starting with "ox-".
> ;; However, such files typically define variables and functions
> ;; starting with "org-", which causes errors by package-lint.  To
> ;; define variables and functions with the usual prefix "org-" while
> ;; avoiding errors by package-lint, code is located in
> ;; org-re-reveal.el.
> ;; However, the prefix "ox-" is hard-coded in org.el and used to load
> ;; back-ends in `org-export-backends'.  With this file, you can
> ;; customize `org-export-backends' and add `re-reveal'.  Then, when
> ;; pressing `C-c C-e', this file will be loaded, which loads
> ;; org-re-reveal.el.
>
> Best wishes
> Jens
>
> [2] https://gitlab.com/oer/org-re-reveal/-/blob/master/ox-re-reveal.el



ox-* vs org-* naming convention?

2020-06-07 Thread Diego Zamboni
Hi,

I am working on submitting a new set of exporters I've been working on
(https://gitlab.com/zzamboni/ox-leanpub) to MELPA, and I received
feedback [1] about the discrepancy between the package names
(ox-leanpub-*) and the functions they define (org-leanpub-*). This is
also flagged by =package-lint=.

[1] https://github.com/melpa/melpa/pull/6942

I based these names on what I've observed in existing exporters - e.g.
ox-hugo, ox-latex, ox-reveal and most others define functions named
org-hugo-*, org-latex-*, org-reveal-* respectively.

I wouldn't mind renaming the package to org-leanpub, but I worry
whether this would affect its discoverability, and to diverge from
existing convention for exporter packages.

I would appreciate any feedback about this - what are strong arguments
for or against insisting in this convention vs just adapting to the
rules suggested by package-lint?

Thanks in advance,
--Diego



Re: New mailing list archive at https://orgmode/list/

2020-06-05 Thread Diego Zamboni
Hi Bastien,

> > On Friday,  5 Jun 2020 at 09:47, Bastien wrote:
> >> with Kyle's help, I've set up a new mailing list archive:
> >>
> >> https://orgmode/list/

Thanks for setting this up.

I noticed that I am getting in master the following error when I do "make doc":

> make doc
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C doc info
makeinfo --no-split org.texi -o org
org.texi:18233: unknown command `somewhere'
make[1]: *** [org] Error 1

This seems to be caused by commit
fa4dddf8d29063dbd2161b7f33a776e2c063ed10, which introduced the
following change in a link to a list message (I don't know enough texi
syntax to suggest a fix):

--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -17104,7 +17104,7 @@ cause unexpected results.

-reasons why, see http://thread.gmane.org/gmane.emacs.orgmode/79046.
+reasons why, see https://orgmode.org/list/86fvqqc8jb@somewhere.org

Best,
--Diego



Re: Disambiguate internal links?

2020-06-05 Thread Diego Zamboni
I personally find CUSTOM_ID's easier since I can make them
unequivocally unique, and by using them the links don't break if I
change something in the headline title.

On Thu, Jun 4, 2020 at 5:26 PM Budiman Snowman  wrote:
>
> On Wed, Jun 3, 2020 at 9:21 PM Diego Zamboni  wrote:
>>
>> I almost always use a CUSTOM_ID property for this, e.g.
>>
>> * topic1
>> See topic [[#topic2][topic2]].
>> See glossary [[#glossary_topic2][topic2]].
>>
>> * topic2
>> :PROPERTIES:
>> :CUSTOM_ID: topic2
>> :END:
>>
>> * glossary
>> ** topic1
>> :PROPERTIES:
>> :CUSTOM_ID: glossary_topic2
>> :END:
>> ** topic2
>> :PROPERTIES:
>> :CUSTOM_ID: glossary_topic2
>> :END:
>>
>
> Are there advantages to using CUSTOM_ID instead of dedicated target? I'll 
> stick with dedicated target for now, because it's shorter to type.
>
> Regards,
> BS
>



Re: Anyone doing any fancy customizations of source blocks?

2020-06-04 Thread Diego Zamboni
Hi Brian,

Thanks for the kind words! I wrote a booklet about my setup including
other "literate config" examples, if you are interested:
https://leanpub.com/lit-config/read

I have been fascinated by the idea of literate programming since I got
a copy of The Stanford GraphBase while I was in college. I never used
CWEB directly, but I have tried noweb and other literate programming
tools over the years. However, Emacs + Org-mode + Babel is the first
toolset that I have actually been able to stick with on sustained use
:)

Best,
--Diego

On Wed, Jun 3, 2020 at 10:09 PM briangpowell .  wrote:
>
> If you haven't already, you probably know all about it; but, for any 
> newcomers on the subject of Literate Programming & source code blocks, etc.
>
> Highly recommend Knuth's CWEB book & of course NOWEB software {which is CWEB 
> generalized for ALL programming languages}:
>
> https://www-cs-faculty.stanford.edu/~knuth/cweb.html
>
> Thanks Diego, its a very interesting config example
>
> On Wed, Jun 3, 2020 at 2:24 PM Diego Zamboni  wrote:
>>
>> I use the config John mentioned and I like it - though I use different
>> symbols. Here's my config if you want an example:
>> https://github.com/zzamboni/dot-emacs/blob/master/init.org#source-code-blocks
>>
>> --Diego
>>
>> On Tue, Jun 2, 2020 at 9:24 PM John Kitchin  wrote:
>> >
>> > Here is one approach:
>> >
>> > https://pank.eu/blog/pretty-babel-src-blocks.html
>> >
>> > I feel like I have seen some work that used ruby and python icons as 
>> > displays over #+begin_src, but I can't find it now.
>> >
>> > John
>> >
>> > ---
>> > Professor John Kitchin
>> > Doherty Hall A207F
>> > Department of Chemical Engineering
>> > Carnegie Mellon University
>> > Pittsburgh, PA 15213
>> > 412-268-7803
>> > @johnkitchin
>> > http://kitchingroup.cheme.cmu.edu
>> >
>> >
>> >
>> > On Tue, Jun 2, 2020 at 2:54 PM William Denton  wrote:
>> >>
>> >> Is anyone doing any fancy formatting of source blocks, such as putting a 
>> >> line
>> >> in the left fringe, or a box around them, or having some interesting 
>> >> background?
>> >>
>> >> I ask because I recently changed the theme I use to get the dark 
>> >> Solarized look
>> >> I like,[1] and all of a sudden my #+begin_src lines were underlined and
>> >> #+end_src had a line above it.  These come from org-block-begin-line and
>> >> org-block-end-line, and are shown here, but I'd never noticed them in
>> >> documentation or had them on my screen before:
>> >>
>> >> https://orgmode.org/worg/org-contrib/babel/examples/fontify-src-code-blocks.html
>> >>
>> >> Aside from fontifying the source blocks I've never done anything special 
>> >> about
>> >> them (except wonder how I ever did anything without them), but seeing 
>> >> this made
>> >> me wonder if anyone here has really customized them so they look like 
>> >> medieval
>> >> manuscripts or something from a futuristic video game.  (If any of that is
>> >> possible---but in Emacs, anything is possible ...)
>> >>
>> >> Bill
>> >>
>> >> [1] Now I'm using https://github.com/bbatsov/solarized-emacs, with 
>> >> variable
>> >> pitch turned off and Org headline resizing turned off.
>> >>
>> >> --
>> >> William Denton :: Toronto, Canada   ---   Listening to Art: 
>> >> https://listeningtoart.org/
>> >> https://www.miskatonic.org/ ---   GHG.EARTH: https://ghg.earth/
>> >> Caveat lector.  ---   STAPLR: https://staplr.org/
>> >>
>>



Re: Anyone doing any fancy customizations of source blocks?

2020-06-03 Thread Diego Zamboni
I use the config John mentioned and I like it - though I use different
symbols. Here's my config if you want an example:
https://github.com/zzamboni/dot-emacs/blob/master/init.org#source-code-blocks

--Diego

On Tue, Jun 2, 2020 at 9:24 PM John Kitchin  wrote:
>
> Here is one approach:
>
> https://pank.eu/blog/pretty-babel-src-blocks.html
>
> I feel like I have seen some work that used ruby and python icons as displays 
> over #+begin_src, but I can't find it now.
>
> John
>
> ---
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>
>
>
> On Tue, Jun 2, 2020 at 2:54 PM William Denton  wrote:
>>
>> Is anyone doing any fancy formatting of source blocks, such as putting a line
>> in the left fringe, or a box around them, or having some interesting 
>> background?
>>
>> I ask because I recently changed the theme I use to get the dark Solarized 
>> look
>> I like,[1] and all of a sudden my #+begin_src lines were underlined and
>> #+end_src had a line above it.  These come from org-block-begin-line and
>> org-block-end-line, and are shown here, but I'd never noticed them in
>> documentation or had them on my screen before:
>>
>> https://orgmode.org/worg/org-contrib/babel/examples/fontify-src-code-blocks.html
>>
>> Aside from fontifying the source blocks I've never done anything special 
>> about
>> them (except wonder how I ever did anything without them), but seeing this 
>> made
>> me wonder if anyone here has really customized them so they look like 
>> medieval
>> manuscripts or something from a futuristic video game.  (If any of that is
>> possible---but in Emacs, anything is possible ...)
>>
>> Bill
>>
>> [1] Now I'm using https://github.com/bbatsov/solarized-emacs, with variable
>> pitch turned off and Org headline resizing turned off.
>>
>> --
>> William Denton :: Toronto, Canada   ---   Listening to Art: 
>> https://listeningtoart.org/
>> https://www.miskatonic.org/ ---   GHG.EARTH: https://ghg.earth/
>> Caveat lector.  ---   STAPLR: https://staplr.org/
>>



Re: Disambiguate internal links?

2020-06-03 Thread Diego Zamboni
I almost always use a CUSTOM_ID property for this, e.g.

* topic1
See topic [[#topic2][topic2]].
See glossary [[#glossary_topic2][topic2]].

* topic2
:PROPERTIES:
:CUSTOM_ID: topic2
:END:

* glossary
** topic1
:PROPERTIES:
:CUSTOM_ID: glossary_topic2
:END:
** topic2
:PROPERTIES:
:CUSTOM_ID: glossary_topic2
:END:

On Wed, Jun 3, 2020 at 4:06 PM Budiman Snowman  wrote:
>
> I have this document:
>
> * topic1
> See topic [[topic2]].
> See glossary [[topic2]].
>
> * topic2
> * glossary
> ** topic1
> ** topic2
>
> What are ways to disambiguate the internal links? The first link should link 
> to the topic2 first-level entry, while the second link should go to the 
> topic2 entry under glossary. They both have the same title. One way I know is 
> using a unique dedicated target, e.g.:
>
> * topic1
> See topic [[topic2]].
> See glossary [[glossary topic2][topic2]].
>
> * topic2
> * glossary
> ** <> topic1
> ** <> topic2
>
> What are other ways available?
>
> Regards,
> BS



Re: Splitting large org file into smaller ones

2020-05-30 Thread Diego Zamboni
Hi Marvin,

I replied to a similar question some time ago, here's my answer (with
updated links since the files have changed in the meantime):

I do something similar in my ox-leanpub-book module [1], which exports
each top-level heading to a different file. The general idea is to use
=org-map-entries= to loop over the entire buffer [2]. The function you
call can then check whether the current entry is a header at the level
you want [3] and then export it to the corresponding file. The title
can be used to deduct the filename [4].

I found that I had to mark the entire subtree before calling the
export function [5], otherwise the headline was not getting included
in the export.

I based my code originally on this blog post, which might be a simpler
starting point:
https://medium.com/@lakshminp/publishing-a-book-using-org-mode-9e817a56d144
- this code does not select the entire subtree before exporting, which
means only the contents of the section is exported, but not the
headline itself.

I wrote a simplified function which puts the above ideas together,
feel free to use it:
https://gist.github.com/zzamboni/2e6ac3c4f577249d98efb224d9d34488

Hope this helps!
--Diego

[1] https://github.com/zzamboni/ox-leanpub/tree/book-and-markua
[2] 
https://github.com/zzamboni/ox-leanpub/blob/f7ae0f86f517a321a5150e1c712554b12acf144b/ox-leanpub-book.el#L216-L217
[3] 
https://github.com/zzamboni/ox-leanpub/blob/f7ae0f86f517a321a5150e1c712554b12acf144b/ox-leanpub-book.el#L145
[4] 
https://github.com/zzamboni/ox-leanpub/blob/f7ae0f86f517a321a5150e1c712554b12acf144b/ox-leanpub-book.el#L154-L158
[5] 
https://github.com/zzamboni/ox-leanpub/blob/f7ae0f86f517a321a5150e1c712554b12acf144b/ox-leanpub-book.el#L192

On Sat, May 30, 2020 at 12:08 PM Marvin M. Doyley
 wrote:
>
> Hi there,
>
> Is there an efficient way to split a large org file into smaller ones?
>
> Lets say I have a master file with the following
>
>
> * Notes
> **  Candidate A
>  - Strong technical background
>  - High H-factor
>  - good funding
> - More established investigator
> - Huge startup need $$
>
> **  Candidate B
> - lower startup need
> - signal processing
> - young investigator
>
>
> How do I export the subtree to separate org files, say
>
> - Candidate-a.org
> - Candidate-b.org
>
>
> Thanks
>
> M



Re: emacs + org-mode in virtual machine/docker/...

2020-05-21 Thread Diego Zamboni
I have not used any personally, but using Docker or Vagrant it
shouldn't be too hard. Quick searches on Vagrant's and Docker's public
repositories reveals there are a few emacs-based images already,
although I could not find any specific mentions to Org:

https://app.vagrantup.com/boxes/search?utf8=%E2%9C%93=downloads==emacs
https://hub.docker.com/search?q=org-mode=image

Do you have interactive use in mind, or for automation?

--Diego

On Thu, May 21, 2020 at 3:27 PM John Kitchin  wrote:
>
> Has anyone had any success in creating or using any kind of virtual machine 
> that can work across platforms to run emacs+org-mode?
>
>
> John
>
> ---
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu
>



Re: issue tracker?

2020-05-19 Thread Diego Zamboni
Hi all,

Interesting discussion. I have also wondered about this - I have not
yet contributed to the Org codebase, but I have wondered if patches
and bug fixes can sometimes get lost among other discussions.

However, ultimately the best tracking system is the one that works for
the developers and their workflow. A full-featured issue tracking
system is useless if the developers don't have the habit of using it.

So, whatever works for Nicolas and all the other wonderful people who
maintain this amazing piece of software for free, works for me :)

Best,
--Diego



On Tue, May 19, 2020 at 10:18 PM Roland Everaert  wrote:
>
> Sourcehut seams interesting. Did you know if importing github/gitlab 
> projects, with issues and merge requests (opened and closed) is supported at 
> the moment?
>
> I noticed it is in alpha, so I don't expect to see all the features of any of 
> those forges yet.
>
> Before I forget, Does magit+forge works well with sourcehut, especially the 
> latter, as the former shouldn't have any problem?
>
>
> Regards,
>
> Roland.
>
>
> On Tue, May 19, 2020 at 9:43 PM Eric Abrahamsen  
> wrote:
>>
>> "James R Miller"  writes:
>>
>> > So, I definitely agree that using Github / Gitlab does expose you to
>> > tracking messes and that is something to shun. I figured a self-hosted
>> > Gogs instance (which is already being hosted at
>> > https://code.orgmode.org/bzg/org-mode) would fix the "tracking" issue.
>> >
>> > I think an actual issue tracker has merit to large projects.
>>
>> I've been going around doing proselytizing for sr.ht (sourcehut, aka
>> "Sir Hat"), which is a forge-like site that is very much in line with
>> Emacs' principles. No tracking (barely any javascript at all),
>> everything can be driven via email -- it's pretty nice. Could be a good
>> solution here.
>>
>> (Not affiliated, though I do give them money.)
>>
>> Eric
>>



Re: Tricking org-mode into using markdown conventions

2020-05-05 Thread Diego Zamboni
Hi Daryl,

I am assuming though, from the lack of answers back, that there appears to
> be no way to have org-mode grok markdown code blocks (triple backticks)
> when it parses as a substitute for `#+BEGIN_SRC` ?
>

I am no expert in the Org internals, but a quick search shows the strings
BEGIN/END_SRC are hardcoded in a few places, so it seems to me you are
correct, there's probably no easy way to do this.

--Diego


Re: Tricking org-mode into using markdown conventions

2020-05-04 Thread Diego Zamboni
Ihor,

Awesome, thanks for the tip. Using your code, the following config (inside
the code from https://pank.eu/blog/pretty-babel-src-blocks.html) produces a
display with the backticks instead of begin/end_src:

  (defun yant/str-to-glyph (str)
"Transform string into glyph, displayed correctly."
(let ((composition nil))
  (dolist (char (string-to-list str)
(nreverse (cdr composition)))
(push char composition)
(push '(Br . Bl) composition

  (defun rasmus/org-prettify-symbols ()
(mapc (apply-partially 'add-to-list 'prettify-symbols-alist)
  (cl-reduce 'append
 (mapcar (lambda (x) (list x (cons (upcase (car x))
(cdr x
 `(("#+begin_src" . ,(yant/str-to-glyph
"```")) ;; ⎡ ➤  ➟ ➤ ✎
   ("#+end_src"   . ,(yant/str-to-glyph
"```")) ;; ⎣ ✐
   ("#+header:" . ,rasmus/ob-header-symbol)
   ("#+begin_quote" . ?«)
   ("#+end_quote" . ?»)
(turn-on-prettify-symbols-mode)
(add-hook 'post-command-hook 'rasmus/org-prettify-src t t))

It looks like this in my config (the bars hide the header arguments):

[image: image.png]

--Diego


On Mon, May 4, 2020 at 6:19 AM Ihor Radchenko  wrote:

> > I did a quick test, and it seems
> > that =prettify-symbols-alist= (which is what this code uses) can only
> > replace for a single character, so I was not able to make it display
> > the three backticks, but there might be other techniques that can be
> > used.
>
> Yes, there is another technique.
> See part of my config below:
>
>
>   (defun yant/str-to-glyph (str)
> "Transform string into glyph, displayed correctly."
> (let ((composition nil))
>   (dolist (char (string-to-list str)
> (nreverse (cdr composition)))
> (push char composition)
> (push '(Br . Bl) composition
>
>   (append pretty-symbol-patterns
> `(((yant/str-to-glyph " ") org-specific ,(format
> "^\\(\\*\\{%d,%d\\}\\)\\*[^*]" (1- org-inlinetask-min-level) (1-
> org-inlinetask-max-level)) (org-mode) 1)
>   ((yant/str-to-glyph "⇒⇒⇒") org-specific ,(format
> "^\\(\\*\\{%d,%d\\}\\)\\(\\*\\)[^*]" (1- org-inlinetask-min-level) (1-
> org-inlinetask-max-level)) (org-mode) 2)
>   (?╭ org-specific "^[ ]*#[+]NAME" (org-mode))
>   (?╭ org-specific "^[ ]*#[+]name" (org-mode))
>   (?├ org-specific "[ ]*#[+]begin_src" (org-mode))
>   (?├ org-specific "[ ]*#[+]BEGIN_SRC" (org-mode))
>   (?╰ org-specific "[ ]*#[+]end_src" (org-mode))
>   (?╰ org-specific "[ ]*#[+]END_SRC" (org-mode))
>   ((yant/str-to-glyph "") org-specific ":\\(ATTACH\\):"
> (org-mode) 1)
>   ((yant/str-to-glyph "☠D") org-specific "\\   ((yant/str-to-glyph "◴S") org-specific "\\ (org-mode
>
> Diego Zamboni  writes:
>
> > Hi Daryl,
> >
> > If it's for display purposes only, you might be able to simply use
> > display substitutions for things to appear the way you want. For
> > example, I use the technique described here:
> > https://pank.eu/blog/pretty-babel-src-blocks.html to replace the
> > begin/end_src strings with symbols. I did a quick test, and it seems
> > that =prettify-symbols-alist= (which is what this code uses) can only
> > replace for a single character, so I was not able to make it display
> > the three backticks, but there might be other techniques that can be
> > used.
> >
> > --Diego
> >
> > On Sun, May 3, 2020 at 6:24 PM Daryl Manning 
> wrote:
> >>
> >> While using C-c C-, is easy enough for insertion and such, I was
> wondering if there was any way of having org-mode honour markdown
> conventions for things like code fences and quotes.
> >>
> >> ``` elisp
> >> #+begin_src
> >> #+end_src
> >>
> >> #+begin_quote
> >> #+end_quote
> >> ```
> >>
> >> being a bit nicer to read with
> >>
> >> ``` go
> >> code block
> >> ```
> >> as well as
> >>
> >> > And gentlemen in England now-a-bed.
> >> > Shall think themselves accurs'd they were not here,
> >> > And hold their manhoods cheap whiles any speaks.
> >> > That fought with us upon Saint Crispin's day.
> >>
> >> Just curious as to whether that's possible. YMMV before you start
> debating on whether you think this is a good idea or not... =]
> >>
> >> Of course, I'd want the code highlighting especially to work that way,
> though... =]  Less concerned with whether it works in export modes for the
> moment, more about display atm.
> >>
> >> thanks!
> >> Daryl.
> >>
> >>
> >>
> >>
> >>
> >
>
> --
> Ihor Radchenko,
> PhD,
> Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
> State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong
> University, Xi'an, China
> Email: yanta...@gmail.com, ihor_radche...@alumni.sutd.edu.sg
>


Re: Tricking org-mode into using markdown conventions

2020-05-03 Thread Diego Zamboni
Hi Daryl,

If it's for display purposes only, you might be able to simply use
display substitutions for things to appear the way you want. For
example, I use the technique described here:
https://pank.eu/blog/pretty-babel-src-blocks.html to replace the
begin/end_src strings with symbols. I did a quick test, and it seems
that =prettify-symbols-alist= (which is what this code uses) can only
replace for a single character, so I was not able to make it display
the three backticks, but there might be other techniques that can be
used.

--Diego

On Sun, May 3, 2020 at 6:24 PM Daryl Manning  wrote:
>
> While using C-c C-, is easy enough for insertion and such, I was wondering if 
> there was any way of having org-mode honour markdown conventions for things 
> like code fences and quotes.
>
> ``` elisp
> #+begin_src
> #+end_src
>
> #+begin_quote
> #+end_quote
> ```
>
> being a bit nicer to read with
>
> ``` go
> code block
> ```
> as well as
>
> > And gentlemen in England now-a-bed.
> > Shall think themselves accurs'd they were not here,
> > And hold their manhoods cheap whiles any speaks.
> > That fought with us upon Saint Crispin's day.
>
> Just curious as to whether that's possible. YMMV before you start debating on 
> whether you think this is a good idea or not... =]
>
> Of course, I'd want the code highlighting especially to work that way, 
> though... =]  Less concerned with whether it works in export modes for the 
> moment, more about display atm.
>
> thanks!
> Daryl.
>
>
>
>
>



Re: Org mode for meeting minutes

2020-03-25 Thread Diego Zamboni
This is such a great thread. Thanks everyone for your examples and ideas!
I'll be using some of these for sure for my notes.

--Diego


On Wed, Mar 25, 2020 at 6:57 PM Bob Newell  wrote:

>
> I'll second (nth) all the compliments. Your work is not only
> day to day useful but is a great mini-tutorial on the usage of
> a previously undocumented org-mode feature that is highly
> useful.
>
> --
> Bob Newell
> Honolulu, Hawai`i
> - Via Gnus/BBDB/Org/Emacs/Linux
>
>


Re: [SOLVED] Re: Can Org Mode tag support dash character "-"?

2020-03-15 Thread Diego Zamboni
TIL about org-pretty-tags, looks awesome. Thanks!

On Sun, Mar 15, 2020 at 8:24 AM Marco Wahl  wrote:

>
> stardiviner  writes:
>
> > Carsten Dominik  writes:
> >
> >> On Fri, Mar 13, 2020 at 3:08 PM stardiviner 
> wrote:
> >>
> >>  I found Org Mode tags does not support tag like "COVID-9", The dash
> character "-" is not supported.
> >>
> >>  Can Org Mode support the dash char because it is very often used.
> >>
> >> This is not a good idea, because searches can be built with +tag and
> -tag .
> >>
> >> Use COVID9 or COVID_9 instead.
> >
> > I see, thanks.
>
> BTW you could use some kind of decoration for the visual representation
> of tags e.g. an image of a corona-virus.  This is the idea of
> https://melpa.org/#/org-pretty-tags.  You could even use "COVID-19" as
> replacement for "COVID19" but possibly this brings too much confusion.
>
>
> Hopefully not too shameless at plugging,
> -- Marco
>
>


Re: Insert PROPERTIES drawer after heading creation

2020-03-11 Thread Diego Zamboni
Hi Lawrence,

On Wed, Mar 11, 2020 at 7:56 PM Lawrence Bottorff  wrote:

> I read that too, but couldn't fathom what they meant. Still, I'm not sure
> what they mean by "prefix argument."
>

The prefix argument in this case is not so important as the OUTPUT-BUFFER
argument, which you were passing as =t=:

"If OUTPUT-BUFFER is not a buffer and not nil, insert the output in current
buffer after point leaving mark after it."

which is why the output is inserted in the buffer.

And why does (shell-command "uuidgen" t) produces two outputs? For other
> readers, this is what they look like in *scratch*
>
> (shell-command "uuidgen" t)
> 2827
> b5da7e0a-84c0-4db8-91f3-871b681f3022
>

The first number is the return value of shell-command, which is (I think)
the position in the buffer at which the pointer was when the function was
evaluated (or something like this). Here's the output from two consecutive
executions in my *scratch* buffer:

(shell-command "uuidgen" t)
173
5E69575E-2807-40BB-B1FE-10058D3C0666

(shell-command "uuidgen" t)
243
A7FD662E-A752-4E02-B4E0-A3E48CC7E7AB

The "173" happens to appear at point position 173 in the buffer, and same
for the 243 (you can verify this with "C-u C-x =").

Hope this helps!

--Diego


Re: Insert PROPERTIES drawer after heading creation

2020-03-11 Thread Diego Zamboni
On Wed, Mar 11, 2020 at 2:14 PM Lawrence Bottorff  wrote:

> Yes, thanks. That substring was a bad copy. Any insight why the
> (shell-command "uuidgen" t) wasn't working?
>

I hadn't looked at it yet, but the documentation for =shell-command= gives
the answer:

Execute string COMMAND in inferior shell; display output, if any.
With prefix argument, *insert the COMMAND’s output at point*.


So this function does not return a string that can be concatenated with
others, it actually inserts the output in the buffer, so it's not
guaranteed it will land where you need it.

To have the output of the command returned as a string, I think you should
use =shell-command-to-string=.

--Diego


Re: Need Guidance in developing and generating code using org-mode

2020-02-28 Thread Diego Zamboni
Hi Kokou,

In addition to what others have said, you might want to use Hugo (
https://gohugo.io/) for producing your website, and in this case you can
use the fantastic ox-hugo (https://ox-hugo.scripter.co/) to manage the
contents from within org-mode. It should be possible to use Hugo's features
to implement all the features you have mentioned.

--Diego


On Fri, Feb 28, 2020 at 3:11 PM Christian Moe  wrote:

>
> Hi, Kokou,
>
> Adding to what Leslie Watter writes:
>
> >>- Under Register, and Login heading, How do i generate html forms
> >>which will post entries to specific destinations? and also generate
> code
> >>for capturing the data?
> >>
> >> To use forms, you'll probably will use raw HTML:
> >
> > https://orgmode.org/manual/Quoting-HTML-tags.html#Quoting-HTML-tags
> >
>
> And for capturing the data, you will of course need to provide scripts
> on a server as targets for the html forms.
>
> Org is great for quick writing and exporting to HTML. It can also be
> used to publish whole static websites and blogs. Some people use a
> combination of Org and other static blogging tools, like Jekyll, which
> adds some helpful functionality.
>
> However, if you want to dynamically serve pages only to logged-in users,
> Org-mode may not be the tool you are looking for. You may want to look
> at blogging platforms or content management systems. (If you like
> writing in Org, you can still use it for drafting.)
>
> Yours,
> Christian
>
>


Re: Survey: changing a few default settings for Org 9.4

2020-02-21 Thread Diego Zamboni
Thanks Bastien for all your work!

--Diego


On Fri, Feb 21, 2020 at 4:50 PM Bastien  wrote:

> Hi all,
>
> here are the results of the survey, with *47* voters:
>
> - 26+2 : org-loop-over-headlines-in-active-region => t
> - 25+2 : org-agenda-loop-over-headlines-in-active-region => t
> - 28+3 : org-fontify-done-headline => t
> - 17+4 : org-hide-emphasis-markers => t
> - 10+6 : org-hide-macro-markers => t
> - 15+5 : org-refile-use-cache => t
> - 23+6 : org-special-ctrl-k => t
> - 20+6 : org-allow-promoting-top-level-subtree => t
> - 22+5 : Add org-tempo to org-modules
>
> I've changed the values of these options in master:
>
> - 35+2 : org-src-tab-acts-natively => t
> - 28+3 : org-fontify-done-headline => t
> - 26+2 : org-loop-over-headlines-in-active-region => t
> - 25+2 : org-agenda-loop-over-headlines-in-active-region => t
>
> I've *not* changed the values of these options:
>
> - 23+6 : org-special-ctrl-k => t
> - 22+5 : Add org-tempo to org-modules
> - 20+6 : org-allow-promoting-top-level-subtree => t
> - 17+4 : org-hide-emphasis-markers => t
> - 10+6 : org-hide-macro-markers => t
> - 15+5 : org-refile-use-cache => t
>
> The reason for not changing the default of org-special-ctrl-k is that
> 23 < 47/2.  Also, I think it was a mistake to propose this: even the
> org-special- prefix should have warned me.  The org-special-* options
> should be nil by default, and while org-special-ctrl-k may be useful,
> it is as useful as org-special-ctrl-a/e, which sticks to nil too.
>
> The reason for not adding org-tempo to org-modules is, on top of the
> poll being 22 < 47/2, that the current discussion on the list leaves
> room for improvements that may lead to move org-tempo from Org's core
> anyway.
>
> The reason for not changing the four other options is that they did
> not get enough votes.
>
> I've push the change for the three options in current master.
>
> Thanks again for participating to the poll and to the discussions!
>
> Best,
>
> --
>  Bastien
>
>


Re: Bug or not a bug? dot expansion in ob-shell

2020-02-19 Thread Diego Zamboni
I'm late to the discussion so I apologize in advance, but this fix seems
counterintuitive to me. In my mind, for any shell code:

- Return value: exit code of the last command
- Output: whatever the commands print

So to me, it's intuitive that =:exports value= would return the exit code
of the last command, and =:exports output= would produce the output of the
commands. I don't understand why a new option is needed.

Am I missing something?

--Diego


On Wed, Feb 19, 2020 at 5:00 PM Bastien  wrote:

> I've implemented the suggestion I made in master:
>
>   New option ~ob-shell-return-value-is-exit-status~
>
>   When set to =t=, consider the return value of a shell source code
>   block is the exit status of its last command.
>
>   The default for this option is =nil=, i.e. the return value of a shell
>   block is the output of the commands.
>
>   You can turn this on individual blocks by setting the header argument
>   =:value-is-exit-status= to =t=.
>
> Please test and let me know if it works.
>
> Thanks for bringing this up!
>
> --
>  Bastien
>
>


Re: On writing a theme for raw-notes prose legibility

2020-02-12 Thread Diego Zamboni
>
> I have similar idea, I try to create a minor mode for Org Mode to archive
> this
> effect.
>
> https://lepisma.github.io/2017/10/28/ricing-org-mode/


Wow, that looks absolutely amazing. Thanks for the link!

--Diego


Re: How to intersperse commands with their output in RESULTS block?

2020-02-07 Thread Diego Zamboni
Hi Adam and Eric for your further comments!

I had read a bit about the =rx= package but not used it, thanks for the
pointer to =xr=, makes it a lot easier to figure out the syntax.

One more thing I realized is that I can make the desired settings the
defaults within my document, and even automatically wrap all blocks with
the =script= command, by setting the corresponding properties:

#+property: header-args:sh+ :exports output
#+property: header-args:sh+ :results output
#+property: header-args:sh+ :wrap "src console"
#+property: header-args:sh+ :post cleanup(data=*this*)
#+property: header-args:sh+ :prologue "script < wrote:

> Diego Zamboni  writes:
>
> > I came up with the following block, which cleans up all the cruft from
> > the output of the =script= command and produces a nicely formatted
> > session transcript:
> >
> > #+NAME: cleanup
> > #+BEGIN_SRC emacs-lisp :var data="" :results value :exports none
> >   (replace-regexp-in-string
> >"\\$ exit\\(.\\|\n\\)*$" ""
> >(replace-regexp-in-string
> > "^bash-.*\\$" "$"
> > (replace-regexp-in-string
> >  "\\(\\(.\\|\n\\)*?\\)\\$\\(.\\|\n\\)*\\'" ""
> >  (replace-regexp-in-string "
> > " "" data) nil nil 1)))
> > #+END_SRC
> >
> > (I am not happy with the regexp nesting and repetition above, I am not
> > an expert yet in emacs-lisp regex facilities. Suggestions appreciated
> > for how to simplify it).
>
> Hi Diego,
>
> A few suggestions:
>
> 1.  You can use `rx' to define regexps in a Lispy way, and the ELPA
> package `xr' converts existing regexp strings to the rx format, which
> can help in learning rx syntax.  For example:
>
>   (xr "^bash-.*\\$" 'brief) ;;=> (seq bol "bash-" (0+ nonl) "$")
>
> So you can use that regexp like:
>
>   (replace-regexp-in-string (rx bol "bash-" (0+ nonl) "$") ...)
>
> This nasty one is much easier with rx:
>
>   (xr "\\(\\(.\\|\n\\)*?\\)\\$\\(.\\|\n\\)*\\'" 'brief)
>   ;;=>
>   ;; (seq (group (*? (group anything)))
>   ;;  "$" (0+ (group anything)) eos)
>
> 2.  To avoid the nested calls, you can use a loop, like:
>
>   (cl-loop for (match replace) in
>(list (list (rx foo bar) "replacement"))
>do (setf string
> (replace-regexp-in-string match replace
>   string)))
>
>
>


Re: How to intersperse commands with their output in RESULTS block?

2020-02-07 Thread Diego Zamboni
Hi everyone,

Quick follow up about this: following Eric's suggestion, I came up with the
following block, which cleans up all the cruft from the output of the
=script= command and produces a nicely formatted session transcript:

#+NAME: cleanup
#+BEGIN_SRC emacs-lisp :var data="" :results value :exports none
  (replace-regexp-in-string
   "\\$ exit\\(.\\|\n\\)*$" ""
   (replace-regexp-in-string
"^bash-.*\\$" "$"
(replace-regexp-in-string
 "\\(\\(.\\|\n\\)*?\\)\\$\\(.\\|\n\\)*\\'" ""
 (replace-regexp-in-string "
" "" data) nil nil 1)))
#+END_SRC

(I am not happy with the regexp nesting and repetition above, I am not an
expert yet in emacs-lisp regex facilities. Suggestions appreciated for how
to simplify it).

This produces exactly the result I need:

#+begin_src sh :exports output :results output :wrap "src console" :post
cleanup(data=*this*)
script < wrote:

> Hi Eric,
>
> Great idea! I hadn't considered using the =script= command, it's a great
> starting point.
>
> Thanks!
> --Diego
>
>
> On Thu, Feb 6, 2020 at 7:55 AM Fraga, Eric  wrote:
>
>> On Wednesday,  5 Feb 2020 at 18:25, Diego Zamboni wrote:
>> > tl;dr: is there a way to have ob-shell (or some similar mode) run
>> commands
>> > one by one and include the commands, interspersed with their output, in
>> the
>> > #+RESULTS block?
>>
>> You haven't said on what type of system but, if Linux, you could try
>> using =script= as a starting point:
>>
>> #+begin_src shell :results output
>>   script <>   ls
>>   echo 'hello'
>>   EOF
>> #+end_src
>>
>> You may wish to have a second shell script that massages the output in
>> the =typescript= file and ouputs that instead, e.g. to filter the
>> carriage returns.
>> --
>> : Eric S Fraga via Emacs 28.0.50, Org release_9.3.2-233-gc2bc48
>>
>


Re: How to intersperse commands with their output in RESULTS block?

2020-02-06 Thread Diego Zamboni
Hi Eric,

Great idea! I hadn't considered using the =script= command, it's a great
starting point.

Thanks!
--Diego


On Thu, Feb 6, 2020 at 7:55 AM Fraga, Eric  wrote:

> On Wednesday,  5 Feb 2020 at 18:25, Diego Zamboni wrote:
> > tl;dr: is there a way to have ob-shell (or some similar mode) run
> commands
> > one by one and include the commands, interspersed with their output, in
> the
> > #+RESULTS block?
>
> You haven't said on what type of system but, if Linux, you could try
> using =script= as a starting point:
>
> #+begin_src shell :results output
>   script <   ls
>   echo 'hello'
>   EOF
> #+end_src
>
> You may wish to have a second shell script that massages the output in
> the =typescript= file and ouputs that instead, e.g. to filter the
> carriage returns.
> --
> : Eric S Fraga via Emacs 28.0.50, Org release_9.3.2-233-gc2bc48
>


How to intersperse commands with their output in RESULTS block?

2020-02-05 Thread Diego Zamboni
Hi everyone,

tl;dr: is there a way to have ob-shell (or some similar mode) run commands
one by one and include the commands, interspersed with their output, in the
#+RESULTS block?

I would like to have examples shown with commands, followed by their
output. Something like this:

#+begin_src console
> echo "hi"
hi
> echo "bye"
bye
#+end_src

This works well for my use case - "console" blocks are understood nicely by
Pygmentize as containing both commands and output.

What I would like is to start using org-babel to run the commands and
insert their output in the export, so that I can update the examples
without having to copy-paste from the terminal. So what I would like is to
have something like this:

#+begin_src sh :exports results :wrap "src console"
echo "hi"
echo "bye"
#+end_src

And when I evaluate the block with C-c C-c, I get:

#+results:
#+begin_src console
> echo "hi"
hi
> echo "bye"
bye
#+end_src

Before I start building my own, ob-mode I was wondering if anyone knows of
any existing way to achieve this.

Thanks!
--Diego


Re: A new, "org-bullets"-like minor mode

2020-02-01 Thread Diego Zamboni
Hi D.,

Would it be appropriate to share the link here? I think it would be
> great to get feedback before trying to get it on melpa.
>

I would love to give it a try! I use org-bullets currently, and your new
features sound quite interesting :)

--Diego


Re: customizing Org for legibility

2020-02-01 Thread Diego Zamboni
> Ok, I see what you're saying. You're proposing to have TODO states and
> other tags on the left of the heading title in fixed pitch, and the
> heading title in variable pitch. In my current setup the whole heading
> is fixed in Agenda and variable in normal buffers. I agree it would be
> good to have mixed-pitch headings.
>

This is doable for the TODO states already using the org-todo-keyword-faces
variable, which can contain full font attribute lists, like this:

(org-todo-keyword-faces
 '(("TODO" . (:foreground "DarkOrchid1" :inherit fixed-pitch))
   ("INBOX". "cyan"))

--Diego


Re: customizing Org for legibility

2020-02-01 Thread Diego Zamboni
HI Bob,

In my testing, all font-related settings get ignored when running in
terminal mode, except for the colors.

--Diego


On Sat, Feb 1, 2020 at 9:12 PM Bob Newell  wrote:

> Aloha everyone,
>
> > I agree terminal users typically won't want variable pitch, but disagree
> > that they are generally doing sysadmin -- I know users who use org-mode
> > for their notes, but prefer to use emacs in the terminal.
>
> I have a Very Big Use Case here: on my Android devices I run
> Termux, which runs nearly everything perfectly but only in
> terminal mode. I run Emacs/org-mode this way on my Android
> tablet all the time when out of the house or traveling.
>
> The mixed pitch idea has great merit, don't get me wrong, and
> would be a very nice thing indeed on my native Linux
> devices. But I'd hope there would be no "unintended
> consequences" for terminal users.
>
> --
> Bob Newell
> Honolulu, Hawai`i
> - Via Gnus/BBDB/Org/Emacs/Linux
>
>


Re: customizing Org for legibility

2020-02-01 Thread Diego Zamboni
Hi Samuel,


> i get the sense spacemacs has brought a lot of new users to emacs.  i
> don't use it but i have comments on your interesting and welcome
> beauty tips.
>

This is definitely the case. I also don't use Spacemacs, but know a few
people who got started thanks to it. I even have a friend who was a
devoted vim user, and now swears by Spacemacs, particularly thanks to
org-mode and magit :)

this is really impressive.  does it have a fill column?
>

Yes, there is (I don't use it):
https://github.com/joostkremers/visual-fill-column

i would be over the moon if you could make headers in the agenda
> variable pitch.  not only would it look better and be consistent with
> the outline, but it would conserve space.
>

I think you can configure most faces as you wish. For this, I have found
the key "C-u C-x =" (which run what-cursor-position with the DETAILED
argument enabled) very useful - among other things, it shows the face which
is applied at the point under the cursor. Based on that, you can know which
face you need to customize. For example, when running it on an agenda
header line, I see the following:

There are text properties here:
  day  737456
  face org-agenda-date-today

By customizing this face to inherit from "variable-pitch", I was able to
make those lines display in variable pitch font.

also, i would remove the second column, which seems not to do anything.
>
> also, i removed colons from some columns in the agenda and think it
> looks better.  also i aligned all items.  also, i made bare active
> tses use a leader.  also i made everything more compact except
> categories which i widened.  also, i removed [xd.] in leaders.
>

I would be interested to learn how to make these customizations. I have
only recently been getting into agenda mode, so I have not customized much
yet,

curious what the brackets mean in
>("PROPOSAL" . "orange")
>("[PROPOSAL]"   . "orange")
>

Nothing special - only that I sometimes use TAG in my headers, and others I
use [TAG], depending on how I think it looks better at the time :) This way
it gets colorized correctly no matter what.

what does reformatting a buffer change?
>

I guess you are referring to the zz/org-reformat-buffer in my config? I got
this from the mailing list, although I can't remember who posted it (sorry
to the author! there goes my intention to always attribute things). It
basically redoes all the spacing and indentation in the buffer. I run it
every once in a while to uniformize things.

could tags be fixed to stay at a column by counting pixels?
>

I have not found a way to make that happen. The misalignment was bothering
me, so in the end this is what I do:

- In =variable-pitch= mode, the default right-alignment for headline tags
doesn't work, and results in the tags being misaligned (as it uses
character positions to do the alignment). This setting positions the tags
right after the last character of the headline, so at least they are more
consistent.

  #+begin_src emacs-lisp :tangle no :noweb-ref org-mode-custom-vars
(org-tags-column 0)
  #+end_src


> thank you for the tips.
>

Glad you found them useful!

Cheers,
--Diego


Re: customizing Org for legibility

2020-01-31 Thread Diego Zamboni
Hi,

I think it's a noble effort to popularize org-mode and to make it easier to
use. And I learned today about mixed-pitch :)

However, a lot of visual configuration depends on fonts, colors, and other
things which may vary a lot between users. While most of us by now probably
use a graphical version of Emacs, any such default settings should be done
with care for users who still use Emacs on a pure-text interface.

Making some default prettification as part of Spacemacs's org-mode layer
would be nice, since it includes a lot of customization and eye candy
already.

In case it's of use or for reference, I wrote a "Beautifying org-mode" blog
post some time ago: https://zzamboni.org/post/beautifying-org-mode-in-emacs/

(the corresponding section of my config file is here:
https://github.com/zzamboni/dot-emacs/blob/master/init.org#beautifying-org-mode
)

All the best,
--Diego



On Fri, Jan 31, 2020 at 10:35 AM Texas Cyberthal 
wrote:

> I aim to popularize Spacemacs as a personal info manager. Next task is
> the Org configuration layer.
>
> As preparation, I wrote a post critiquing Org's out-of-the-box
> legibility. I believe a default configuration should cater to
> beginners, since they're least likely to know how to customize. On the
> other hand, maybe a package should set defaults to the median user and
> leave beginner intake to distributions.
>
> Along the way, I discovered mixed-pitch, which fixed most of my
> complaint. It's quite obscure. I'd like to include it in Spacemacs'
> Org layer.
>
> I'm sharing my thoughts to see whether I'm missing anything else.
>
> https://cyberthal-ghost.nfshost.com/configuring-org-for-readable-prose-is-too-complicated/
>
>


  1   2   >