Re: Manual suggestion and experience report from a new user (citation processors, 9.5)

2021-10-15 Thread Nicolas Goaziou
Hello,

Leszek Wroński  writes:

> Guys,

and gals!

> The introduction to chapter 15 says 'The included “basic” processor
> provides all four capabilities.' (w.r.t. 'activate', 'follow',
> 'insert', 'export'). I thus assumed that the basic processor was
> included. However, org-cite-insert ended with 'Unknown processor
> basic'.

This is rather unexpected. Your assumption is correct, oc-basic should
be available right from the start. I fixed it in bugfix branch.

Thank you.

Regards,
-- 
Nicolas Goaziou



Re: [BUG] Inline images cannot be displayed [9.5 (release_9.5-108-g93132c @ /tmp/org-mode/lisp/)]

2021-10-15 Thread Bhavin Gandhi
Hello Liu,

On Fri, 15 Oct 2021 at 19:49, Liu Hui  wrote:
>
> Org mode cannot display inline images because of an error caused by
> org-display-inline-image--width. It seems display-line-numbers-width
> is regarded as a number unconditionally.
>
> Recipe:
>
> 1. emacs -Q
>
> 2. Make the following settings:
>
>(setq org-image-actual-width nil)
>(setq org-startup-with-inline-images t)
>
> 3. Open some org-mode file containing image links, e.g.
>
>#+attr_org: :width 50%
>[[file:~/test.jpg]]

Confirmed

I was able to reproduce this with the latest main branch. It works fine with
attributes like this:

#+attr_org: :width 500px

And the 9.5 tag does not have this bug, so I think this might be related to
recent changes to image width. Adding Timothy to CC who worked on those
changes.

-- 
Regards,
Bhavin Gandhi (bhavin192) | https://geeksocket.in



[minor tip] "TeXify" strings "TeX" and "LaTeX" when exporting to HTML

2021-10-15 Thread Juan Manuel Macías
Hi all,

I wrote this simple filter for my blogs, which formats "TeX" and "LaTeX"
strings in the TeX 'typographic' style (or something similar).

First, these variables:

#+begin_src emacs-lisp
  (setq my/tex-html-string "TEX")
  
  (setq my/latex-html-string "LATEX")
#+end_src

Of course, the strings can be improved. Another alternative would be to use the 
wikipedia images:

https://wikimedia.org/api/rest_v1/media/math/render/svg/45c5b62b0f454f4ed8caa486d6d3cd0e0c065232\;
style=\"vertical-align: -1.005ex; width:5.094ex; height:2.843ex;\"
alt=\"TeX\"/>

https://wikimedia.org/api/rest_v1/media/math/render/svg/fa952935eafe23237c5a52922460c192fde88435\;
style=\"vertical-align: -1.005ex; width:7.107ex; height:2.843ex;\"
alt=\"LaTeX\"/>

The function:

#+begin_src emacs-lisp
  (defun my/latex-string-html-filter (text backend info)
(interactive)
(when (org-export-derived-backend-p backend 'html)
  (let ((case-fold-search nil))
(with-temp-buffer
  (insert text)
  (save-excursion
(goto-char (point-min))
(while (re-search-forward "\\([^La]\\)TeX" nil t)
  (replace-match (concat "\\1" my/tex-html-string
  (save-excursion
(goto-char (point-min))
(while (re-search-forward "LaTeX" nil t)
  (replace-match my/latex-html-string)))
  (setq text (buffer-string))
#+end_src

And, finally:

#+begin_src emacs-lisp
  (add-to-list 'org-export-filter-plain-text-functions 
#'my/latex-string-html-filter)
#+end_src

Fun fact. Donald Knuth explains in the first chapter of his /TeX book/,
"The Name of the Game", the origin of the term TeX, and why it is
formatted that way:

#+begin_quote
English words like `technology' stem from a Greek root beginning with
the letters τεχ...; and this same Greek word means /art/ as well as
technology.

[...]

Insiders pronounce the χ of TeX as a Greek chi, not as an `x', so that
TeX rhymes with the word blecchhh. It's the `ch' sound in Scottish words
like /loch/ or German words like /ach/; it's a Spanish `j' and a Russian
`kh'. 

[...]

On the other hand, it's important to notice another thing about TeX's
name: The `E' is out of kilter. This logo displaced `E' is a reminder
that TeX is about typesetting, and it distinguishes TeX from other
system names. [...] The correct way to refer to TeX in a computer file,
or when using some other medium that doesn't allow lowering of the `E',
is to type `TeX'. Then there will be no confusion with similar names,
and people will be primed to pronounce everything properly.
#+end_quote

Best regards,

Juan Manuel 



Re: [PATCH] [BUG] Org 9.5: org-goto UI seems broken

2021-10-15 Thread Max Nikulin

On 14/10/2021 22:44, Max Nikulin wrote:


I think, something should be done with `org-no-popups'. Assume a user 
who has (I have no idea concerning the goal though)


   (setq pop-up-frames t)
   (setq display-buffer-base-action
     '((display-buffer-reuse-window display-buffer-pop-up-frame)
   (reusable-frames . 0)))

With "emacs -Q" and above settings completion e.g. for "C-h f" does not 
cause creation of a new frame. Org help windows appear in new frames 
though. That is why `org-no-popups' should have more code.


I was wrong, (setq pop-up-frames t) leads to creation of new frame for 
*Completion* buffer at least in Emacs-26.3.


It seems, each case of `org-no-popups' may require specific code. I have 
tried to take some code related to completion. It overrides 
display-buffer-base-action, but something more is required for 
pop-up-frames.
That code uses `with-current-buffer-window' while org-goto uses 
`with-output-to-temp-buffer'. I am unsure what variant is more suitable 
for org-goto.


I am attaching my draft with minimal changes. I do not like to rely on 
internal functions but I have not found high level replacement to 
achieve the same result. Maybe emacs code has a better variant somewhere.
diff --git a/lisp/org-goto.el b/lisp/org-goto.el
index 0a3470f54..26fc2b735 100644
--- a/lisp/org-goto.el
+++ b/lisp/org-goto.el
@@ -203,7 +203,6 @@ When nil, you can use these keybindings to navigate the buffer:
   "Let the user select a location in current buffer.
 This function uses a recursive edit.  It returns the selected
 position or nil."
-  (org-no-popups
(let ((isearch-mode-map org-goto-local-auto-isearch-map)
 	 (isearch-hide-immediately nil)
 	 (isearch-search-fun-function
@@ -217,7 +216,35 @@ position or nil."
 	  (condition-case nil
 	  (make-indirect-buffer (current-buffer) "*org-goto*" t)
 	(error (make-indirect-buffer (current-buffer) "*org-goto*" t
-	 (let (temp-buffer-show-function temp-buffer-show-hook)
+	 (let (temp-buffer-show-hook
+	   (temp-buffer-show-function
+		(lambda (buffer)
+		  "Prevent new frame in the case of
+
+  (setq display-buffer-base-action
+'((display-buffer-reuse-window display-buffer-pop-up-frame)
+  (reusable-frames . 0)))
+
+It is not immune to
+
+  (setq pop-up-frames t)
+
+just as \"*Completion*\" buffer.
+The idea is borrowed from `minibuffer-completion-help'."
+		  (display-buffer
+   buffer
+   `((display-buffer--maybe-same-window
+  display-buffer-reuse-window
+  ,(if (functionp 'display-buffer--maybe-pop-up-frame)
+   ;; Unavailable in emacs-26
+   'display-buffer--maybe-pop-up-frame
+ 'display-buffer--maybe-pop-up-frame-or-window)
+  display-buffer-below-selected)
+ ,(if temp-buffer-resize-mode
+  '(window-height . resize-temp-buffer-window)
+'(window-height . fit-window-to-buffer))
+ ,(when temp-buffer-resize-mode
+'(preserve-size . (nil . t
 	   (with-output-to-temp-buffer "*Org Help*"
 	 (princ (format help (if org-goto-auto-isearch
  "  Just type for auto-isearch."
@@ -236,7 +263,7 @@ position or nil."
 	 (use-local-map org-goto-map)
 	 (recursive-edit)))
  (kill-buffer "*org-goto*")
- (cons org-goto-selected-point org-goto-exit-command
+ (cons org-goto-selected-point org-goto-exit-command)))
 
 ;;;###autoload
 (defun org-goto ( alternative-interface)


Re: resume an interrupted enumerated list or reset the counter

2021-10-15 Thread Nicolas Goaziou
Hello,

Uwe Brauer  writes:

> Right in a org buffer! But not say in a message buffer, using
> orgalist-mode.

Orgalist minor mode is not Org mode. In particular, the former has no
knowledge about source blocks.

You can either indent the contents of the source block appropriately, or
use an ugly number cookie:

 1. Item 1
 3. [@3] Item 3

Regards,
-- 
Nicolas Goaziou



Re: resume an interrupted enumerated list or reset the counter

2021-10-15 Thread Uwe Brauer
>>> "ESF" == Eric S Fraga  writes:

> On Thursday, 14 Oct 2021 at 22:51, Uwe Brauer wrote:
>> Thanks, but what if the list itself is indented, like:

> Works fine for me.

Right in a org buffer! But not say in a message buffer, using orgalist-mode.


smime.p7s
Description: S/MIME cryptographic signature


[BUG] Inline images cannot be displayed [9.5 (release_9.5-108-g93132c @ /tmp/org-mode/lisp/)]

2021-10-15 Thread Liu Hui
Hi,

Org mode cannot display inline images because of an error caused by
org-display-inline-image--width. It seems display-line-numbers-width
is regarded as a number unconditionally.

Recipe:

1. emacs -Q

2. Make the following settings:

   (setq org-image-actual-width nil)
   (setq org-startup-with-inline-images t)

3. Open some org-mode file containing image links, e.g.

   #+attr_org: :width 50%
   [[file:~/test.jpg]]


Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
  -(80 nil)
  (or (and (and (boundp 'visual-fill-column-mode) visual-fill-column-mode) (or 
visual-fill-column-width auto-fill-function)) (if auto-fill-function (progn 
fill-column)) (- (window-text-width) display-line-numbers-width))
  (/ (or (and (and (boundp 'visual-fill-column-mode) visual-fill-column-mode) 
(or visual-fill-column-width auto-fill-function)) (if auto-fill-function (progn 
fill-column)) (- (window-text-width) display-line-numbers-width)) (float 
(window-total-width)))
  (* width (window-pixel-width) (/ (or (and (and (boundp 
'visual-fill-column-mode) visual-fill-column-mode) (or visual-fill-column-width 
auto-fill-function)) (if auto-fill-function (progn fill-column)) (- 
(window-text-width) display-line-numbers-width)) (float (window-total-width
  (round (* width (window-pixel-width) (/ (or (and (and (boundp 
'visual-fill-column-mode) visual-fill-column-mode) (or visual-fill-column-width 
auto-fill-function)) (if auto-fill-function (progn fill-column)) (- 
(window-text-width) display-line-numbers-width)) (float (window-total-width)
  (if (and (floatp width) (<= 0.0 width 2.0)) (round (* width 
(window-pixel-width) (/ (or (and (and (boundp ...) visual-fill-column-mode) (or 
visual-fill-column-width auto-fill-function)) (if auto-fill-function (progn 
fill-column)) (- (window-text-width) display-line-numbers-width)) (float 
(window-total-width) width)
  (let* ((case-fold-search t) (par (org-element-lineage link '(paragraph))) 
(attr-re "^[ \11]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)") (par-end 
(org-element-property :post-affiliated par)) (attr-width (if (and par (let 
((--mpom ...)) (save-excursion (if ... ...) (save-excursion ... (progn 
(match-string 1 (attr-width-val (cond ((null attr-width) nil) 
((string-match-p "\\`[0-9.]+%" attr-width) (/ (string-to-number attr-width) 
100.0)) (t (string-to-number attr-width (width (or attr-width-val (car 
org-image-actual-width (if (and (floatp width) (<= 0.0 width 2.0)) (round 
(* width (window-pixel-width) (/ (or (and (and ... visual-fill-column-mode) (or 
visual-fill-column-width auto-fill-function)) (if auto-fill-function (progn 
fill-column)) (- (window-text-width) display-line-numbers-width)) (float 
(window-total-width) width))
  (cond ((eq org-image-actual-width t) nil) ((listp org-image-actual-width) 
(let* ((case-fold-search t) (par (org-element-lineage link '(paragraph))) 
(attr-re "^[ \11]*#\\+attr_.*?: +.*?:width +\\(\\S-+\\)") (par-end 
(org-element-property :post-affiliated par)) (attr-width (if (and par (let ... 
...)) (progn (match-string 1 (attr-width-val (cond ((null attr-width) nil) 
((string-match-p "\\`[0-9.]+%" attr-width) (/ ... 100.0)) (t (string-to-number 
attr-width (width (or attr-width-val (car org-image-actual-width (if 
(and (floatp width) (<= 0.0 width 2.0)) (round (* width (window-pixel-width) (/ 
(or ... ... ...) (float ... width))) ((numberp org-image-actual-width) 
org-image-actual-width) (t nil))
  org-display-inline-image--width((link (:type "file" :path "~/test.jpg" 
:format bracket :raw-link "file:~/test.jpg" :application nil :search-option nil 
:begin 25 :end 51 :contents-begin nil :contents-end nil :post-blank 0 :parent 
(paragraph (:begin 2 :end 52 :contents-begin 25 :contents-end 52 :post-blank 0 
:post-affiliated 25 :attr_org (":width 50%") :parent nil)


Emacs  : GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, 
cairo version 1.16.0)
 of 2021-09-22
Package: Org mode version 9.5 (release_9.5-108-g93132c @ /tmp/org-mode/lisp/)



Re: [PATCH] Rename headline to heading

2021-10-15 Thread André A . Gomes
Timothy  writes:

> I haven’t gone through the patches you’ve sent, but it looks like you’ve put a
> tremendous amount of effort into this! It’s fantastic to see. I think I can
> speak for the Org community when I say thank you.

I appreciate the kind words.  It's my pleasure to collaborate with the
community.  Let me stress the fact that it's my first contribution and
I'm not comfortable with the codebase, so I feedback is welcome :)

It actually took me less time than it may look like, since I used many
"tricks" like keyboard macros, registers, etc.  I even wrote some utils,
and it got me thinking about some Elisp tangential aspects.  For
instance, I realised it's hard to query-replace sexps' docstrings.
And no, I don't want to use multi-line regex (PCRE).  It's the wrong
tool IMO.  My "solution" is also poor, but for other reasons.  

--8<---cut here---start->8---
;; this is brittle.  for example, when there's a string as a value
;; before the actual docstring!
(defun query-replace-docstring-sexp (sexp-symbol from-string to-string)
  (save-excursion
(do ((point (scan-lists (point-max) -1 0)
(scan-lists (point) -1 0)))
((null point))
  (goto-char point)
  (save-excursion
(let ((point-max-sexp (scan-sexps point 1)))
  (when (and (search-forward (concat "(" (symbol-name sexp-symbol))
 point-max-sexp t)
 (search-forward "\"" point-max-sexp t))
(query-replace from-string
   to-string
   t
   (prog2 (backward-char) (point))
   ;; the sexp here is the string enclosed by \"
   (scan-sexps (point) 1
--8<---cut here---end--->8---


This is off-topic anyway.  My point is that there are ALWAYS interesting
things to do in any seemingly "boring" task.


--
André A. Gomes
"Free Thought, Free World"



Re: [PATCH] Rename headline to heading

2021-10-15 Thread Timothy
Hi André,

I haven’t gone through the patches you’ve sent, but it looks like you’ve put a
tremendous amount of effort into this! It’s fantastic to see. I think I can
speak for the Org community when I say thank you.

André A. Gomes  writes:

> Hi Bastien and All,
>
> This is a first attempt towards the goal.

All the best,
Timothy


Re: resume an interrupted enumerated list or reset the counter

2021-10-15 Thread Eric S Fraga
On Thursday, 14 Oct 2021 at 22:51, Uwe Brauer wrote:
> Thanks, but what if the list itself is indented, like:

Works fine for me.

-- 
: Eric S Fraga via Emacs 28.0.60, Org release_9.5-107-g879942
: Latest paper written in org: https://arxiv.org/abs/2106.05096