Microsoft Excel getting features we have had for a long time in org :-)

2021-01-28 Thread Eric S Fraga
Interesting:
https://www.microsoft.com/en-us/research/blog/lambda-the-ultimatae-excel-worksheet-function/

(somebody doesn't know how to spell ultimate?)

I still would rather work with text than in a GUI and in Lisp than
Excel's language (whatever that may actually be) but good to see.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.4-199-gbc511b



Bug: Bad behavior of refill-mode at end of org-mode file [9.4.4 (9.4.4-11-g9e8215-elpa @ /home/joh/.emacs.d/elpa/org-20210118/)]

2021-01-28 Thread Johannes Mueller
When using refill-mode in combination with org-mode adding a new section or a
list item at the end of the buffer, obviously because refill-mode steps in and
deletes the line break before the headline marker or the list marker.

Steps to reproduce:

1. Launch emacs -Q
2. Open a empty buffer and activate org-mode and refill-mode
3. Type `* This is a headline`

Expected behavior:

Buffer contents should be
```
* This is a headline
*
```

Actual behavior:

Buffer contens is
```
* this is a headline *
```

Obviously right after typing  and thus inserting +"*"
refill-mode steps in and interprets the second line as part of the paragraph.

Remarks:

* The problem does not occur when there is text after the place where the new
headline is inserted

* The problem occurs with any kinds of headlines as well as with list items.


I tried to tweak paragraph-start, but I was not able to get the behavior I was
expecting.


Emacs  : GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.22, 
cairo version 1.17.3)
 of 2020-08-28
Package: Org mode version 9.4.4 (9.4.4-11-g9e8215-elpa @ /home/joh/.emacs.d/
elpa/org-20210118/)






Bug: CLOCKSUM works first time, fails second time when used in column view

2021-01-28 Thread Joshua Hartshorne
I recently upgraded emacs and org-mode and now I'm getting a strange error
that looks more or less identical to this old report (
https://lists.gnu.org/archive/html/emacs-orgmode/2012-02/msg00181.html),
although their minimal example works for me.

I have my overall setup below, but here's the setup for column view:

(setq
org-columns-default-format "%60ITEM(Task) %6Effort(Estim){:}
%9CLOCKSUM(Clock){:} %9CLOCKSUM_T(Today){:}
%8ASSIGNED_EFFORT(Assigned){:} %8HELD_EFFORT(Held){:} %10SCHEDULED")
;Column View columns

(setq org-time-clocksum-format
  '(:hours "%d" :require-hours t :minutes ":%02d" :require-minutes t))
;sum in hours, not days.
(setq org-agenda-columns-add-appointments-to-effort-sum t);so appointments
are counted towards effort




With a fairly basic stack of tasks like:

* Tasks
   :LOGBOOK:
   CLOCK: [2012-02-03 Fri 17:02]--[2012-02-03 Fri 18:02] =>  0:00
   :END:
** TODO Task A
   :LOGBOOK:
   CLOCK: [2012-02-03 Fri 17:02]--[2012-02-03 Fri 18:02] =>  0:00
   :END:
   :PROPERTIES:
   :Effort:   0:30
   :END:
** TODO Task B
   :PROPERTIES:
   :Effort:   1:00

   :END:

column view will work a few times and then suddenly it won't work anymore,
saying: "The CLOCKSUM property can not be set with `org-entry-put"

Deleting the top-level task (e.g., "Tasks") and replacing it will start the
process over.



Emacs  : GNU Emacs 27.1 (build 1, x86_64-apple-darwin18.7.0, NS
appkit-1671.60 Version 10.14.6 (Build 18G95))
 of 2020-08-12
Package: Org mode version 9.4.4 (release_9.4.4-186-g7fa817 @
/Users/jkhartshorne/.emacs.d/straight/build/org/)

current state:
==
(setq
 org-src-mode-hook '(org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
 org-after-todo-state-change-hook '(org-checklist)
 org-agenda-tags-column -102
 org-columns-default-format "%60ITEM(Task) %6Effort(Estim){:}
%6CLOCKSUM(Clock){:} %6CLOCKSUM_T(Today){:} %8ASSIGNED_EFFORT(Assigned){:}
%8HELD_EFFORT(Held){:} %10SCHEDULED"
 org-link-shell-confirm-function 'yes-or-no-p
 org-metadown-hook '(org-babel-pop-to-session-maybe)
 org-agenda-tags-todo-honor-ignore-options t
 org-clock-out-hook '(org-clock-remove-empty-clock-drawer
bh/clock-out-maybe)
 org-refile-targets '((refile-targets :todo . "TODO"))
 org-speed-commands-user '(("0" . ignore) ("1" . ignore) ("2" . ignore)
("3" . ignore) ("4" . ignore) ("5" . ignore)
  ("6" . ignore) ("7" . ignore) ("8" . ignore) ("9" . ignore) ("a" .
ignore) ("d" . ignore)
  ("h" . bh/hide-other)
  ("i" progn (forward-char 1) (call-interactively
'org-insert-heading-respect-content))
  ("k" . org-kill-note-or-show-branches) ("l" . ignore) ("m" . ignore) ("q"
. bh/show-org-agenda)
  ("r" . ignore) ("s" . org-save-all-org-buffers) ("w" . org-refile) ("x" .
ignore) ("y" . ignore)
  ("z" . org-add-note) ("A" . ignore) ("B" . ignore) ("E" . ignore) ("F" .
bh/restrict-to-file-or-follow)
  ("G" . ignore) ("H" . ignore) ("J" . org-clock-goto) ("K" . ignore) ("L"
. ignore) ("M" . ignore)
  ("N" . bh/narrow-to-org-subtree) ("P" . bh/narrow-to-org-project) ("Q" .
ignore) ("R" . ignore)
  ("S" . ignore) ("T" . bh/org-todo) ("U" . bh/narrow-up-one-org-level)
("V" . ignore) ("W" . bh/widen)
  ("X" . ignore) ("Y" . ignore) ("Z" . ignore))
 org-enforce-todo-dependencies 1
 org-clock-report-include-clocking-task t
 org-tag-alist '(("sdm" . 115) ("@BC" . 66) ("@MIT" . 77) ("@home" . 104)
("ThisTerm" . 116) ("household") ("aAI" . 97)
("aProgramming" . 112) ("aWriting" . 119) ("aBuying" . 98) ("REFILE" . 114))
 org-modules '(org-bbdb org-bibtex org-docview org-gnus org-habit org-info
org-irc org-mhe org-rmail org-w3m)
 org-blocker-hook '(org-block-todo-from-children-or-siblings-or-parent
org-depend-block-todo)
 org-mode-hook '(org-clock-load (lambda nil (define-key org-mode-map (kbd
"C-c C-x l") 'org-mac-grab-link))
(lambda nil (run-hooks 'prelude-org-mode-hook))
#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook
org-show-all append local] 5]
#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook
org-babel-show-result-all append local] 5]
org-babel-result-hide-spec org-babel-hide-all-hashes)
 org-clock-persist t
 org-yank-adjusted-subtrees t
 org-outline-path-complete-in-steps nil
 org-archive-hook '(org-attach-archive-delete-maybe)
 org-confirm-elisp-link-function 'yes-or-no-p
 org-startup-indented 1
 org-clock-history-length 23
 org-agenda-skip-timestamp-if-done t
 org-agenda-before-write-hook '(org-agenda-add-entry-text)
 org-metaup-hook '(org-babel-load-in-session-maybe)
 org-babel-pre-tangle-hook '(save-buffer)
 org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
 org-agenda-time-grid '((daily today remove-match) (900 1100 1300 1500
1700) "  " "")
 org-log-done t
 org-clock-in-resume t
 org-checklist-expo

bug#44824: 27.1; Org export as pdf and open file does not open it

2021-01-28 Thread gbio...@gmail.com

Il 27/01/2021 04:36, Lars Ingebrigtsen writes:

"gbio...@gmail.com"  writes:


Executing the command "xdg-open /path/to/file.pdf" in a terminal
(Konsole) works.

Executing the same command in Emacs via eshell DOES NOT WORK.

What happens if you execute that command in Emacs via eshell?



The same as using C-c C-e l o
"The default PDF program (okular) appears to open (i see the icon, but not
the window) and closes without showing anything."






bug#44824: 27.1; Org export as pdf and open file does not open it

2021-01-28 Thread Maxim Nikulin
I hope, the following link to another emacs-orgmode mail list archive 
will not be mangled by the debbugs web interface, unlike the previous one:

https://lists.gnu.org/archive/html/emacs-orgmode/2021-01/msg00327.html






bug#44824: 27.1; Org export as pdf and open file does not open it

2021-01-28 Thread gbio...@gmail.com

Il 28/01/2021 04:02, Lars Ingebrigtsen writes:

"gbio...@gmail.com"  writes:


The same as using C-c C-e l o
"The default PDF program (okular) appears to open (i see the icon, but not
the window) and closes without showing anything."

If I do

$ xdg-open ./doc/lispintro/cons-2.pdf

after `M-x shell', "Document Viewer" is opened as normal.

You don't get any output from xdg-open or anything in the shell buffer?

Glenn Morris  writes:


Ref eg https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25234#8
https://bugzilla.gnome.org/show_bug.cgi?id=652262
https://gitlab.gnome.org/GNOME/glib/-/issues/1208
and others going back over a decade.
I think Emacs should have a PROBLEMS entry about this.

Yeah, calling xdg-open (and expecting it not to exit) is a known
problem, but here it seems that xdg-open doesn't even work from *shell*,
which is very odd.



More info:

As per bug 25234, using 'M-! xdg-open /tmp/test.pdf', 'M-& xdg-open 
/tmp/test.pdf'

and 'M-& xdg-open /tmp/test.pdf && sleep 3' I get same results as reported.

If I try in eshell buffer 'xdg-open /tmp/test.pdf && sleep 3' my cursor 
blinks

with the Okular icon for a few seconds and then nothing happens.





bug#44824: 27.1; Org export as pdf and open file does not open it

2021-01-28 Thread gbio...@gmail.com

Il 28/01/2021 04:02, Lars Ingebrigtsen ha scritto:

"gbio...@gmail.com"  writes:


The same as using C-c C-e l o
"The default PDF program (okular) appears to open (i see the icon, but not
the window) and closes without showing anything."

If I do

$ xdg-open ./doc/lispintro/cons-2.pdf

after `M-x shell', "Document Viewer" is opened as normal.

You don't get any output from xdg-open or anything in the shell buffer?

Glenn Morris  writes:


Ref eg https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25234#8
https://bugzilla.gnome.org/show_bug.cgi?id=652262
https://gitlab.gnome.org/GNOME/glib/-/issues/1208
and others going back over a decade.
I think Emacs should have a PROBLEMS entry about this.

Yeah, calling xdg-open (and expecting it not to exit) is a known
problem, but here it seems that xdg-open doesn't even work from *shell*,
which is very odd.



I have no more ideas.
The problem arise even exporting and opening html, so it's not the file 
type.


Doing a better search I found this:
https://forum.manjaro.org/t/xdg-open-or-kde-open-doesnt-work-when-called-from-emacs/39918

Same problem, but without an answer.

If needed I can make a video of what happen (if so please explain where 
to upload it).






bug#44824: 27.1; Org export as pdf and open file does not open it

2021-01-28 Thread Maxim Nikulin

On 28/01/2021 18:31, gbio...@gmail.com wrote:


If I try in eshell buffer 'xdg-open /tmp/test.pdf && sleep 3' my cursor 
blinks

with the Okular icon for a few seconds and then nothing happens.


If I correctly get what you describe as "blinks", it could last for some 
time after process failure. On the other hand I am surprised that no 
other diagnostics is shown as a KDE dialog or as an error message in the 
eshell buffer. In the case of eshell, it is likely another problem, not 
killing handler with SIGHUP due to instantly closed pty.


What happens if you run the following commands in the Emacs *eshell 
buffer* (with an existing PDF file, of course)? In particular I am 
interested in output appeared in the buffer.


1. okular /tmp/test.pdf

2. kde-open5 /tmp/test.pdf

3. sh -x /usr/bin/xdg-open /tmp/test.pdf

I'm almost sure that okular is configured as the handler, but just to 
confirm it:


4. xdg-mime query default application/pdf

I assume that PDF file is a valid one (not corrupted, not empty, not 
accessible due to file permissions, etc.) since okular is able to report 
such problems.


You could also attach to emacs process with strace, try to launch 
handler, kill strace, and inspect log file which processes are spawned 
("execve" lines) and their exit codes. Run strace from ordinary terminal 
(not from emacs) with proper process ID:


strace -o /tmp/emacs.strace -f -s 128 -tt -p PID_OF_EMACS_PROCESS





Re: [PATCH] ob-java: Allow import to end with asterisk

2021-01-28 Thread John Herrlin

ian martins  writes:

>> I found this case:
>> And it seems to me that the import regex dont see the asterisk.
>>
>> I attached a possible patch.
>
> Thanks again, John.  You're right the regex is missing the asterisk
> include. Thanks for the patch fixing. This works but it will add
> redundant includes if the source block includes something that is also
> in the list of classes to automatically include.
>
> for example, this:
>
> #+begin_src java :results value
>   import java.util.*;
>   return "test";
> #+end_src
>
> will end up pulling in
>
> import java.util.List;
> import java.util.*;
>
> It wouldn't hurt anything, but could probably be prevented by changing
> the regexp in =org-babel-java--import-maybe= to look for asterisk as
> well as =class=.  Do you feel like updating the patch?
>
> [1] https://code.orgmode.org/bzg/org-mode/src/master/lisp/ob-java.el#L314

Here is an updated patch. It seems to work on my cases.

Of topic, I am very happy with the latest updates on ob-java and I think
it works really good! Thanks for the awesome work Ian!

Stay safe!

>From 92c72792fb18a73572ee35d34a5e1d5ce56d8b6a Mon Sep 17 00:00:00 2001
From: John Herrlin 
Date: Tue, 26 Jan 2021 08:19:19 +0100
Subject: [PATCH] ob-java: Allow import to end with asterisk

* lisp/ob-java.el (org-babel-java--imports-re,
org-babel-java--import-maybe): Allow import to end with asterisk.

TINYCHANGE
---
 lisp/ob-java.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-java.el b/lisp/ob-java.el
index 07ff8e9ab..1f2b980f6 100644
--- a/lisp/ob-java.el
+++ b/lisp/ob-java.el
@@ -88,7 +88,7 @@ like javac -verbose."
   "Regexp for the package statement.")
 (defconst org-babel-java--imports-re (rx line-start (0+ space) "import"
  (opt (1+ space) "static")
-	 (1+ space) (group (1+ (in alnum ?_ ?.))) ; capture the fully qualified class name
+	 (1+ space) (group (1+ (in alnum ?_ ?. ?*))) ; capture the fully qualified class name
 	 (0+ space) ?\; line-end)
   "Regexp for import statements.")
 (defconst org-babel-java--class-re (rx line-start (0+ space) (opt (seq "public" (1+ space)))
@@ -311,7 +311,8 @@ RESULT-FILE is the temp file to write the result."
 (goto-char (point-min))
 (setq class-found (re-search-forward class nil t))
 (goto-char (point-min))
-(setq import-found (re-search-forward (concat "^import .*" package ".*" class ";") nil t))
+(setq import-found
+  (re-search-forward (concat "^import .*" package ".*\\(?:\\*\\|" class "\\);") nil t))
 (when (and class-found (not import-found))
   (org-babel-java--move-past org-babel-java--package-re)
   (insert (concat "import " package "." class ";\n")
-- 
2.30.0



bug#44824: 27.1; Org export as pdf and open file does not open it

2021-01-28 Thread Lars Ingebrigtsen
"gbio...@gmail.com"  writes:

>> Yeah, calling xdg-open (and expecting it not to exit) is a known
>> problem, but here it seems that xdg-open doesn't even work from *shell*,
>> which is very odd.
>
> More info:
>
> As per bug 25234, using 'M-! xdg-open /tmp/test.pdf', 'M-& xdg-open
> /tmp/test.pdf'
> and 'M-& xdg-open /tmp/test.pdf && sleep 3' I get same results as reported.

I'm not quite sure what you mean here.  Do you mean that
`M-! xdg-open /tmp/test.pdf' works fine, or that it fails?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





bug#44824: 27.1; Org export as pdf and open file does not open it

2021-01-28 Thread Geraldo Biotti
Il ven 29 gen 2021, 05:51 Lars Ingebrigtsen  writes:

> "gbio...@gmail.com"  writes:
>
> >> Yeah, calling xdg-open (and expecting it not to exit) is a known
> >> problem, but here it seems that xdg-open doesn't even work from *shell*,
> >> which is very odd.
> >
> > More info:
> >
> > As per bug 25234, using 'M-! xdg-open /tmp/test.pdf', 'M-& xdg-open
> > /tmp/test.pdf'
> > and 'M-& xdg-open /tmp/test.pdf && sleep 3' I get same results as
> reported.
>
> I'm not quite sure what you mean here.  Do you mean that
> `M-! xdg-open /tmp/test.pdf' works fine, or that it fails?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
>bloggy blog: http://lars.ingebrigtsen.no


I get the same results reported in bug 25234. 'M-! xdg-open /tmp/test.pdf'
works fine. I apologise for my english but it's not my mother language.


>