What would be "cheapest" way to toggle emphasized text?

2022-01-24 Thread Arthur Miller


Hello,

can anybody tell me what is the reason why org-mode has to be restarted when
'org-fontify-emphasized-text' is changed?

If I would like to have an interactive "toggle" to control rendering of
emphasized text, is there any "cheaper" way to achieve that but to restart
org-mode?

#+begin_src emacs-lisp
(defun org-mode-toggle-emphasized-text ()
  (interactive)
  (setq org-fontify-emphasized-text
(not org-fontify-emphasized-text))
  (org-mode-restart))
#+end_src

I have tried to go through the buffer and reset text properties for org-emphais
text property and to re-fontify buffer but I didn't manage to find any way but
to restart the org-mode. I would like to skip all the work done in
initialization if possible.

Thanks for help



Re: [BUG] ob-tangle overrides user customization of org-id-link-to-org-use-id [9.5.2 (9.5.2-gfbff08 @ /home/ionasal/.emacs.d/elpa/org-9.5.2/)]

2022-01-24 Thread Allen Li
Ihor Radchenko  writes:
> Unfortunately, fixing the occurrences of (defvar foo nil) is not
> completely straightforward. Some of them are real defvars.

I see, I thought you meant those defvars were also used for dynamic
scoping.

>
> If someone is willing to check all the occurrences of
> (defvar +[^ ]+ +nil) and remove nil values where we merely put a defvar
> to silence byte-compiler, please do it.

My initial request was just to fix this one instance that is actively
troubling me.  If there are any other known cases of defvar, they should
also be fixed.  If not, then let's wait until someone identifies them.

If any maintainers reading this could fix this one defvar, that'd be
great.

>
> Also, I feel that my Elisp-foo is not good enough in this specific
> scenario. I invite others to reply if they feel that changing
> (defvar foo nil) to (defvar foo) for externally defined variables is
> _not_ universally safe.
>
> Best,
> Ihor



Re: Missing the second '}'

2022-01-24 Thread John Kitchin
depending on the file, you may be able to use M-x check-parens. I say
depending on the file because it matters how the open/close marker syntax
is defined in the file.

Or go to the beginning, and run M-x forward-sexp repeatedly until you get
an error?

John

---
Professor John Kitchin (he/him/his)
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



On Mon, Jan 24, 2022 at 11:02 AM Sharon Kimble 
wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA512
>
> Hi folks.
>
> In a document that I'm compiling I seem to have failed to close the '{'
> and '}', and the second one isn't in the document. If I write '\label{}'
> then it succeeds, but at a couple of places in the document this show
> '\label{'.
>
> How can I find where I've failed to close the brackets please, so that I
> can then achieve normality please?
>
> Thanks
> Sharon.
> - --
> A taste of linux = http://www.sharons.org.uk
> TGmeds = http://www.tgmeds.org.uk
> DrugFacts = https://www.drugfacts.org.uk
> Debian 11, fluxbox 1.3.7, emacs 29.0.50, org 9.5.2
> -BEGIN PGP SIGNATURE-
>
> iQJRBAEBCgA7FiEELSc/6QwVBIYugJDbNoGAGQr4g1sFAmHuzPAdHGJvdWRpY2Nh
> c0Bza2ltYmxlMDkucGx1cy5jb20ACgkQNoGAGQr4g1vLKA//Y298U9Rb+t+VYvhy
> PepzASzFj+HDFbUUhnCouODx0fQbIxEZvi0EzRM6HgxUTTkgxOqy8puGI+XUJPdm
> ncbWyVqqA7M5xjl/w9HMX08dwd/0pIRIUmODP2IDBO2HdwyOA8QNW2Nab6/+UlMU
> leJh0263TCfpv54Dsjg1RDhNulHubKr5TNadHJDqy50dT87wSRJC2RdKFJ71ljQZ
> 4zlUzEwulvgRB+6KbxGdoEQJW61c3qM7NKz2OQSa8p3EKT/t0LZGF7ToJevZzarJ
> cunE7dbnuDPGsmNVberc572xBrqgFH7iVW3zcYwTLc2JRDL4/2BFdH1UoGaAsjyk
> 9fpgYuqLP5dgJMwBmRCYtCsvKN4VFuyk8k4zYqJx19bJIxobKuYniZtVr5joFUfV
> +jgr0ss+ZqLoQPanrrCOPycn0aVxteDVUdN+V37b1iVdDPQuanF/fkL7x59LV3pp
> C1r5N9bX3X+5bBGaO4XF5p5UnUyg19luULdIONpC94MbsxWNmUF1XWZJvR2Oh/tj
> YI5Ctw7POFITHo92TEny6kdpjtLag2+5INQajl6oQ19Lm+fmhu7/Vm4PSSm/Rybh
> KatZgvdgBHd0veollwOqwGSvopNMYPPJ6s5uT5Sop8+gM6bc1guddqdApezVB0WD
> i/fweF+vFfk7Ot14Kw8S3efgYm8=
> =XMFk
> -END PGP SIGNATURE-
>
>


Re: Missing the second '}'

2022-01-24 Thread Juan Manuel Macías
Hi Sharon,

Sharon Kimble writes:

> Hi folks.
>
> In a document that I'm compiling I seem to have failed to close the '{'
> and '}', and the second one isn't in the document. If I write '\label{}'
> then it succeeds, but at a couple of places in the document this show
> '\label{'.
>
> How can I find where I've failed to close the brackets please, so that I
> can then achieve normality please?

Is this an Org document that you are exporting to LaTeX? If there is a
compile error, you can usually see it at the end of the *Org PDF LaTeX
Output* buffer. If it is a badly closed command, it is usually a
"Runaway argument?" warning, and the compiler indicates the problematic
line, which you should look for in the *.tex document. Sometimes it's
not easy to find the problem. The fastest way is to compile the *.tex
document directly with LaTeX and review the log file. It also usually
works to raise the position of \end{document} in the document. There
will come a point where it stops giving errors, and then the problem
will be easily located in the paragraph after \end{document}.

Best regards,

Juan Manuel 





[PATCH] Add support for $…$ latex fragments followed by a dash

2022-01-24 Thread Sébastien Miquel

Hi,

The attached patch adds support for $…$ latex fragments followed by a
dash, such as $n$-th.

This pattern is quite common, and the issue was mentionned by Rudolf
Adamkovič, here: https://list.orgmode.org/m2mtjvefrf@me.com/.

This extension of the syntax doesn't conflict with the use of $'s in
table formulas, or for currency, AFAICT.

Regards,

--
Sébastien Miquel
From b023fff129a5cc3b1f12b9f170f2e018dc34d237 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= 
Date: Sun, 23 Jan 2022 13:28:03 +0100
Subject: [PATCH] =?UTF-8?q?org-element:=20Support=20$=E2=80=A6$=20LaTeX=20?=
 =?UTF-8?q?fragments=20followed=20by=20a=20dash?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/org-element.el (org-element-latex-fragment-parser):
* lisp/org.el (org-latex-regexps): Allow a dash right after a
$…$ fragment.
* testing/lisp/test-org-element.el (test-org-element/latex-fragment-parser):
Add test.

Allows such uses as `$n$-th' or `$n$-dimensional'.
---
 lisp/org-element.el  | 2 +-
 lisp/org.el  | 4 ++--
 testing/lisp/test-org-element.el | 4 
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index b82475a14..40a604578 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -3416,7 +3416,7 @@ Assume point is at the beginning of the LaTeX fragment."
 		 (not (memq (char-before (match-beginning 0))
 '(?\s ?\t ?\n ?, ?.)))
 		 (looking-at-p
-		  "\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|'\\|$\\)")
+		  "\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|'\\|-\\|$\\)")
 		 (point)
 	 (post-blank
 	  (if (not after-fragment) (throw 'no-object nil)
diff --git a/lisp/org.el b/lisp/org.el
index 2d439cd05..3a164ee77 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -629,8 +629,8 @@ An entry can be toggled between COMMENT and normal with
   '(("begin" "^[ \t]*\\(begin{\\([a-zA-Z0-9\\*]+\\)[^\000]+?end{\\2}\\)" 1 t)
 ;; ("$" "\\([ \t(]\\|^\\)\\(\\(\\([$]\\)\\([^ \t\n,.$].*?\\(\n.*?\\)\\{0,5\\}[^ \t\n,.$]\\)\\4\\)\\)\\([ \t.,?;:'\")]\\|$\\)" 2 nil)
 ;; \000 in the following regex is needed for org-inside-LaTeX-fragment-p
-("$1" "\\([^$]\\|^\\)\\(\\$[^ \t\r\n,;.$]\\$\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|'\\|$\\)" 2 nil)
-("$"  "\\([^$]\\|^\\)\\(\\(\\$\\([^ \t\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \t\n,.$]\\)\\$\\)\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|'\\|$\\)" 2 nil)
+("$1" "\\([^$]\\|^\\)\\(\\$[^ \t\r\n,;.$]\\$\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|'\\|-\\|$\\)" 2 nil)
+("$"  "\\([^$]\\|^\\)\\(\\(\\$\\([^ \t\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \t\n,.$]\\)\\$\\)\\)\\(\\s.\\|\\s-\\|\\s(\\|\\s)\\|\\s\"\\|\000\\|'\\|-\\|$\\)" 2 nil)
 ("\\(" "([^\000]*?)" 0 nil)
 ("\\[" "\\[[^\000]*?\\]" 0 nil)
 ("$$" "\\$\\$[^\000]*?\\$\\$" 0 nil))
diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el
index 6d7376a96..2055e3a7b 100644
--- a/testing/lisp/test-org-element.el
+++ b/testing/lisp/test-org-element.el
@@ -1776,6 +1776,10 @@ e^{i\\pi}+1=0
(eq 'latex-fragment
(org-test-with-temp-text "$a$'"
 	 (org-element-type (org-element-context)
+  (should
+   (eq 'latex-fragment
+   (org-test-with-temp-text "$a$-"
+	 (org-element-type (org-element-context)
   ;; Test forbidden characters inside $...$.
   (should-not
(eq 'latex-fragment
-- 
2.34.1



Missing the second '}'

2022-01-24 Thread Sharon Kimble
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Hi folks.

In a document that I'm compiling I seem to have failed to close the '{'
and '}', and the second one isn't in the document. If I write '\label{}'
then it succeeds, but at a couple of places in the document this show
'\label{'.

How can I find where I've failed to close the brackets please, so that I
can then achieve normality please?

Thanks
Sharon.
- -- 
A taste of linux = http://www.sharons.org.uk
TGmeds = http://www.tgmeds.org.uk
DrugFacts = https://www.drugfacts.org.uk
Debian 11, fluxbox 1.3.7, emacs 29.0.50, org 9.5.2
-BEGIN PGP SIGNATURE-

iQJRBAEBCgA7FiEELSc/6QwVBIYugJDbNoGAGQr4g1sFAmHuzPAdHGJvdWRpY2Nh
c0Bza2ltYmxlMDkucGx1cy5jb20ACgkQNoGAGQr4g1vLKA//Y298U9Rb+t+VYvhy
PepzASzFj+HDFbUUhnCouODx0fQbIxEZvi0EzRM6HgxUTTkgxOqy8puGI+XUJPdm
ncbWyVqqA7M5xjl/w9HMX08dwd/0pIRIUmODP2IDBO2HdwyOA8QNW2Nab6/+UlMU
leJh0263TCfpv54Dsjg1RDhNulHubKr5TNadHJDqy50dT87wSRJC2RdKFJ71ljQZ
4zlUzEwulvgRB+6KbxGdoEQJW61c3qM7NKz2OQSa8p3EKT/t0LZGF7ToJevZzarJ
cunE7dbnuDPGsmNVberc572xBrqgFH7iVW3zcYwTLc2JRDL4/2BFdH1UoGaAsjyk
9fpgYuqLP5dgJMwBmRCYtCsvKN4VFuyk8k4zYqJx19bJIxobKuYniZtVr5joFUfV
+jgr0ss+ZqLoQPanrrCOPycn0aVxteDVUdN+V37b1iVdDPQuanF/fkL7x59LV3pp
C1r5N9bX3X+5bBGaO4XF5p5UnUyg19luULdIONpC94MbsxWNmUF1XWZJvR2Oh/tj
YI5Ctw7POFITHo92TEny6kdpjtLag2+5INQajl6oQ19Lm+fmhu7/Vm4PSSm/Rybh
KatZgvdgBHd0veollwOqwGSvopNMYPPJ6s5uT5Sop8+gM6bc1guddqdApezVB0WD
i/fweF+vFfk7Ot14Kw8S3efgYm8=
=XMFk
-END PGP SIGNATURE-



Re: Extend the existing alternative set of key bindings for terminals (was: Second Ctl in keychord not detected)

2022-01-24 Thread Ihor Radchenko
Tim Cross  writes:

> Ihor Radchenko  writes:
>
>> Also, it appears to me that we may keep losing terminal-incompatible
>> keys in future unless we provide some mechanisms to check terminal
>> compatibility automatically. Any ideas?
>>
>
> No ideas on this. Problem being I don't think there is anything like a
> terminfo service which will tell you about what capabilities/bindings a
> terminal emulator has.
>
> Just some thoughts on this -
>
> I fear any such attempt is likely to end up in a game of 'wack-a-mole'.
> While it makes some sense to provide alternative key bindings for Emacs
> running under the GNU Linux console, especially given the limitations
> under the console are well defined and constant, I'm not sure
> we can provide reliable solutions or tests for different terminal
> emulators (which will often 'reserve' various key bindings for their own
> use. This is especially true for more advanced terminal emulators like
> tmux.

We cannot even handle GNU Linux console now. Technically, man 5 terminfo
describes all the details on how to obtain terminal specs, but I am not
sure how to extract useful information for key binding purposes. Can we
do it programatically?

> An alternative which might be worth considering would be to improve
> documentation on using different popular terminal emulators, like tmux
> which could cover both adapting org key bindings and adapting the key
> bindings the emulator uses (a very quick google on this indicates you
> can change the tmux bindings, but that detail is apparently not well
> documented). Such documentation could include some guidelines on how to
> identify the issue, identify at what layer (window manager, terminal
> emulator, communication protocol etc) the problematic binding is being
> intercepted etc. The interactions at this layer can be complex and
> confusing, especially for users who don't have a clear model of how all
> the layers interact.  

I am not aiming there for now. Just basic terminals. tmux, WMs,
system-wide key bindings, etc are all higher level and can be configured
by the user. We _might_ want to support the most popular shadowed
bindings, but the problem with terminals is a lot more pressing. Users
cannot really change what is supported.

> A more long term strategy which I wonder if we should consider is
> whether org would benefit from adopting the use of something like the
> hydra package. Org needs a lot of key bindings - many more than most
> other modes. Available bindings are in short supply. Perhaps leveraging
> off something like hydras would both offer more flexibility and make it
> easier to manage. Likewise, could transient mode help in this area?

It may be a good idea. However, not all the users like hydra style.

Note that we already have org-speed-commands. They provide somewhat
similar functionality. We may extend them, allow using via transient
keymap, or integrate org-speed-command-help with hydra/transient.el.
Patches are welcome!

Best,
Ihor




Re: Read only org view mode

2022-01-24 Thread Russell Adams
On Mon, Jan 24, 2022 at 11:40:05AM +, Neil Jerram wrote:
> On Mon, 24 Jan 2022, 11:14 Russell Adams,  wrote:
>
> > Why not just do an ASCII export to a temporary read only buffer for
> > viewing?
>
> Do you mean that you're agreeing with the concept, but finding the
> implementation unnecessarily complicated?

I'm not being negative about the concept. I'm asking if the poster had
considered using the built-in tools before creating another new
library.

I did a short look at the site and the assertion "view org with less
markup", and that was my first impression.

I had two thoughts. The first was if the markup is a problem and you
want a read only view, why not use the built in ascii export to a
buffer and view that buffer? I just hit C-c C-e t A and M-x
read-only-mode and was able to navigate my ascii org file as a read
only buffer.

Second thought was that Org's syntax was supposed to minimize the
markup so it didn't negatively impact reading. Maybe the poster is
identifying a pain point we should be aware of as a community, ie:
that too much markup makes it hard to read.

My impression is only property drawers and source blocks are
potentially visually loud compared to the other markup. Timestamps are
pretty minimal and links already only show a descriptive text instead
of the full [[]] syntax.


--
Russell Adamsrlad...@adamsinfoserv.com

PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/

Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3



RE: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**

2022-01-24 Thread Vincent Belaïche

Hello,

Thank-you both for the reply, I should have mentioned that I am aware of
this trick but it works only for document encodings which have the
zero-width space, like UTF-8, I was after a fix for documents in
ISO-8859-15, aka latin-9.

  V.

De : Juan Manuel Macías 
Envoyé : lundi 24 janvier 2022 13:09
À : Vincent Belaïche 
Cc : orgmode 
Objet : Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a 
word** 
 
Hi Vincent,

Vincent Belaïche writes:

> Hello,
>
> Sorry to dig out this almost 8 year old discussion, but after looking
> into the git HEAD Org Mode manual (v9.5 or so) (info "(org) Emphasis and
> Monospace") node, and after looking into the mail archive I could not
> find any answer to this question: how to switch style within a word.
>
> I would like to put something like this in an OrgMode document:
>
>  ~--some-cli-option=~/some cli argument/
>
> where the intent is that « --some-cli-option= » would be monospaced, and
> « some cli argument » would be italicized, and as you know this does not
> work this way.
>
>   Vincent.

It seems that this topic is already a classic :-) The supported solution
for intra-word emphases is to introduce a zero width space (U+200B), for
example:

~--some-cli-option=~[zero-width space]/some cli argument/

I don't really like this solution, but at least it works. If you export
to LaTeX, you may want to remove the space using a filter, as in some
(few) cases it can alter the LaTeX result.

The other realistic possibility is to use macros:

{{{mono(--some-cli-option=)}}}{{{emph(some cli argument)}}}

That is, more or less, the state of art. By the nature of its syntax,
emphasis between words is not possible in Org.

Best regards,

Juan Manuel 


Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**

2022-01-24 Thread Juan Manuel Macías
Hi Vincent,

Vincent Belaïche writes:

> Hello,
>
> Sorry to dig out this almost 8 year old discussion, but after looking
> into the git HEAD Org Mode manual (v9.5 or so) (info "(org) Emphasis and
> Monospace") node, and after looking into the mail archive I could not
> find any answer to this question: how to switch style within a word.
>
> I would like to put something like this in an OrgMode document:
>
>  ~--some-cli-option=~/some cli argument/
>
> where the intent is that « --some-cli-option= » would be monospaced, and
> « some cli argument » would be italicized, and as you know this does not
> work this way.
>
>   Vincent.

It seems that this topic is already a classic :-) The supported solution
for intra-word emphases is to introduce a zero width space (U+200B), for
example:

~--some-cli-option=~[zero-width space]/some cli argument/

I don't really like this solution, but at least it works. If you export
to LaTeX, you may want to remove the space using a filter, as in some
(few) cases it can alter the LaTeX result.

The other realistic possibility is to use macros:

{{{mono(--some-cli-option=)}}}{{{emph(some cli argument)}}}

That is, more or less, the state of art. By the nature of its syntax,
emphasis between words is not possible in Org.

Best regards,

Juan Manuel 



Re: [RFC] Creole-style / Support for **emphasis**__within__**a word**

2022-01-24 Thread Nicolas Goaziou
Hello,

Vincent Belaïche  writes:

> I would like to put something like this in an OrgMode document:
>
>   ~--some-cli-option=~/some cli argument/
>
> where the intent is that « --some-cli-option= » would be monospaced, and
> « some cli argument » would be italicized, and as you know this does not
> work this way.

You can put a zero-width space between ~ and /.

Regards,
-- 
Nicolas Goaziou



Re: Read only org view mode

2022-01-24 Thread Neil Jerram
On Mon, 24 Jan 2022, 11:14 Russell Adams,  wrote:

> Why not just do an ASCII export to a temporary read only buffer for
> viewing?
>

Do you mean that you're agreeing with the concept, but finding the
implementation unnecessarily complicated?


> I always thought the point of Org was to have minimal markup so that
> the native file was plainly legible.
>
> On Sun, Jan 23, 2022 at 08:19:12AM +0100, Arthur Miller wrote:
> > Hi mailing list,
> >
> > is something like this of interest to add to org-mode?
> >
> > Attached is a prototype to a read-only view mode. It tries to hide as
> much of
> > markup as possible to make it more "readable". It uses built-in
> view-mode to
> > make the buffer read only and enable some common commands. I plan to add
> more
> > "dired like" movement though.
> >
> > I don't claim it is very well written or efficient; I appreciate input
> on that
> > regard. To note is that I use minor-modes as "toggles", to make the
> > functionality avialable as "solo pieces" as well as a code generation
> tool.
> >
> > I am just checking interest here. More info and a screencast are
> avialable at:
> >
> > https://github.com/amno1/org-view-mode
> >
>
> > ;;; org-view-mode.el --- Read-only viewer with less markup clutter in
> org mode files  -*- lexical-binding: t; -*-
> >
> > ;; Copyright (C) 2021  Arthur Miller
> >
> > ;; Author: Arthur Miller 
> > ;; Keywords: convenience, outlines, tools
> >
> > ;; This program is free software; you can redistribute it and/or modify
> > ;; it under the terms of the GNU General Public License as published by
> > ;; the Free Software Foundation, either version 3 of the License, or
> > ;; (at your option) any later version.
> >
> > ;; This program is distributed in the hope that it will be useful,
> > ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
> > ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > ;; GNU General Public License for more details.
> >
> > ;; You should have received a copy of the GNU General Public License
> > ;; along with this program.  If not, see  >.
> >
> > ;; Author: Arthur Miller
> > ;; Version: 0.0.1
> > ;; Keywords: tools convenience
> > ;; Package-Requires: ((emacs "24.1"))
> > ;; URL: https://github.com/amno1/org-view-mode
> >
> > ;;; Commentary:
> >
> > ;; A minor mode to help reduce clutter in org-mode files by
> > ;; hiding/unhiding org-mode markup language
> > ;;
> > ;; To turn it on execute:
> > ;;
> > ;;  `M-x org-view-mode'.
> > ;;
> > ;; To turn it off execute the same command.
> >
> > ;;; Issues
> >
> > ;;; Code:
> > (require 'org)
> >
> > (defgroup org-view nil
> >   "Hide tags in org-headings."
> >   :prefix "org-view-"
> >   :group 'org)
> >
> > (defvar-local org-view-center-credentials nil
> >   "Whether to align title and author in center or not.
> >
> > Centering is done pixel wise relative to window width.")
> >
> > (defcustom org-view-diminish-mode t
> >   "Hide lighters for individual minor modes when org-view-mode is on."
> >   :type 'boolean
> >   :group 'org-view)
> >
> > (defvar org-view-stars-re "^[ \t]*\\*+"
> >   "Regex used to recognize leading stars in org-headings.")
> >
> > (defvar org-view-credentials-re "[ \t]*#\\+\\(TITLE\\|AUTHOR\\):"
> >   "Regex used to update author and title lines.")
> >
> > (defun org-view--update-tags (visibility)
> >   "Update invisible property to VISIBILITY for tags in the current
> buffer."
> >   (save-excursion
> > (goto-char (point-min))
> > (with-silent-modifications
> >   (while (re-search-forward org-view-stars-re nil t)
> > (goto-char (line-end-position))
> > (when (re-search-backward org-tag-line-re
> (line-beginning-position) t)
> > (put-text-property
> >  (match-beginning 1) (match-end 1) 'invisible visibility))
> >   (forward-line)
> >
> > (defun org-view--update-keywords (visibility)
> >   "Set VISIBILITY for each line starting with a keyword from KEYWORDS
> list."
> >   (org-with-wide-buffer
> >(save-excursion
> >  (with-silent-modifications
> >(goto-char (point-min))
> >(while (re-search-forward "^[ \t]*#\\+.*$" nil t)
> >  (goto-char (match-beginning 0))
> >  (unless (looking-at-p org-view-credentials-re)
> >(put-text-property
> > (1- (match-beginning 0)) (match-end 0) 'invisible
> visibility))
> >  (goto-char (match-end 0)))
> >
> > (defun org-view--update-properties (visibility)
> >   "Set invisible property to VISIBILITY for properties in the current
> buffer."
> >   (org-with-wide-buffer
> >(save-excursion
> >  (with-silent-modifications
> >(goto-char (point-min))
> >(while (re-search-forward org-property-drawer-re nil t)
> >  (put-text-property
> >   (match-beginning 0) (match-end 0) 'invisible visibility))
> >(goto-char (point-min))
> >(while (re-search-forward "^[ 

Re: Read only org view mode

2022-01-24 Thread Russell Adams
Why not just do an ASCII export to a temporary read only buffer for
viewing?

I always thought the point of Org was to have minimal markup so that
the native file was plainly legible.

On Sun, Jan 23, 2022 at 08:19:12AM +0100, Arthur Miller wrote:
> Hi mailing list,
>
> is something like this of interest to add to org-mode?
>
> Attached is a prototype to a read-only view mode. It tries to hide as much of
> markup as possible to make it more "readable". It uses built-in view-mode to
> make the buffer read only and enable some common commands. I plan to add more
> "dired like" movement though.
>
> I don't claim it is very well written or efficient; I appreciate input on that
> regard. To note is that I use minor-modes as "toggles", to make the
> functionality avialable as "solo pieces" as well as a code generation tool.
>
> I am just checking interest here. More info and a screencast are avialable at:
>
> https://github.com/amno1/org-view-mode
>

> ;;; org-view-mode.el --- Read-only viewer with less markup clutter in org 
> mode files  -*- lexical-binding: t; -*-
>
> ;; Copyright (C) 2021  Arthur Miller
>
> ;; Author: Arthur Miller 
> ;; Keywords: convenience, outlines, tools
>
> ;; This program is free software; you can redistribute it and/or modify
> ;; it under the terms of the GNU General Public License as published by
> ;; the Free Software Foundation, either version 3 of the License, or
> ;; (at your option) any later version.
>
> ;; This program is distributed in the hope that it will be useful,
> ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
> ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> ;; GNU General Public License for more details.
>
> ;; You should have received a copy of the GNU General Public License
> ;; along with this program.  If not, see .
>
> ;; Author: Arthur Miller
> ;; Version: 0.0.1
> ;; Keywords: tools convenience
> ;; Package-Requires: ((emacs "24.1"))
> ;; URL: https://github.com/amno1/org-view-mode
>
> ;;; Commentary:
>
> ;; A minor mode to help reduce clutter in org-mode files by
> ;; hiding/unhiding org-mode markup language
> ;;
> ;; To turn it on execute:
> ;;
> ;;  `M-x org-view-mode'.
> ;;
> ;; To turn it off execute the same command.
>
> ;;; Issues
>
> ;;; Code:
> (require 'org)
>
> (defgroup org-view nil
>   "Hide tags in org-headings."
>   :prefix "org-view-"
>   :group 'org)
>
> (defvar-local org-view-center-credentials nil
>   "Whether to align title and author in center or not.
>
> Centering is done pixel wise relative to window width.")
>
> (defcustom org-view-diminish-mode t
>   "Hide lighters for individual minor modes when org-view-mode is on."
>   :type 'boolean
>   :group 'org-view)
>
> (defvar org-view-stars-re "^[ \t]*\\*+"
>   "Regex used to recognize leading stars in org-headings.")
>
> (defvar org-view-credentials-re "[ \t]*#\\+\\(TITLE\\|AUTHOR\\):"
>   "Regex used to update author and title lines.")
>
> (defun org-view--update-tags (visibility)
>   "Update invisible property to VISIBILITY for tags in the current buffer."
>   (save-excursion
> (goto-char (point-min))
> (with-silent-modifications
>   (while (re-search-forward org-view-stars-re nil t)
> (goto-char (line-end-position))
> (when (re-search-backward org-tag-line-re (line-beginning-position) t)
> (put-text-property
>  (match-beginning 1) (match-end 1) 'invisible visibility))
>   (forward-line)
>
> (defun org-view--update-keywords (visibility)
>   "Set VISIBILITY for each line starting with a keyword from KEYWORDS list."
>   (org-with-wide-buffer
>(save-excursion
>  (with-silent-modifications
>(goto-char (point-min))
>(while (re-search-forward "^[ \t]*#\\+.*$" nil t)
>  (goto-char (match-beginning 0))
>  (unless (looking-at-p org-view-credentials-re)
>(put-text-property
> (1- (match-beginning 0)) (match-end 0) 'invisible visibility))
>  (goto-char (match-end 0)))
>
> (defun org-view--update-properties (visibility)
>   "Set invisible property to VISIBILITY for properties in the current buffer."
>   (org-with-wide-buffer
>(save-excursion
>  (with-silent-modifications
>(goto-char (point-min))
>(while (re-search-forward org-property-drawer-re nil t)
>  (put-text-property
>   (match-beginning 0) (match-end 0) 'invisible visibility))
>(goto-char (point-min))
>(while (re-search-forward "^[ \t]*#\\+PROPERTY:.*$" nil t)
>  (put-text-property
>   (1- (match-beginning 0)) (1+ (match-end 0)) 'invisible 
> visibility))
>
> (defun org-view--update-stars (visibility)
>   "Update invisible property to VISIBILITY for markers in the current buffer."
>   (org-with-wide-buffer
>(save-excursion
>  (goto-char (point-min))
>  (with-silent-modifications
>(while (re-search-forward org-view-stars-re nil t)
>  

RE: [O] [RFC] Creole-style / Support for **emphasis**__within__**a word**

2022-01-24 Thread Vincent Belaïche

Hello,

Sorry to dig out this almost 8 year old discussion, but after looking
into the git HEAD Org Mode manual (v9.5 or so) (info "(org) Emphasis and
Monospace") node, and after looking into the mail archive I could not
find any answer to this question: how to switch style within a word.

I would like to put something like this in an OrgMode document:

  ~--some-cli-option=~/some cli argument/

where the intent is that « --some-cli-option= » would be monospaced, and
« some cli argument » would be italicized, and as you know this does not
work this way.

  Vincent.

De : emacs-orgmode-bounces+vincent.b.1=hotmail...@gnu.org 
 de la part de 
Jambunathan K 
Envoyé : dimanche 23 mars 2014 03:59
À : Nicolas Goaziou 
Cc : emacs-orgmode@gnu.org 
Objet : Re: [O] [RFC] Creole-style / Support for **emphasis**__within__**a 
word** 
 
Nicolas Goaziou  writes:

> Good luck.

Got my answer.  The rest are just details.



Re: Read only org view mode

2022-01-24 Thread Neil Jerram
Hi Arthur,

On Sun, 23 Jan 2022 at 07:53, Arthur Miller  wrote:
>
> Hi mailing list,
>
> is something like this of interest to add to org-mode?

I'm interested in Linux-native smartphones (e.g. the Pine Phone) and
in using Org there as fully as possible.  I probably wouldn't _alter_
my Org content on the phone as extensively as I do on a laptop, but
I'd certainly like to _see_ all my Org content and have something like
an agenda.  Then the question arises of how best to display that
content and support occasional editing of it.  Apps like Orgzly have
been developed to meet this need, but (a) Orgzly is Android-specific,
and (b) I would really love if a good answer could be: simply run
Emacs on the phone and view your Org content that way.  A read-only
Org view mode feels like it could be a very useful ingredient for
that!

Best wishes,
   Neil



Bug: DPI error when HTML publish latex block images [9.4.4 (release_9.4.4 @ /Applications/emacs/lisp/org/)]

2022-01-24 Thread Daniel Guimaraes

 I am trying to export a latex tikzpicture, like the following to html:
```
#+begin_src latex :exports results :results raw file :file ex.png 
:output-dir ../img/

\begin{tikzpicture}
\draw node[circle, draw] (a) {$a$}
node[circle, draw, right of = a] (b) {$b$}
node[circle, draw, below of = a] (c) {$c$}
node[circle, draw, below of = b] (d) {$d$};
\end{tikzpicture}
#+end_src
```
If I export with `org-export-dispatch` to HTML file, I flawlessly obtain 
the desired html. If I however, `org-html-publish-to-html` with:


```
emacs -Q --script build-site.el
```
Then I obtain the following error:
```
Debugger entered--Lisp error: (error "Attempt to calculate the dpi of a 
non-graphic disp...")

signal(error ("Attempt to calculate the dpi of a non-graphic disp..."))
error("Attempt to calculate the dpi of a non-graphic disp...")
org--get-display-dpi()
org-create-formula-image("\\begin{tikzpicture}\n \\draw node[circle, 
draw] (a)..." "../img/ex.png" (:foreground default :background default 
:scale 1.0 :html-foreground "Black" :html-background "Transparent" 
:html-scale 1.0 :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")) t)

```
My `build-site.el` configuration is the following:
https://github.com/dcguim/dgpage/blob/main/build-site.el

This could potentially be a bug in `org--get-display-dpi`.

Emacs : GNU Emacs 28.0.50 (build 1, aarch64-apple-darwin20.3.0, NS 
appkit-2022.30 Version 11.2.2 (Build 20D80))

of 2021-04-16
Package: Org mode version 9.4.4 (release_9.4.4 @ 
/Applications/emacs/lisp/org/)