Re: org-x11idle-exists-p with emacs --daemon

2022-10-27 Thread Ihor Radchenko
Max Nikulin  writes:

>>> emacsclient --eval '(server-select-display (getenv "DISPLAY"))'
>> 
>> You are talking about a different problem.
>> Please start a new thread.
>
> Nope
>
> emacs -Q -L ~/src/org-mode/lisp/ --daemon
> emacsclient --eval window-system
> nil
>
> emacsclient --eval '(server-select-display (getenv "DISPLAY"))'
> emacsclient --eval window-system
> x
>
> I suspect that the check of `window-system' was added to detect Emacs 
> instances running as pure terminal applications having no access to X11 
> and the case of daemon was simply overlooked.

The reported problem is related to the fact that org-x11idle-exists-p
value is calculated at load time.

emacsclient --eval '(server-select-display (getenv "DISPLAY"))' may or
may not help depending on when (require 'org) is being executed.

The problem you are talking about is when no Emacs frames are present.
It is a problem that require different solution.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Getting X selection reliably (Re: idea for capture anywhere in x)

2022-10-27 Thread Max Nikulin

On 28/10/2022 11:59, Samuel Wales wrote:


i launch emacs from xinit or fluxbox menu.  sometimes from a shell.  i
run emacs as a cli batch thing from a shell.


Then you should always have an X11 Emacs frame, maybe behind other 
windows, and the following command should work


emacsclient --eval '(org-capture nil "p")'

with appropriate template key name, e.g. as defined by the following 
silly example:


("p" "primary" entry
   (file "/tmp/capture-test.org")
   "* Primary
%U

%(org-get-x-clipboard 'PRIMARY)
"
:immediate-finish t)

However to be at the safe side I would check if (org-get-x-clipboard 
'PRIMARY) value is not nil at first.






Re: Getting X selection reliably (Re: idea for capture anywhere in x)

2022-10-27 Thread Samuel Wales
i do not use emacs daemon or systemd.  have not tried running emacs
from cron i think.

i launch emacs from xinit or fluxbox menu.  sometimes from a shell.  i
run emacs as a cli batch thing from a shell.

[and i run emacs on linux console when nec.  it is inaccessible for
reasons like blinking cursor.]


On 10/26/22, Max Nikulin  wrote:
> On 26/10/2022 11:58, Ihor Radchenko wrote:
>>
>> Yes. From org-capture-templates docstring:
>>
>>%x  Content of the X clipboard.
>
> Ihor, I am afraid there are a couple of pitfalls with "%x" for Samuel
> since he prefers to keep Emacs hidden so can not check result.
>
> 1. If something goes wrong, e.g. some application does not put
> highlighted text to PRIMARY selection then wrong source (CLIPBOARD) or
> empty string may be silently captured. I would prefer explicit source
> however it will not protect against stale selection from the same source.
>
> Simulate empty selection:
> echo | xsel -bi ; echo | xsel -i ; killall xsel
>
> 2. Jean pointed out that Emacs ignores X selection if it does not have
> an X frame. It was almost buried in the haystack of "SQL instead of Org"
> noise. It happens if Emacs is running as a daemon. I am unsure which way
> Samuel starts Emacs (xinit, systemd user session, systemd socket
> activation, manually, etc.)
>
> What I do not like that error text is captured and no error is returned
> to emacsclient, so checks must be performed in advance.
>
> My suggestion:
> ~/examples/org/capture-daemon.el
>  >8 
> (defun nm-check-selection (selection)
>(let ((display (org-string-nw-p (getenv "DISPLAY"
>  (if display
>  (server-select-display display)
>(error "No DISPLAY")))
>(if (org-get-x-clipboard selection)
>t
>  (error "No %S selection" selection)))
>
> (custom-set-variables
>   '(org-capture-templates
> '(("x" "%x (test)" entry
>(file "/tmp/capture-test.org")
>"* Entry
> %U
>
> %x
> "
>:immediate-finish t)
>   ("p" "primary" entry
>(file "/tmp/capture-test.org")
>"* Primary
> %U
>
> %(org-get-x-clipboard 'PRIMARY)
> "
> :immediate-finish t
>
> (require 'org-capture)
>  8< 
>
> emacs -Q -L ~/src/org-mode/lisp/ \
> -L /usr/share/emacs/site-lisp/elpa/htmlize-1.55/ \
> --daemon --load ~/examples/org/capture-daemon.el
>
> emacsclient --eval "(nm-check-selection 'PRIMARY)" \
> --eval '(org-capture nil "p")'
>
> the latter command has non-zero exit code in the case of empty selection.
>
>
>
>


-- 
The Kafka Pandemic

A blog about science, health, human rights, and misopathy:
https://thekafkapandemic.blogspot.com



Re: [off-topic] E-readers and Org-Mode

2022-10-27 Thread Ihor Radchenko
Juan Manuel Macías  writes:

> Actually, the idea of a device running Android is interesting because it
> allows you to install termux and thus Emacs. You could even use Emacs
> GUI by installing a GNU/Linux distro in termux and loading it as proot
> (+ vnc), or just activating the X11 repo in termux, but I don't know
> what the performance would be like. Probably horrible.

I am using MobiScribe. It is running android. Though it is more tailored
for writing and drawing.

> Everything said in this threed is very interesting, but now I am
> hesitating between buying one of these devices or simply a 10-inch
> tablet with a good screen, and then applying all possible blue light
> filters to it. By activating the developer options, you can also turn
> Android grayscale. Of course it's not the same as an e-ink screen, but
> maybe I can work it out.

There is a world of difference between e-ink and normal screen. You
really need to try at least once before you decide.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Where is my init.el?

2022-10-27 Thread Ihor Radchenko
Renato Pontefice  writes:

> To try to solve my prob on emacs on Mac osx, I’ve uninstalled and re installe 
> emacs (after have save my init.el that have some customization).
> Now I would use this old init.el but I don’t know where th actual emacs looks 
> for init.el.
> Can you suggest me where I can look for?

Check out Emacs manual section 49.4 The Emacs Initialization File.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: org-x11idle-exists-p with emacs --daemon

2022-10-27 Thread Max Nikulin

On 28/10/2022 11:29, Ihor Radchenko wrote:

Max Nikulin  writes:


I am not familiar with `org-x11idle-exists-p', but a problem with access
of X clipboard from :immediate-finish capture templates may be quite
similar. The following command creates a hidden X11 frame if no visible
one exists:

emacsclient --eval '(server-select-display (getenv "DISPLAY"))'


You are talking about a different problem.
Please start a new thread.


Nope

emacs -Q -L ~/src/org-mode/lisp/ --daemon
emacsclient --eval window-system
nil

emacsclient --eval '(server-select-display (getenv "DISPLAY"))'
emacsclient --eval window-system
x

I suspect that the check of `window-system' was added to detect Emacs 
instances running as pure terminal applications having no access to X11 
and the case of daemon was simply overlooked.






Re: [BUG][Security] begin_src :var evaluated before the prompt to confirm execution

2022-10-27 Thread Ihor Radchenko
Max Nikulin  writes:

>> Should that be or is it a general policy for Org mode?
>
> I am afraid, it is unrealistic. Spreadsheet feature will be unusable. 
> And it is another reason why I am strongly against formats designed for 
> personal use rather than for web in browser context.

I disagree. We may ask about execution once for all the spreadsheet
formulas. Could you create an example of a spreadsheet running elisp
code and post it?

> Perhaps closely related issues exist with noweb references or some other 
> way to use code outside of particular #+begin_src body. I am unsure if 
> such problems should be discussed in this thread or in dedicated ones. I 
> am still suffering from deja vu and I should just bump an earlier thread.

It is better to open a new thread compared to none.
If something is briefly discussed in an old thread, it is unlikely to be
noticed. Especially bugs not listed on updates.orgmode.org.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: org-x11idle-exists-p with emacs --daemon

2022-10-27 Thread Ihor Radchenko
Julien Cubizolles  writes:

> All the org-*-idle-seconds func test at some point for
> org-x11idle-exists-p which is defvar-ed at load time. 
>
> For me, org-x11idle-exists-p is always nil at startup, but is set to
> true if I eval it later on. I guess it's because I'm starting Emacs in
> daemon mode, (as a systemd user service actually), and
> org-x11idle-exists-p relies on (eq window-system 'x) which is somehow
> not set in the terminal when the daemon.
>
> For the time being, it manually set org-x11idle-exists-p to true but
> shouldn't all this tests on (eq-window-system) be run each time a new
> frame is created ?

Does the attached patch work for you?

>From 95ec1073ab27bbfe522b25c9852f1e5e85e38e32 Mon Sep 17 00:00:00 2001
Message-Id: <95ec1073ab27bbfe522b25c9852f1e5e85e38e32.1666931293.git.yanta...@posteo.net>
From: Ihor Radchenko 
Date: Fri, 28 Oct 2022 12:26:09 +0800
Subject: [PATCH] org-x11idle-exists-p: Do not demand X window system at load
 time

* lisp/org-clock.el (org-x11idle-exists-p): Do not check if load-time
`window-system' is `x'.  Instead, rely on the check in
`org-user-idle-seconds'.

Emacs may start as a daemon and hence `window-system' may not yet be
`x' during startup.

Reported-by: Julien Cubizolles 
Link: https://orgmode.org/list/871qqs6gqs@free.fr
---
 lisp/org-clock.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index e98a34f0d..ca026c44f 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1201,8 +1201,7 @@ (defun org-mac-idle-seconds ()
 
 (defvar org-x11idle-exists-p
   ;; Check that x11idle exists
-  (and (eq window-system 'x)
-   (eq 0 (call-process-shell-command
+  (and (eq 0 (call-process-shell-command
   (format "command -v %s" org-clock-x11idle-program-name)))
;; Check that x11idle can retrieve the idle time
;; FIXME: Why "..-shell-command" rather than just `call-process'?
-- 
2.35.1



-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 


Re: org-x11idle-exists-p with emacs --daemon

2022-10-27 Thread Ihor Radchenko
Max Nikulin  writes:

> I am not familiar with `org-x11idle-exists-p', but a problem with access 
> of X clipboard from :immediate-finish capture templates may be quite 
> similar. The following command creates a hidden X11 frame if no visible 
> one exists:
>
> emacsclient --eval '(server-select-display (getenv "DISPLAY"))'

You are talking about a different problem.
Please start a new thread.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG] cant normally edit tables created with table-insert [9.5.2 (release_9.5.2-25-gaf6f12 @ c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/org/)]

2022-10-27 Thread Ihor Radchenko
Mati  writes:

>> with point at the top left cell, after C-c ', I can  across cells
>> in the edit buffer.
> Yes, in orgsrc mode (after clicking this shortcut, C-c ') it's possible, 
> but it should work in org, also as I previously mentioned, orgsrc table 
> editing is limited and doesn't work properly.

Note the table-insert is not an Org command. It inserts table.el-style
tables. Their support in Org is limited. They are _not_ native Org
tables. See https://orgmode.org/manual/Cooperation.html
That's why you need to use C-c ' and then work as you would via table.el
commands.

The proper Org tables can be created using M-x org-table-create. See
https://orgmode.org/manual/Tables.html.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG][Security] begin_src :var evaluated before the prompt to confirm execution

2022-10-27 Thread Max Nikulin

On 28/10/2022 10:19, Ihor Radchenko wrote:

Jean Louis writes:


* Max Nikulin [2022-10-27 06:21]:

Expected result:
No code from the Org buffer and linked files is executed prior to
confirmation from the user.


Should that be or is it a general policy for Org mode?


Yes, it is a general policy.
Org should not execute arbitrary Elisp without confirmation, unless the
user customizes the confirmation query to non-default.


There are significantly different contexts: trusted files created 
locally and arbitrary files fetched through some link in the web. 
Features really convenient in the former case may became a disaster in 
the latter.


If a user is prompted to confirm evaluation of each table formula then 
spreadsheet feature becomes unusable.


 >8 
Enter value and press =TAB=
|   | Value | Result |
|---+---+|
| # |   ||
#+tblfm: $3='(progn (message "%s" "pwnd") 0)
 8< 

I suspect a bunch of similar problems with export feature. The ability 
to save an .org file as a nicely formatted PDF is great but 
simultaneously dangerous for files obtained from the net. I would like 
to have safe export, but I am afraid that actually the code would be 
fragile.






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

2022-10-27 Thread Ihor Radchenko
Ihor Radchenko  writes:

> I have forwarded this bug report to Emacs bug tracker.
> See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58793

The bug is now fixed on Emacs master.
This issue will be resolved in the next Emacs 29 release.
(It has nothing to do with Org)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: ob-clojure eval error when has comment at end of code line

2022-10-27 Thread Ihor Radchenko
Daniel Kraus  writes:

> @Ihor, a few developer related questions:
> - I wanted to add a test, how can I run only test-ob-clojure?

make test BTEST_POST="-L /path/to/cider.el" BTEST_OB_LANGUAGES="clojure" 
BTEST_RE="ob-clojure"

Note that our tests demand cider executable and library.
Testing with external libraries is a bit manual.

> - What should I use for indention? Looking in ob-clojure and org.el
>   it seems that using tabs with tab-width 8 is standard but there's
>   quite a few lines where it's spaces only.

That is a good question. I guess, just Emacs default.
Our code is not consistent here...
Maybe Bastien can clarify better.

> - If this simple patch for example or fixing tests is good,
>   should I just install it?

Yes. We have some conventions documented at
https://orgmode.org/worg/org-maintenance.html#maintainer-role

>   Can I "freely" install minor changes to ob-clojure or should
>   everything go over the mailinglist?

Minor changes do not need to be discussed. We generally discuss new
features or changes that affect multiple libraries.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] Fix ob-clojure handling source block variable's value is a org-mode table or list

2022-10-27 Thread Ihor Radchenko
Daniel Kraus  writes:

> Just in case you want to play around with Clojure, installing babashka
> (https://github.com/babashka/babashka) is a single binary and very simple to 
> install.

Thanks!

> Subject: [PATCH] lisp/ob-clojure.el: Fix header argument :var binding
>
> * lisp/ob-clojure.el (org-babel-expand-body:clojure): Always quote
> the variables passed from org-mode in clojure let binding.
> When a variable is a table or list, it's value is is "(..data..)"

*is is

Otherwise, feel free to push.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [BUG][Security] begin_src :var evaluated before the prompt to confirm execution

2022-10-27 Thread Ihor Radchenko
Jean Louis  writes:

> * Max Nikulin  [2022-10-27 06:21]:
>> Expected result:
>> No code from the Org buffer and linked files is executed prior to
>> confirmation from the user.
>
> Should that be or is it a general policy for Org mode?

Yes, it is a general policy.
Org should not execute arbitrary Elisp without confirmation, unless the
user customizes the confirmation query to non-default.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



[PATCH] Re: [BUG][Security] begin_src :var evaluated before the prompt to confirm execution

2022-10-27 Thread Ihor Radchenko
Max Nikulin  writes:

> Consider the following source block
>
>  >8 
> #+begin_src elisp :var a=(message "%s" "pwnd")
>a
> #+end_src
>  8< 
>
> Open the "*Messages*" buffer (C-h e) and try to evaluate the source 
> block (C-c C-c).
>
> Actual result:
> "pwnd" message appears in "*Messages*" simultaneously with user prompt 
> whether the code should be executed.
>
> Expected result:
> No code from the Org buffer and linked files is executed prior to 
> confirmation from the user.

Confirmed.

See the attached tentative patch.
I tried to balance between annoying users with query and not evaluating
unsafe code: '-quoted lists and symbols are still evaluated without
prompt.

Let me know if you see any potential issues.

>From 961a3ee38a2b9521427fddea5102d003f39b88d6 Mon Sep 17 00:00:00 2001
Message-Id: <961a3ee38a2b9521427fddea5102d003f39b88d6.1666926796.git.yanta...@posteo.net>
From: Ihor Radchenko 
Date: Fri, 28 Oct 2022 11:09:50 +0800
Subject: [PATCH] org-babel-read: Obey `org-confirm-babel-evaluate'

* lisp/ob-core.el (org-babel-read): Do not execute arbitrary Elisp
without prompt, according to `org-confirm-babel-evaluate'.

Reported-by: Max Nikulin 
Link: https://orgmode.org/list/tjct9e$179u$1...@ciao.gmane.io
---
 lisp/ob-core.el | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index 518831ec6..e10ab401c 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -3165,7 +3165,16 @@ (defun org-babel-read (cell  inhibit-lisp-eval)
 	((and (not inhibit-lisp-eval)
 	  (or (memq (string-to-char cell) '(?\( ?' ?` ?\[))
 		  (string= cell "*this*")))
-	 (eval (read cell) t))
+ ;; Prevent arbitrary function calls.
+ (if (and (memq (string-to-char cell) '(?\( ?`))
+  (not (org-babel-confirm-evaluate
+  ;; See `org-babel-get-src-block-info'.
+  (list "emacs-lisp" (format "%S" cell)
+'((:eval . yes)) nil (format "%S" cell)
+nil nil
+ ;; Not allowed.
+ (user-error "Evaluation of elisp code %S aborted." cell)
+	   (eval (read cell) t)))
 	((save-match-data
(and (string-match "^[[:space:]]*\"\\(.*\\)\"[[:space:]]*$" cell)
 (not (string-match "[^\\]\"" (match-string 1 cell)
-- 
2.35.1



-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 


Re: org-x11idle-exists-p with emacs --daemon

2022-10-27 Thread Max Nikulin

On 28/10/2022 05:31, Julien Cubizolles wrote:


For me, org-x11idle-exists-p is always nil at startup, but is set to
true if I eval it later on. I guess it's because I'm starting Emacs in
daemon mode, (as a systemd user service actually), and
org-x11idle-exists-p relies on (eq window-system 'x) which is somehow
not set in the terminal when the daemon.


I am not familiar with `org-x11idle-exists-p', but a problem with access 
of X clipboard from :immediate-finish capture templates may be quite 
similar. The following command creates a hidden X11 frame if no visible 
one exists:


emacsclient --eval '(server-select-display (getenv "DISPLAY"))'






Re: Request for feedback: ox-linuxmag

2022-10-27 Thread Ihor Radchenko
Damien Cassou  writes:

> Hi Ihor,
>
> Ihor Radchenko  writes:
>> I think :filter-final-output in :filters-alist will be more suitable.
>> It is called at the very end and may set some let-bound value to be
>> used in the ox-linuxmag-export-to-odt.
>
> I'm not really sure what you mean with the last sentence. In my last
> commit, I made use of :filter-final-output:
>
> https://github.com/DamienCassou/ox-linuxmag-fr/commit/195f154d5f76f50a94e4bdc95f27c8400e77992d
>
> (please note the new URL of the project reflecting its new name).
>
> As you can see, I didn't change ox-linuxmag-fr-export-to-odt. Do you
> suggest some changes there as well?

I think you misunderstood what I meant.

(Note that this particular suggestion is more about code style and
ensuring side-effect-free export if something fails).

The idea is that before org-export processed the Org buffers and
produces the final form of the converted output, nothing should touch
the filesystem. Otherwise, if the export process fails for some reason
(like user filter erring), some garbage may be produced and left on the
disk.

So, my suggestion is to set some transient data in your custom output
filter. Then, inside ox-linuxmag-fr-export-to-odt, you can reuse the
data to write all the necessary files on disk knowing that nothing
failed before.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: [PATCH] lisp/ob-tangle.el, lisp/ob-core.el: Add strip-tangle noweb option

2022-10-27 Thread Ihor Radchenko
dzilte...@lyrion.ch writes:

> From: Daniel Ziltener 
>
> * ob-tangle.el, ob-core.el, test-ob-tangle.el, org-manual.org: Add a
> "strip-tangle" noweb option to strip the noweb tags when tangling, but
> keep and expand them otherwise.

Thanks for the patch!

If I understand correctly, you are suggesting 

Could you please follow
https://orgmode.org/worg/org-contribute.html#commit-messages for the
commit log entries?

Also, do you have FSF copyright assignment? If no, you also need to add
TINYCHANGE cookie to the commit message. See
https://orgmode.org/worg/org-contribute.html#first-patch

> +- =strip-tangle= ::
> +
> +  Expansion of noweb syntax references in the body of the code block
> +  when evaluating or exporting. Removes noweb syntax references
> +  when tangling.

This is a new feature and thus should also be mentioned in etc/NEWS.

Also, please use double space between sentences. See
doc/Documentation_Standards.org.

>(let ((allowed-values (cl-case context
> -   (:tangle '("yes" "tangle" "no-export" "strip-export"))
> -   (:eval   '("yes" "no-export" "strip-export" "eval"))
> -   (:export '("yes")
> +   (:tangle '("yes" "tangle" "no-export" "strip-export" 
> "strip-tangle"))
> +   (:eval   '("yes" "no-export" "strip-export" "eval" 
> "strip-tangle"))
> +   (:export '("yes" "strip-tangle")

AFAIU, you are suggesting a new value for :noweb header argument.
But this function has nothing to do with :noweb. This change will check
for :tangle strip-tangle, :eval strip-tangle, and :export strip-tangle.
What is the purpose?

Also, the allowed values of standard header args are defined in
org-babel-common-header-args-w-values, which you did not change.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: bug#58774: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Ihor Radchenko
"Dr. Arne Babenhauserheide"  writes:

> Max Nikulin  writes:
>
>> How are you going to distinguish your personal files and arbitrary
>> files from non-trusted sources? By signing your files and maintaining
>> list of trusted certificates?
>
> One idea that could work well is to add an explicit allow-list
> trusted-sources-to-allow-unsafe-modes with entries of domain and
> path-prefix where people can add trusted sources.
>
> If for example my server were draketo.de,¹ I could set this list to
>
> '(("https://www.draketo.de; "/software"))
>
> and when I would then open a link like
>
>   https://www.draketo.de/software/advent-of-wisp-code-2021.org
>
> with eww, it would directly switch to org-mode.
>
>
> If, however, I would open the link
>
>   https://draketo.de.evil.attacks/software/advent-of-wisp-code-2021.org
>
> with eww, it would display it as plain text, because it would not be in
> the list of trusted sources.

I am a bit lost about the aim of this tread, but let me share some
existing remote resource controls we have employed on the latest Org:

(defun org--should-fetch-remote-resource-p (uri)
  "Return non-nil if the URI should be fetched."

(defun org--safe-remote-resource-p (uri)
  "Return non-nil if URI is considered safe.
This checks every pattern in `org-safe-remote-resources', and
returns non-nil if any of them match."

(defun org--confirm-resource-safe (uri)
  "Ask the user if URI should be considered safe, returning non-nil if so."

You can check the implementation at
https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/org.el#n4540

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: bug#58774: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Dr. Arne Babenhauserheide

Jean Louis  writes:

> * Dr. Arne Babenhauserheide  [2022-10-28 01:11]:
>> 
>> Max Nikulin  writes:
>> 
>> > How are you going to distinguish your personal files and arbitrary
>> > files from non-trusted sources? By signing your files and maintaining
>> > list of trusted certificates?
>> 
>> One idea that could work well is to add an explicit allow-list
>> trusted-sources-to-allow-unsafe-modes with entries of domain and
>> path-prefix where people can add trusted sources.
>
> That implies that for every content type you are supposed to do the
> same.

No, you misunderstood the proposal.

> And what makes you want to limit people how they want to run their Org
> files?

The wish to limit the fallout when¹ this gets weaponized by criminals.

If you explicitly allow-list trusted sources, bad actors have to take
over your trusted server to attack you. That’s much less likely than bad
actors taking over some random long-unmainted server of a link you
stumbled upon.

¹: when, not if.

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de


signature.asc
Description: PGP signature


org-x11idle-exists-p with emacs --daemon

2022-10-27 Thread Julien Cubizolles


All the org-*-idle-seconds func test at some point for
org-x11idle-exists-p which is defvar-ed at load time. 

For me, org-x11idle-exists-p is always nil at startup, but is set to
true if I eval it later on. I guess it's because I'm starting Emacs in
daemon mode, (as a systemd user service actually), and
org-x11idle-exists-p relies on (eq window-system 'x) which is somehow
not set in the terminal when the daemon.

For the time being, it manually set org-x11idle-exists-p to true but
shouldn't all this tests on (eq-window-system) be run each time a new
frame is created ?
-- 
Julien Cubizolles




Re: bug#58774: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Jean Louis
* Dr. Arne Babenhauserheide  [2022-10-28 01:11]:
> 
> Max Nikulin  writes:
> 
> > How are you going to distinguish your personal files and arbitrary
> > files from non-trusted sources? By signing your files and maintaining
> > list of trusted certificates?
> 
> One idea that could work well is to add an explicit allow-list
> trusted-sources-to-allow-unsafe-modes with entries of domain and
> path-prefix where people can add trusted sources.

That implies that for every content type you are supposed to do the
same.

And what makes you want to limit people how they want to run their Org
files?

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



Re: bug#58774: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Dr. Arne Babenhauserheide

Max Nikulin  writes:

> How are you going to distinguish your personal files and arbitrary
> files from non-trusted sources? By signing your files and maintaining
> list of trusted certificates?

One idea that could work well is to add an explicit allow-list
trusted-sources-to-allow-unsafe-modes with entries of domain and
path-prefix where people can add trusted sources.

If for example my server were draketo.de,¹ I could set this list to

'(("https://www.draketo.de; "/software"))

and when I would then open a link like

  https://www.draketo.de/software/advent-of-wisp-code-2021.org

with eww, it would directly switch to org-mode.


If, however, I would open the link

  https://draketo.de.evil.attacks/software/advent-of-wisp-code-2021.org

with eww, it would display it as plain text, because it would not be in
the list of trusted sources.


Best wishes,
Arne

¹: hypothetically speaking :-)
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de


signature.asc
Description: PGP signature


Re: bug#58774: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Dr. Arne Babenhauserheide

Jean Louis  writes:

> * Max Nikulin  [2022-10-27 18:40]:
>> On 27/10/2022 11:55, Jean Louis wrote:
>> > 
>> > Now is clear that main problem here is that Org advertises somewhere
>> > to be "text" in MIME context, while it is not, it is by default
>> > "application" and thus unsafe, see:
>> ...
>> > Text Media Types
>> > https://datatracker.ietf.org/doc/html/rfc6838#section-4.2.1
>> 
>> I do not see any problem or any difference what MIME type you are going to
>> associate with Org mode. I agree with Arne that text/... type is more
>> appropriate for a format readable as text. I do not see any contradictions
>> with that RFC.
>
> You were the one speaking and reporting that Org executes Emacs Lisp.
>
> And now you imply that it is safe to open it because it is text? 
>
> If Org or any file implies possible execution when loaded, and Org
> implies it, it is not any more "text/*" MIME type.

Whether or not something *can* be executed is irrelevant for text/* vs.
application/*. Relevant is whether something *must* be executed for the
document to be usable.

> From:
> https://datatracker.ietf.org/doc/html/rfc6838#section-4.2.5
>
>> 4.2.5.  Application Media Types
>
>>The "application" top-level type is to be used for discrete data that
>>do not fit under any of the other type names, and particularly for
>>data to be processed by some type of application program.  This is
>>information that must be processed by an application before it is
>>viewable or usable by a user.
>
> That is exactly the case with Org. Of course, one could minimize org
> file to empty string, and say this is Org file and there is no
> execution necessary, so it is "text".
>
> Otherwise information must be processed by application which is
> clearly the Org package before it is viewable or usable by a user.

#+title: I disagree

* Firstoff
because this is a valid org-structure.
* Second
because you can use this.

#+begin_src bash
echo "even the embedded source here"
#+end_src
* Test
If you could not read the two arguments
_without_ first processing this section with org-mode
then I am wrong. If so, please tell me /"could not read"/.
That said: If you tell me /"could not read"/ I know
that you *could* read this section, so you would be wrong.

* Conclusion
Org mode documents belong into text/*


>> Expected uses for the "application" type name include but are not
>> limited to file transfer, spreadsheets, presentations, scheduling
>> data, and languages for "active" (computational) material.
>
> ✔️ YES, we have spreadsheets in Org which results may be viewable only
> after computed.
application/* and text/* are not distinguished by their domain, but by
whether they are readable as plain text.

Same for your other points.

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de


signature.asc
Description: PGP signature


Re: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Dr. Arne Babenhauserheide

Jean Louis  writes:

> * Dr. Arne Babenhauserheide  [2022-10-27 14:23]:
>> 
>> Jean Louis  writes:
>> 
>> > * Jean Louis  [2022-10-25 15:14]:
>> >> 
>> >> This wish request is related to Emacs EWW and Org mode.
>> >> 
>> >> Please make EWW recognize Org file when served by WWW server. Currently
>> >> it does not recognize the MIME type text/x-org and opens the file as
>> >> text, it does not invoke the org mode. In my opinion, it should.
>> >
>> > Now is clear that main problem here is that Org advertises somewhere
>> > to be "text" in MIME context, while it is not, it is by default
>> > "application" and thus unsafe, see:
>> >
>> > Application Media Types
>> > https://datatracker.ietf.org/doc/html/rfc6838#section-4.2.5
>> >
>> > and understand difference to:
>> >
>> > Text Media Types
>> > https://datatracker.ietf.org/doc/html/rfc6838#section-4.2.1
>> >
>> > Thus I suggest that Org changes its MIME type and stop falsely
>> > claiming to be "text" in MIME context, but that content type:
>> > "application/x-org" become adopted, as that way it will become clear
>> > that it is unsafe opening Org as falsely claimed "plain" text.
>> 
>> You are mixing up text/plain and text/*. Orgmode is clearly text/* but
>> not text/plain. From your link:
>
> How do I mix it?

The paragraph about plain text only applies to text/plain.

The following paragraph shows clearly that org-mode is rich-text,
because it can be read without specialized program. And it is: I
sometimes read org-mode documents with nano.

>>Beyond plain text, there are many formats for representing what might
>>be known as "rich text".  An interesting characteristic of many such
>>representations is that they are to some extent readable even without
>>the software that interprets them.  It is useful to distinguish them,
>>at the highest level, from such unreadable data as images, audio, or
>>text represented in an unreadable form.  In the absence of
>>appropriate interpretation software, it is reasonable to present
>>subtypes of "text" to the user, while it is not reasonable to do so
>>with most non-textual data.  Such formatted textual data can be
>>represented using subtypes of "text".
>
> Org is not just rich text for reason as explained here:
> https://datatracker.ietf.org/doc/html/rfc6838#section-4.2.5 so I
> suggest reading it.

This is information that must be processed by an application before it is
viewable or usable by a user"

That is very much *not* the case for org-mode documents.

You’ll have to quote a specific point you mean, because I do not find
anything that supports your point in there.

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de


signature.asc
Description: PGP signature


Re: bug#58774: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Quiliro Ordóñez
I think that this would be very useful for me.  In fact, it would be a
good way to make Emac work without being a tool for corporations (as
Firefox is) to control user's computers (unless the user decides to
allow running Babel by default).  Maybe even Gemini is a good candidate
to work this out.



Re: bug#58774: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Quiliro Ordóñez
El 2022-10-27 13:25, Jean Louis escribió:

> But I am doing it wrong, that will correctly invoke org mode, but then
> it does not return back to normal EWW work. I have tried to remember
> the major mode and invoke it again. But it is not that it works.

Isn't that what hooks do?  Perhaps I did not understand them correctly.



Re: bug#58774: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Jean Louis
* Max Nikulin  [2022-10-27 18:41]:
> Chromium is able to display text/x-org internally just as text/plain and I
> like it as a way to preview and review file contents.

Org file is for Emacs. It is not for Chromium.

Just as you can display application/json in Chromium as text, does not
make application/json less "application/*" MIME type.

Displaying Org in Chromium is useless, as I cannot use Org features,
Chromium is not for that, and it's not suitable example.

Suitable example is that Chromium may be configured to open Org file
correctly with Emacs and as you have mentioned, there will be executions.

> I have not managed to configure Firefox to achieve the same behavior
> that allows to avoid an external application (certainly not Emacs at
> first).

I wonder on which mailing list I am.

Of course I want Org file be opened by Emacs. I am user of Org
files and Emacs. I am not vim user (unless Emacs flunks).

> > We can't just speak of safety alone when we are in general
> > computing environment, we must also speak of usefulness.
> 
> I do not mind to have org-view-mode that saves me from execution some code
> unintentionally. Since most of the code was written without having in mind
> such feature, I expect a lot of iterations before all possibilities to run
> code will be plumbed. I suspect that it is possible to ruin whole protection
> by a small piece of elisp code. I am unaware of sandboxing in Emacs. I
> expect that making Org mode safe enough will require a lot of efforts by
> developers.

Exactly.

> Your are pushing Org to rather hostile environment: highly automated
> attacks to distribute exploits, market of breached computers
> listening for remote commands.

Tittle-tattle. ‍ But America has been already discovered.

Remember, any type of application, software, is already for billions
of times delivered by Internet and executed on user's devices.

Flatpak, APK, EXE files, Java, shell files, hoo, too long
list. And where we are now? In Emacs world, where packages are
distributed from all kinds of sources and executed on users's
computers. 

"Pushing Org" to rather hostile environment is exaggeration.

> A running cryptominer would be rather innocent consequence, through
> the same backdoor you may receive an encryptor or various stuff
> searching for credentials and access tokens in your files.

Of course I understand that.

Do you wish to say that users should not have the freedom to customize
web browser to click on Org file and open it with Emacs?

Are we not on Emacs related mailing list?

If I am pushing Org into hostile environment, than you are implying
that we as Org users are hostile environemnt. Are we really?

> Emacs is protected mostly by its low popularity. A lot of efforts
> have been invested in browser making attacks more expensive, but
> still attractive due to possible benefits. I do not like to increase
> surface for attacks. Someone may create a plugin targeting Emacs
> users just because it would be easy enough.

And? 

> Consider converting Org files to HTML as an unpleasant tax for the
> sake of safety.

Personally, definitely not. Such files do not give me freedom to work
with my Org data. It is way of presenting things, not handling it.

> > All I want is to access my personal read-only Org files by using WWW
> > and browse from one to the other by using links.
> 
> How are you going to distinguish your personal files and arbitrary files
> from non-trusted sources? By signing your files and maintaining list of
> trusted certificates?

藍 Am I Joe Biden or other gaga that I do not know what are my files? 

> For personal notes I would expect e.g. private instance of nextcloud
> file share (that is internally HTTP server), not accessing files
> directly through HTTP.

HTTP is transfer protocol, not my mamma to tell me what I am going to
transfer in my room.

Nextcloud is application that runs on computer and is served by web
server. It allows file share to public as well. 

I understand your point of protecting private files on web
server. That shall be natural to every person hosting such
files. Nextcloud is bloated way to do such hosting.

Simplest way to protect files is to upload files and use web server
authentication.

And web server does not mean that files are distributed on public
WWW. We use here ethernet, and we share files from device to device by
using HTTP server. You can't access those files, they are beyond
public IP address space.

I need help to make it work right, can you help?

I load this:

(defvar eww-content-type nil)
(put 'eww-content-type 'permanent-local t)

then I put this below in `eww-render' after (let

;;; (setq eww-content-type content-type)

Then I use this:

(defun rcd-eww-content-type ()
  (cond ((string-match-p "text/x-org" (car eww-content-type)) (org-mode))
 (t WHAT-HERE?)))

(add-hook 'eww-after-render-hook 'rcd-eww-content-type)

But I am doing it wrong, that will correctly invoke org mode, but then
it does not 

Re: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Jean Louis
* Dr. Arne Babenhauserheide  [2022-10-27 14:23]:
> 
> Jean Louis  writes:
> 
> > * Jean Louis  [2022-10-25 15:14]:
> >> 
> >> This wish request is related to Emacs EWW and Org mode.
> >> 
> >> Please make EWW recognize Org file when served by WWW server. Currently
> >> it does not recognize the MIME type text/x-org and opens the file as
> >> text, it does not invoke the org mode. In my opinion, it should.
> >
> > Now is clear that main problem here is that Org advertises somewhere
> > to be "text" in MIME context, while it is not, it is by default
> > "application" and thus unsafe, see:
> >
> > Application Media Types
> > https://datatracker.ietf.org/doc/html/rfc6838#section-4.2.5
> >
> > and understand difference to:
> >
> > Text Media Types
> > https://datatracker.ietf.org/doc/html/rfc6838#section-4.2.1
> >
> > Thus I suggest that Org changes its MIME type and stop falsely
> > claiming to be "text" in MIME context, but that content type:
> > "application/x-org" become adopted, as that way it will become clear
> > that it is unsafe opening Org as falsely claimed "plain" text.
> 
> You are mixing up text/plain and text/*. Orgmode is clearly text/* but
> not text/plain. From your link:

How do I mix it?

>Beyond plain text, there are many formats for representing what might
>be known as "rich text".  An interesting characteristic of many such
>representations is that they are to some extent readable even without
>the software that interprets them.  It is useful to distinguish them,
>at the highest level, from such unreadable data as images, audio, or
>text represented in an unreadable form.  In the absence of
>appropriate interpretation software, it is reasonable to present
>subtypes of "text" to the user, while it is not reasonable to do so
>with most non-textual data.  Such formatted textual data can be
>represented using subtypes of "text".

Org is not just rich text for reason as explained here:
https://datatracker.ietf.org/doc/html/rfc6838#section-4.2.5 so I
suggest reading it.

Examples of content types for some "rich" text formats:

.odtOpenDocument text document
application/vnd.oasis.opendocument.text

.rtfRich Text Format (RTF)  application/rtf

.xhtml  XHTML   application/xhtml+xml

xml XML application/xml is recommended as of RFC 7303 (section
4.1), but text/xml is still used sometimes. You can assign a specific
MIME type to a file with .xml extension depending on how its contents
are meant to be interpreted. For instance, an Atom feed is
application/atom+xml, but application/xml serves as a valid default.

Review definition of "application/*" type.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



Re: bug#58774: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Jean Louis
* Max Nikulin  [2022-10-27 18:40]:
> On 27/10/2022 11:55, Jean Louis wrote:
> > 
> > Now is clear that main problem here is that Org advertises somewhere
> > to be "text" in MIME context, while it is not, it is by default
> > "application" and thus unsafe, see:
> ...
> > Text Media Types
> > https://datatracker.ietf.org/doc/html/rfc6838#section-4.2.1
> 
> I do not see any problem or any difference what MIME type you are going to
> associate with Org mode. I agree with Arne that text/... type is more
> appropriate for a format readable as text. I do not see any contradictions
> with that RFC.

You were the one speaking and reporting that Org executes Emacs Lisp.

And now you imply that it is safe to open it because it is text? 

If Org or any file implies possible execution when loaded, and Org
implies it, it is not any more "text/*" MIME type.

From:
https://datatracker.ietf.org/doc/html/rfc6838#section-4.2.5

> 4.2.5.  Application Media Types

>The "application" top-level type is to be used for discrete data that
>do not fit under any of the other type names, and particularly for
>data to be processed by some type of application program.  This is
>information that must be processed by an application before it is
>viewable or usable by a user.

That is exactly the case with Org. Of course, one could minimize org
file to empty string, and say this is Org file and there is no
execution necessary, so it is "text".

Otherwise information must be processed by application which is
clearly the Org package before it is viewable or usable by a user.

> Expected uses for the "application" type name include but are not
> limited to file transfer, spreadsheets, presentations, scheduling
> data, and languages for "active" (computational) material.

✔️ YES, we have spreadsheets in Org which results may be viewable only
after computed.

✔️ YES, we have scheduling data, which is viewable only in Org agenda
or by using computations.

✔️ YES, we have languages for active computational material.

> (The last, in particular, can pose security problems that must be
> understood by implementors.  The "application/postscript" media type
> registration in [RFC2046] provides a good example of how to handle
> these issues.)

> For example, a meeting scheduler might define a standard
> representation for information about proposed meeting dates.

✔️ YES, we have that functionality in Org.

> An intelligent user agent would use this information to conduct a
> dialog with the user, and might then send additional material based
> on that dialog.

> More generally, there have been several "active" languages developed
> in which programs in a suitably specialized language are transported
> to a remote location and automatically run in the recipient's
> environment.  Such applications may be defined as subtypes of the
> "application" top-level type.

✔️ YES, that is exactly what we have in Org mode, as Babel allows
executions of several active languages, and by transferring Org files,
to remote location they may be automatically run in the recipient's
environment.

> The subtype of "application" will often either be the name or include
> part of the name of the application for which the data are intended.
> This does not mean, however, that any application program name may
> simply be used freely as a subtype of "application"; the subtype needs
> to be registered.

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



Re: Where is my init.el?

2022-10-27 Thread briangpowell
You can put it anywhere you like--you can even have as many as you want:

$ emacs -l /somedirectory/init1.el -l /someotherdirectory/init2.el

Realize the default "init.el" is actually ~/.emacs so just ensure that your
init.el file(s) don't conflict with it and/or throw the "-q" switch which
ignores it

On Thu, Oct 27, 2022 at 1:59 PM Renato Pontefice 
wrote:

> To try to solve my prob on emacs on Mac osx, I’ve uninstalled and re
> installe emacs (after have save my init.el that have some customization).
> Now I would use this old init.el but I don’t know where th actual emacs
> looks for init.el.
> Can you suggest me where I can look for?
>
>
> TIA
>
> Renato
>


Where is my init.el?

2022-10-27 Thread Renato Pontefice
To try to solve my prob on emacs on Mac osx, I’ve uninstalled and re installe 
emacs (after have save my init.el that have some customization).
Now I would use this old init.el but I don’t know where th actual emacs looks 
for init.el.
Can you suggest me where I can look for?


TIA

Renato


Re: [off-topic] E-readers and Org-Mode

2022-10-27 Thread Juan Manuel Macías
Max Nikulin writes:

> I see that definitely it is possible, but I am unsure it is more
> convenient than OLED or LCD tablet. 4 regimes for screen is an
> indicator of some complications. Choice of Android may be a way to
> avoid development of custom UI. I have not checked if it is possible
> to build custom Android variant, unlock bootloader and still get
> comparable performance.
>
> Where was a period when LCD monitors were slow in comparison to CRT
> ones and people complained concerning annoying trails on dynamic
> images...

Precisely, a couple of days ago, in my search for information on this
subject, I found a e-ink device, likebook, that a) runs Android and b)
has an option to be able to see things on the screen like a normal
tablet, that is, that you can watch videos and more. Grayscale, of
course, but without the problems of a typical e-ink screen. In yt there
are some videos that show this double use. It's interesting. Anyway I
don't know if a custom build of Android can be installed on this device.

Actually, the idea of a device running Android is interesting because it
allows you to install termux and thus Emacs. You could even use Emacs
GUI by installing a GNU/Linux distro in termux and loading it as proot
(+ vnc), or just activating the X11 repo in termux, but I don't know
what the performance would be like. Probably horrible.

On the other hand, the only free app to annotate PDFs on Android is
pen (based on muPDF), but it hasn't been maintained for several
years. It can be installed on F-droid by adding the IzzyOnDroid
repository, but I don't know if installing it would be a security
risk...

Everything said in this threed is very interesting, but now I am
hesitating between buying one of these devices or simply a 10-inch
tablet with a good screen, and then applying all possible blue light
filters to it. By activating the developer options, you can also turn
Android grayscale. Of course it's not the same as an e-ink screen, but
maybe I can work it out.

Best regards,

Juan Manuel 



Re: [off-topic] E-readers and Org-Mode

2022-10-27 Thread Max Nikulin
I am impressed, but I still believe that UI optimized for e-ink may be 
more convenient for specific tasks involving org files than generic 
Emacs build for Android. Perhaps conversion of handwritten notes to text 
should be delegated to a laptop or a PC.


On 25/10/2022 23:59, Ken Mankoff wrote:
See also Dasung NotEReader. Full Android tablet, no lockdown like the 
ReMarkable. Looks fast - can watch YouTube videos for example. If it's 
really full Android, then it should be able to install and run emacs 
natively. 10.3 or 7.8 inch versions.


I see that definitely it is possible, but I am unsure it is more 
convenient than OLED or LCD tablet. 4 regimes for screen is an indicator 
of some complications. Choice of Android may be a way to avoid 
development of custom UI. I have not checked if it is possible to build 
custom Android variant, unlock bootloader and still get comparable 
performance.


Where was a period when LCD monitors were slow in comparison to CRT ones 
and people complained concerning annoying trails on dynamic images...



On Tue, Oct 25, 2022, 08:27 Fraga, Eric wrote:

On Tuesday, 25 Oct 2022 at 21:37, Max Nikulin wrote:
 > E-ink displays are slow (my device was manufactured 15 years ago

..

E-ink displays are getting significantly faster, with some claiming 60
Hz refresh rates (cf. the PineNote).  Often, however, they are tied to
low power and low performance processors given their use case: mostly
reading with some annotations.


There is no reason to install high performance CPU if the goal is to get 
time between battery charging noticeably longer that for regular 
gadgets. Highest refresh rate means 5W power consumption in the case of 
PineNote.


It is not apparent for not-ereader, but I see the same black and back 
flickering magic to fight with ghosts and to achieve uniform background 
with high contrast on remarkable. My impression is that change in time 
to pass whole cycle is not dramatic. Likely long enough pause is 
necessary to let particles orientation to settle.







Re: Error opening an .org file

2022-10-27 Thread Juan Manuel Macías
Renato Pontefice writes:

> I’ve edited and commented all the lines of it. And The error
> persist. So (was you told)maybe the error is not of init.el
> But I’m unable to run emacs from termnal.
> How can I do?
> I’m in Mac osx 12.6.1 where do I can find emacs?

Renato, I'm not a Mac user, but I imagine it will be like any other
Unix: you have to launch a terminal from your desktop (i guess there
will be in macos an app called "terminal" or something like that), and
once inside the terminal, just type:

emacs --debug-init

and press enter. Emacs (GUI) will open and you should pay attention to
the error messages that Emacs will show you. That will give you a clue
as to where the error is in your Emacs startup.

Best regards,

Juan Manuel 



Re: Error opening an .org file

2022-10-27 Thread Renato Pontefice


> Il giorno 27 ott 2022, alle ore 18:07, to...@tuxteam.de ha scritto:
> 
>> I’ve edited and commented all the lines of it. And The error persist. So 
>> (was you told)maybe the error is not of init.el
>> But I’m unable to run emacs from termnal.
>> How can I do?
>> I’m in Mac osx 12.6.1 where do I can find emacs?
> 



Re: Error opening an .org file

2022-10-27 Thread tomas
On Thu, Oct 27, 2022 at 05:11:32PM +0200, Renato Pontefice wrote:
> When I try to open a simple file in emacs, I receive this error
> 
> Warning (initialization): An error occurred while loading 
> ‘/Users/renatopontefice/.emacs.d/init.el’:
> 
> Invalid read syntax: ), 1, 0

I don't understand: this error complains about 'init.el', does
not happen at start, but much later, when you try to open an
.org file?

> To ensure normal operation, you should investigate and remove the
> cause of the error in your initialization file.  Start Emacs with
> the ‘--debug-init’ option to view a complete error backtrace. Disable showing 
> Disable logging

Have you tried starting Emacs with that option? What happens
then?

> So the prob is on my init.el file. What error it could be? 

We can only guess. Given our lack of information, our guesses
will be almost certainly wrong :-)

So give us a chance:

 - try starting Emacs with --debug-on-init, an possibly report
   results here
 - try bisecting the file: remove parts of it (always taking
   care of the syntax), see in which "half" the error occurs
 - post your init.el here (BE CAREFUL: please, double-check
   that it doesn't contain sensitive information: passwords,
   personal information, things your employer could consider
   to be trade secrets, that kind of stuff).

Cheers
-- 
t


signature.asc
Description: PGP signature


Re: bug#58774: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Max Nikulin

On 27/10/2022 11:55, Jean Louis wrote:


Now is clear that main problem here is that Org advertises somewhere
to be "text" in MIME context, while it is not, it is by default
"application" and thus unsafe, see:

...

Text Media Types
https://datatracker.ietf.org/doc/html/rfc6838#section-4.2.1


I do not see any problem or any difference what MIME type you are going 
to associate with Org mode. I agree with Arne that text/... type is more 
appropriate for a format readable as text. I do not see any 
contradictions with that RFC.


"Org Mode
Your life in plain text"

Chromium is able to display text/x-org internally just as text/plain and 
I like it as a way to preview and review file contents. I have not 
managed to configure Firefox to achieve the same behavior that allows to 
avoid an external application (certainly not Emacs at first).



We can't just speak of safety alone when we are in general
computing environment, we must also speak of usefulness.


I do not mind to have org-view-mode that saves me from execution some 
code unintentionally. Since most of the code was written without having 
in mind such feature, I expect a lot of iterations before all 
possibilities to run code will be plumbed. I suspect that it is possible 
to ruin whole protection by a small piece of elisp code. I am unaware of 
sandboxing in Emacs. I expect that making Org mode safe enough will 
require a lot of efforts by developers.


Your are pushing Org to rather hostile environment: highly automated 
attacks to distribute exploits, market of breached computers listening 
for remote commands. A running cryptominer would be rather innocent 
consequence, through the same backdoor you may receive an encryptor or 
various stuff searching for credentials and access tokens in your files.


Emacs is protected mostly by its low popularity. A lot of efforts have 
been invested in browser making attacks more expensive, but still 
attractive due to possible benefits. I do not like to increase surface 
for attacks. Someone may create a plugin targeting Emacs users just 
because it would be easy enough.


Consider converting Org files to HTML as an unpleasant tax for the sake 
of safety.



All I want is to access my personal read-only Org files by using WWW
and browse from one to the other by using links.


How are you going to distinguish your personal files and arbitrary files 
from non-trusted sources? By signing your files and maintaining list of 
trusted certificates?


For personal notes I would expect e.g. private instance of nextcloud 
file share (that is internally HTTP server), not accessing files 
directly through HTTP.




Error opening an .org file

2022-10-27 Thread Renato Pontefice
When I try to open a simple file in emacs, I receive this error

Warning (initialization): An error occurred while loading 
‘/Users/renatopontefice/.emacs.d/init.el’:

Invalid read syntax: ), 1, 0

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace. Disable showing 
Disable logging


So the prob is on my init.el file. What error it could be? 

Thank you

Renato


Re: [BUG] cant normally edit tables created with table-insert [9.5.2 (release_9.5.2-25-gaf6f12 @ c:/Program Files/Emacs/emacs-28.1/share/emacs/28.1/lisp/org/)]

2022-10-27 Thread Mati

Please provide more details on what you have tried.

M-x table-insert 5 columns 5 rows 15 cell width 1 height

Then enter something in first cell. press tab to go to next cell, but 
then message appears with C-c ’ (copy-pasted it from messages buffer) 
shortcut. I can edit table after pressing C-c ', in orgsrc mode, with 
very limited functionality and it just doesn't work well, table doesn't 
shrink after deleting text etc.


Also, I noticed that horizontal table lines (|-+-|) are not 
properly recognized too and instead of inserting new cells below line, 
they are inserted above when moving by . The funny part is that 
this works in emacs with my configuration loaded (valign-mode and 
variable pitch font might matter) so it works well when it could be 
expected to break, and is broken in pure emacs (but only horizontal 
lines, top and bottom border still breaks table even with valign). Of 
course with emacs -q I test on monospace font.



with point at the top left cell, after C-c ', I can  across cells
in the edit buffer.
Yes, in orgsrc mode (after clicking this shortcut, C-c ') it's possible, 
but it should work in org, also as I previously mentioned, orgsrc table 
editing is limited and doesn't work properly.


On 27.10.2022 05:36, Ihor Radchenko wrote:

ELECTRUM BIKES  writes:


Hi. Tables created in org-mode by inserting manually | works fine, but
if I use table-insert I can't manipulate table, I get "use C-c `"
notification in minibuffer when I click  to move to next cell.

"C-c '", not C-c `.


If I click C-c `, I get "not a table" response. In such tables I can
only insert text but not use shortcuts and they're generally broken. I
tried it on emacs -q and it looks it's not my configuration fault,
same behavior.

Please provide more details on what you have tried.

I tried


 +--+--++
 |  |  ||
 |  |  ||
 +--+--++
 |  |  |Text editing inside the table   |
 |  |  |cell produces reasonably|
 |  |  |expected results.-!-|
 +--+--++
 |  |  ||
 |  |  ||
 +--+--++

with point at the top left cell, after C-c ', I can  across cells
in the edit buffer.


Also, there seems to be problem with handling top and bottom borders,
if I insert
(for example, 3 column table) +-+-+ at the top or bottom of a working table,
it breaks to exactly same state as command-inserted tables, so probably
top and bottom border handling breaks tables (command created tables
does have this borders).

Sorry, I do not understand what you are referring two. Detailed steps
explaining what text you inserted and what key bindings you pressed
would help a lot.





Re: ob-clojure eval error when has comment at end of code line

2022-10-27 Thread Max Nikulin

On 27/10/2022 19:25, Daniel Kraus wrote:


- I wanted to add a test, how can I run only test-ob-clojure?


See testing/README

make BTEST_RE=ob-closure




Re: [PATCH] Fix ob-clojure handling source block variable's value is a org-mode table or list

2022-10-27 Thread Daniel Kraus
Hi!

Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>> Without this patch, it will report error "class 
>> java.lang.ClassCastException" from CIDER.
>
> Bastien, could you please take a look? I was unable to setup clojure dev
> environment on my machine for testing. So, I am not able to confirm if
> the issue exists.

Just in case you want to play around with Clojure, installing babashka
(https://github.com/babashka/babashka) is a single binary and very simple to 
install.

>>   ;; Variables binding.
>>   (if (null vars) (org-trim body)
>> -   (format "(let [%s]\n%s)"
>> -   (mapconcat
>> -(lambda (var)
>> -  (format "%S %S" (car var) (cdr var)))
>> -vars
>> -"\n  ")
>> -   body))
>> +   ;; variable's value is a list from org-mode passed table 
>> or list.
>> +   (if (listp (cdr (car vars)))
>
> This test is fishy. It only tests for the first variable assignment.
> What if you have multiple vars some being tables and some not?

I looked at `ob-lisp.el` and simply always quoting seems to be working.
See attached patch and here's my test (based from Chrisophers example):

--cut--

#+NAME: ob-clojure-table-test
| a | b | c |
|---+---+---|
| 1 | 2 | 3 |

#+NAME: ob-clojure-table-test-2
| a | b | c |
|---+---+---|
| 1 | 2 | 3 |
| 4 | 5 | 6 |

#+begin_src clojure :var v1=42 :var v2="foobar" :var v3=ob-clojure-table-test 
:var v4=ob-clojure-table-test-2 :results output
(prn (+ v1 5))
(prn v2)
(prn v3)
(prn v4)
#+end_src

#+RESULTS:
: 47
: "foobar"
: ((1 2 3))
: ((1 2 3) (4 5 6))

--cut--

Cheers,
  Daniel
>From 1a2fa382e7a5925d4b85d90f1fe4ac7c012f81a4 Mon Sep 17 00:00:00 2001
From: Daniel Kraus 
Date: Thu, 27 Oct 2022 16:04:02 +0200
Subject: [PATCH] lisp/ob-clojure.el: Fix header argument :var binding

* lisp/ob-clojure.el (org-babel-expand-body:clojure): Always quote
the variables passed from org-mode in clojure let binding.
When a variable is a table or list, it's value is is "(..data..)"
and without quotes, clojure would try to execute the first
value as a function.
---
 lisp/ob-clojure.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index 0649469b3..c76a3f013 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -132,7 +132,7 @@ or set the `:backend' header argument"
 		   (format "(let [%s]\n%s)"
 			   (mapconcat
 			(lambda (var)
-			  (format "%S %S" (car var) (cdr var)))
+			  (format "%S '%S" (car var) (cdr var)))
 			vars
 			"\n  ")
 			   body))
-- 
2.38.1



Re: ob-clojure eval error when has comment at end of code line

2022-10-27 Thread Daniel Kraus
Hi!

I had a look and apparently cider-eval returns nil when the expression
is a comment, vs the string "nil" when the Clojure expression returns nil.
Simply filtering nil values out seems to have fixed the issue
for me.
@Christopher, can you check the attached patch if this works for you?

@Ihor, a few developer related questions:
- I wanted to add a test, how can I run only test-ob-clojure?
  I don't think the tests work currently and I would fix them and add more.
- What should I use for indention? Looking in ob-clojure and org.el
  it seems that using tabs with tab-width 8 is standard but there's
  quite a few lines where it's spaces only.
- If this simple patch for example or fixing tests is good,
  should I just install it?
  Can I "freely" install minor changes to ob-clojure or should
  everything go over the mailinglist?

Thanks. I hope I can work a bit more on ob-clojure the next few days,
I think I missed a few emails, sorry. Now I have a filter rule where
mails with Clojure in the subject go to my inbox.

Cheers,
  Daniel
>From 87054023df0876d17771ee3885e7b1091ccdeab1 Mon Sep 17 00:00:00 2001
From: Daniel Kraus 
Date: Thu, 27 Oct 2022 14:16:33 +0200
Subject: [PATCH] lisp/ob-clojure.el: Fix bug with inline comments

* lisp/ob-clojure.el (ob-clojure-eval-with-cider): Filter out
  nil values from cider evaluation.
---
 lisp/ob-clojure.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el
index 0649469b3..eff8d04e4 100644
--- a/lisp/ob-clojure.el
+++ b/lisp/ob-clojure.el
@@ -239,7 +239,7 @@ or set the `:backend' header argument"
 		result0)))
   (ob-clojure-string-or-list
(reverse (delete "" (mapcar (lambda (r)
- (replace-regexp-in-string "nil" "" r))
+ (replace-regexp-in-string "nil" "" (or r "")))
    result0)))
 
 (defun ob-clojure-eval-with-slime (expanded params)
-- 
2.38.1


Ihor Radchenko  writes:

> "Christopher M. Miles"  writes:
>
>> I have following Clojure source block:
>>
>> #+begin_src clojure
>> (re-find #"\d+" "I've just finished reading Fahrenheit 451");; => "451"
>> (re-find #"Bees" "Beads aren't cheap.");; => nil
>> #+end_src
>>
>> When I press =[C-c C-c]= to evaluate source block, got error:
>>
>> When there is no comments behind code lines. No this error.
>>
>> #+begin_example
>> Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
>>   replace-regexp-in-string("nil" "" nil)
>
> Daniel, could you please take a look?


Re: couldn't org-table-create-with-table\.el respect hline

2022-10-27 Thread Ihor Radchenko
Uwe Brauer  writes:

> I start with 
>
>
>
> | Example | Text| Dates| other   |
> |-+-+--+-|
> | this| comment | <2022-01-28 vie> | nothing |
>
>
> That is converted to 
>
>
>
> +-+-+--+-+
> | Example | Text| Dates| other   |
> +-+-+--+-+
> | this| comment | <2022-01-28 vie> | nothing |
> +-+-+--+-+
>
>
> And is converted back to 
>
>
> | Example | Text| Dates| other   |
> | this| comment | <2022-01-28 vie> | nothing |
>
>
> Couldn't in the last step the hlines be respected?

That would not make sense.
AFAIK, table.el has no notion of hlines. The +---+ separators in
table.el tables mark cell boundaries, not hlines.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: Error on opening .orh file

2022-10-27 Thread Quiliro Ordóñez
El 2022-10-27 06:25, Renato Pontefice escribió:

> ‘/Users/renatopontefice/.emacs.d/init.el’:

Check this file.
 
> Invalid read syntax: ), 1, 0

Probably yo have a closing parenthesis without a corresponding opening
parenthis.



Error on opening .orh file

2022-10-27 Thread Renato Pontefice
I tried to open a file.org, but received this error
--
Warning (initialization): An error occurred while loading 
‘/Users/renatopontefice/.emacs.d/init.el’:

Invalid read syntax: ), 1, 0

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace. Disable showing 
Disable logging
———

I’ve start looking on my init.el file, but I didn’t find anythings. Can someone 
tell me what I can try to look for i.e. 
What does this error mean?

Thank you

Renato


Re: bug#58774: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Dr. Arne Babenhauserheide

Jean Louis  writes:

> * Andreas Schwab  [2022-10-27 11:03]:
>> On Okt 26 2022, Jean Louis wrote:
>> 
>> > With "predicate" do you mean URI scheme?
>> 
>> When I write predicate, I mean predicate.
>
> Can that predicate understand content type?

A predicate is a function that returns true or false.

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de


signature.asc
Description: PGP signature


Re: bug#58774: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Andreas Schwab
On Okt 27 2022, Jean Louis wrote:

> Can that predicate understand content type?

It can use whatever it needs to determine the handler.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



Re: bug#58774: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Dr. Arne Babenhauserheide

 writes:

> [[PGP Signed Part:Good signature from 05C82CF57AD1DA46 tomás zerolo (moep 
> moep)  (trust undefined) created at 
> 2022-10-27T06:25:44+0200 using DSA]]
> On Wed, Oct 26, 2022 at 11:16:15PM +0200, Dr. Arne Babenhauserheide wrote:
>
> [...]
>
>> > That is not business of web server, HTTP or browser. Those are
>> > delivery, retrieval and presentation tools
>> 
>> Yet there is so such separation between eww and org-mode.
>   
>
> I think this was a typo for "no".

Ah, yes, thank you! That should have been "no".

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de


signature.asc
Description: PGP signature


Re: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Dr. Arne Babenhauserheide

Jean Louis  writes:

> * Jean Louis  [2022-10-25 15:14]:
>> 
>> This wish request is related to Emacs EWW and Org mode.
>> 
>> Please make EWW recognize Org file when served by WWW server. Currently
>> it does not recognize the MIME type text/x-org and opens the file as
>> text, it does not invoke the org mode. In my opinion, it should.
>
> Now is clear that main problem here is that Org advertises somewhere
> to be "text" in MIME context, while it is not, it is by default
> "application" and thus unsafe, see:
>
> Application Media Types
> https://datatracker.ietf.org/doc/html/rfc6838#section-4.2.5
>
> and understand difference to:
>
> Text Media Types
> https://datatracker.ietf.org/doc/html/rfc6838#section-4.2.1
>
> Thus I suggest that Org changes its MIME type and stop falsely
> claiming to be "text" in MIME context, but that content type:
> "application/x-org" become adopted, as that way it will become clear
> that it is unsafe opening Org as falsely claimed "plain" text.

You are mixing up text/plain and text/*. Orgmode is clearly text/* but
not text/plain. From your link:

   Beyond plain text, there are many formats for representing what might
   be known as "rich text".  An interesting characteristic of many such
   representations is that they are to some extent readable even without
   the software that interprets them.  It is useful to distinguish them,
   at the highest level, from such unreadable data as images, audio, or
   text represented in an unreadable form.  In the absence of
   appropriate interpretation software, it is reasonable to present
   subtypes of "text" to the user, while it is not reasonable to do so
   with most non-textual data.  Such formatted textual data can be
   represented using subtypes of "text".

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de


signature.asc
Description: PGP signature


Re: bug#58774: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Dr. Arne Babenhauserheide

Tim Cross  writes:

> and people constantly use M-x package-install to install packages
> from GNU ELPA, nonGNU ELPA and MELPA, often with this misguided belief
> that these packages are being vetted by the security fairies. 

Yes, and no. There is still a world of a difference between "any random
website can attack me when I just navigate there" and "installing a
package may not be safe".

This is a false whatabout: That packages are not safe does not mean that
attacks by any random website aren’t much *more* dangerous.

> While adding the sorts of controls you outline is not a bad idea, I
> think it is far more important to train people to accept that their
> system simply is not secure.

This treats security as a boolean. It is not. The chance and impact of a
breach matter a lot, and any random website being able to exploit a
weakness in org-mode incleases the chance and impact a lot.

That Emacs is not perfect does not mean that it doesn’t matter if we
make it worse.

> You should start from the position that
> Emacs is not secure. Why? Because it is a large, complex and powerful
> piece of software which has no formal security analysis or testing and
> is usually augmented with numerous packages of unknown quality from
> largely unknown sources. Essentially, Emacs already suffers from all the
> same issues identified for systems like node and the NPM ecosystem. 

Yes. We should avoid adding *one more* issue that is actually worse than
the others.

And yes, we should rather reduce the number of packages we rely on. I’ve
done that multiple times in the past.

> The only think which is really providing protection for us Emacs users
> is that the rewards for compromising Emacs are too low for the effort
> required. Similar to why you don't see many viruses on macOS - it isn't
> that it is significantly more secure than Windows (these days), but
> rather the pool of potential 'targets' and scale of rewards are higher
> when you focus on the Windows environment. It is all about return on 
> investment.

This is no longer true about macOS. It has grown to be a large target,
but it still is hard to crack.

Windows became safer by starting to add safeguards (like asking the user
for admin rights before doing admin stuff — essentially sudo) and taking
security seriously.

> update after formal review and testing of updated version, don't use
> Emacs for email or web browsing, only run emacs in an isolated locked

The point here is: Without auto-switching to org-mode, using emacs for
web browsing is likely reasonably safe. Adding this as default would
remove that.

> Even if you decide your risks are low, you may still decide to not use
> Emacs for some purposes. For example, you might decide not to use Emacs
> for password management or not use Emacs packages which require you to
> keep sensitive data (toekns, passwords, API keys etc) using insecure
> mechanisms etc.

You describe that whenever we do not care about security for some
mechanism, this removes this part of Emacs from the features people with
some security needs can use.

It breaks the integration of Emacs — which is one of its biggest
strengths — if we have to say “for convenience we enabled opening any
web document automatically in org-mode, so if you think that unsafe,
don’t browse the web with Emacs *anymore*”.

As secure as we can should be the default, not "change these random
configuration settings and avoid those features to get some security".

Best wishes,
Arne
-- 
Unpolitisch sein
heißt politisch sein,
ohne es zu merken.
draketo.de


signature.asc
Description: PGP signature


Re: [BUG] Fill-paragraph issue with hidden emphasis markers and composed characters

2022-10-27 Thread Ihor Radchenko
Ihor Radchenko  writes:

>> 4. Hit M-q (either fill-paragraph or org-fill-paragraph, both have the same
>> issue)
>> The first line wrongly wraps after "buggy" and leaves a big empty space
>> after that, as if the greek letters were not composed.
>
> Confirmed.
> This appears to be Emacs bug though.
> I reported it in https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58791
> Let's see what Emacs devs reply.

The bug has been fixed on Emacs side (on master).
As a result of the fix, filling works as expected in Org as well.

So, this issue will disappear when using Org with next Emacs 29 release.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at 



Re: bug#58774: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Jean Louis
* Andreas Schwab  [2022-10-27 11:03]:
> On Okt 26 2022, Jean Louis wrote:
> 
> > With "predicate" do you mean URI scheme?
> 
> When I write predicate, I mean predicate.

Can that predicate understand content type?

Do you have an example?

--
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/




Re: [PATCH] org-manual: Suggest to wait for one month and followup when reporting bugs

2022-10-27 Thread Bastien Guerry
Hi Ihor,

Ihor Radchenko  writes:

> I think we can expose our mailing list policy a bit more in the manual.

Yes, I think this is a good idea.

FWIW, the next version of Woof! (on which I'm focusing right now) will
sending various reminders about things to do, but making the current
policy more apparent to every user is still good.

-- 
 Bastien



Re: bug#58774: 29.0.50; [WISH]: Let us make EWW browse WWW Org files correctly

2022-10-27 Thread Andreas Schwab
On Okt 26 2022, Jean Louis wrote:

> With "predicate" do you mean URI scheme?

When I write predicate, I mean predicate.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."



Getting X selection reliably (Re: idea for capture anywhere in x)

2022-10-27 Thread Max Nikulin

On 26/10/2022 11:58, Ihor Radchenko wrote:


Yes. From org-capture-templates docstring:

   %x  Content of the X clipboard.


Ihor, I am afraid there are a couple of pitfalls with "%x" for Samuel 
since he prefers to keep Emacs hidden so can not check result.


1. If something goes wrong, e.g. some application does not put 
highlighted text to PRIMARY selection then wrong source (CLIPBOARD) or 
empty string may be silently captured. I would prefer explicit source 
however it will not protect against stale selection from the same source.


Simulate empty selection:
echo | xsel -bi ; echo | xsel -i ; killall xsel

2. Jean pointed out that Emacs ignores X selection if it does not have 
an X frame. It was almost buried in the haystack of "SQL instead of Org" 
noise. It happens if Emacs is running as a daemon. I am unsure which way 
Samuel starts Emacs (xinit, systemd user session, systemd socket 
activation, manually, etc.)


What I do not like that error text is captured and no error is returned 
to emacsclient, so checks must be performed in advance.


My suggestion:
~/examples/org/capture-daemon.el
 >8 
(defun nm-check-selection (selection)
  (let ((display (org-string-nw-p (getenv "DISPLAY"
(if display
(server-select-display display)
  (error "No DISPLAY")))
  (if (org-get-x-clipboard selection)
  t
(error "No %S selection" selection)))

(custom-set-variables
 '(org-capture-templates
   '(("x" "%x (test)" entry
  (file "/tmp/capture-test.org")
  "* Entry
%U

%x
"
  :immediate-finish t)
 ("p" "primary" entry
  (file "/tmp/capture-test.org")
  "* Primary
%U

%(org-get-x-clipboard 'PRIMARY)
"
   :immediate-finish t

(require 'org-capture)
 8< 

emacs -Q -L ~/src/org-mode/lisp/ \
   -L /usr/share/emacs/site-lisp/elpa/htmlize-1.55/ \
   --daemon --load ~/examples/org/capture-daemon.el

emacsclient --eval "(nm-check-selection 'PRIMARY)" \
   --eval '(org-capture nil "p")'

the latter command has non-zero exit code in the case of empty selection.