Storing ID-links before first heading uses title as description

2021-02-06 Thread Gustav Wikström
Just committed to master (be2966abb5) 

Storing links to files using ~org-store-link~ (==) when
~org-id-link-to-org-use-id~ is not nil will now store the title as
description of the link, if available.  If no title exists it falls
back to the filename as before.

Best
Gustav


Re: na=\"nil\" in ob-R.elo

2021-02-06 Thread Jeremie Juste

Hello,

Thanks again for reporting this. With the attached patch I'll remove
nil replacement for NA. 

>From 90881079d431a8af3cba5be14ecf882735ed7a6a Mon Sep 17 00:00:00 2001
From: Jeremie Juste 
Date: Sat, 6 Feb 2021 20:50:00 +0100
Subject: [PATCH] For :results value, return empty string instead of nil

---
 lisp/ob-R.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-R.el b/lisp/ob-R.el
index f6fa9a417..981f21119 100644
--- a/lisp/ob-R.el
+++ b/lisp/ob-R.el
@@ -349,7 +349,7 @@ Each member of this list is a list with three members:
 {
 tfile<-tempfile()
 write.table(object, file=tfile, sep=\"\\t\",
-na=\"nil\",row.names=%s,col.names=%s,
+na=\"\",row.names=%s,col.names=%s,
 quote=FALSE)
 file.rename(tfile,transfer.file)
 },
-- 
2.20.1


Best regards,
Jeremie

On Saturday, 16 Jan 2021 at 00:19, Berry, Charles" via "General discussions 
about Org-mode. wrote:
>> On Jan 14, 2021, at 3:42 PM, Brett Presnell  wrote:
>> 
>> 
>> Probably a silly question, but in ob-R.el, what is the reason for
>> setting na=\"nil\" when defining org-babel-R-write-object-command?  Is
>> this an elisp compatibility thing?
>> 
>
> I don't get it either. The value corresponding to the NA becomes a string in 
> emacs-lisp whether \"nil\" or \"\" is used.
>
> So when passed to elisp via a :post header referencing an emacs-lisp src 
> block, its treated as a string.   
>
>> Regardless, I generally (always?) want na=\"\" for this, so I am finding
>> all those "nil"s very annoying, and the only way that I see to defeat
>> them is to redefine org-babel-R-write-object-command.
>> 
>> If there is no reason for the current behavior (doubtful I know) and if
>> I am not missing an obvious work-around, then I would like to suggest
>> changing this behavior.  Otherwise, would it be feasible to add an
>> option for R code blocks (:nastring?) where one could specify the NA
>> replacement string?
>> 
>> What do you think?  It's easy to suggest I know and certainly beyond my
>> elisp coding skills at present, but I am supposing that someone more
>> fluent in elisp could do this safely without too much trouble.
>> 
>
> You can use a :post header to customize outputs like this to make them more 
> pleasing. Or just use your own `org-babel-R-write-object-command'.
>
> Adding another header arg qualifies as feature creep and in this case would 
> require non-trivial work to implement.
>
> HTH,
>
> Chuck
>

-- 
Jeremie Juste


Re: [Resolved]Re: OT: M-S-$ Not Working

2021-02-06 Thread Bo Grimes
On Sat, 6 Feb 2021 22:52:17 +0700
Maxim Nikulin  wrote:

> On 06/02/2021 00:38, Bo Grimes wrote:
> > 
> > I have no idea what 3rd level is, but before I ticked it I turned
> > off my number lock, and C-S-$ worked!  So I ticked it and it stopped
> > working.  So I unticked it and ticked Number keypad always enters
> > digits, which is, of course, why I use Num Lock to begin with.  
> 
> Definitely "xev" is your friend if your want to realize actual effect
> of such changes, along with "setxkbmap -query" (or "setxkbmap
> -print") and "xkbcomp -xkb :0 -".
> 
> 3rd level is intended to type some characters absent in regular
> layout using a special modifier key. Personally I use 2 keyboard
> layouts and compose key for some symbols that are not directly
> available, so I do not need 3rd level as well.
> 
> > With that ticked Emacs behaves as expected.  I have always used Num
> > Lock and never had that problems  
> 
> You could have a look into /usr/share/X11/xkb/rules/evdev.lst 
> /usr/share/X11/xkb/symbols/keypad /usr/share/X11/xkb/types/numpad
> files. If I do not mistake, $ is mapped for keypad with
> keypad:oss_wang option. Likely you could achieve what you want with
> custom Xkb configuration. I have not tried such tricks however. The
> most comprehensive guide on Xkb, I have seen, was in Russian. Its
> English variant is incomplete, the author's site is down. 
> https://web.archive.org/web/20121108145326/http://pascal.tsu.ru/en/xkb/
> 
> X Keyboard Extension Protocol and library specifications could be
> hard to read, XKB Configuration Guide hosted on x.org is too brief.
> 
> P.S. Have you checked that it is possible to swap Ctrl and Caps in 
> wayland session? If not it is likely worth filing a bug. It seems 
> wayland will be default soon. Some Xkb stuff is already broken in
> gnome (rather intentionally). My first experience with wayland was
> that it took enough time to realize why I could not authenticate. Gdm
> was using wayland by default and in password fields (hidden input!)
> shift does not allow several capital letters in a row.
> 
> 

Completely missed this.  Thanks!  I'm using Claws ATM because I'm still
setting up Mu4e, with which I will capture this into a org file for
later reference and notes.  I would love to be able to help file a bug
report, so I will *definitely* do this after I get my Emacs set-up fully
on this new OS!

Cheers,
Bo Grimes



Re: OT: M-S-$ Not Working

2021-02-06 Thread Tim Cross


Maxim Nikulin  writes:

> On 06/02/2021 13:28, Tim Cross wrote:
>>
>> In general, standard Emacs key bindings are robust and reliable. If a
>> standard key binding like M-S $ doesn't work, first step is to try emacs
>> -Q.
>
> Sorry, but I do not agree that key bindings are robust in emacs. I use
> English and Russian keyboard layouts. Last years most of application
> could handle shortcuts independently of active layout (E.g. Ctrl+C and
> Ctrl+V works for copy-paste even if Russian layout is currently chosen.)
> In Emacs, only Control + Latin C works, Control + Cyrillic S (the same
> physical key) is undefined. Location of punctuation symbols depends on
> active layout, "$" is absent in Russian layout at all. It is extremely
> inconvenient to switch to US layout before any shortcut. Emacs uses its
> own input methods, but it means that desktop environment should treat
> emacs in a special way in respect to keyboard layouts. I have a kind of
> solution, I found its variants in blog posts. It is quite tricky, so I
> do not consider it as reliable and suitable for any user.

As I'm limited by the weakness of only understanding one alphabet, I
don't have any experience of things once you move away from an 'english'
based alphabet. However, I do find it surprising there isn't a simpler
solution to switch between the different layouts in a consistent way
which updates key bindings to something appropriate. I've not seen many
editors with the same level of support for different alphabets and
writing direction as Emacs and there are many keyborad layouts which
don't include the '$' key. At the end of the day, it really just comes
down to mapping of key codes - the 'image' on the key itself (and even
the location) is largely irrelevant. I imagine 'live' switching between
different input methods could be very complicated, but making the
complicated easy is something Emacs tends to be good at.

Were you able to get any assistance with this on the Emacs devel list?
Like it or not, computers are very english centric (and US english at
that). Maybe the issues you have encountered just need to be highlighted
and for there to be someone able to assist to enable the situation to be
improved? It may be a simple as improving the mapping of key codes and
tweaking the key translation table to improve the situation? If you
haven't done so, I would encourage you to start a new thread on
emacs-devel where you outline your key binding issues. I have frequently
found solutions on blogs and other forums only to find later there is a
far easier solution. I would expect many Russian speaking users have
encountered the same challenges. The Emacs devs have always seemed
pretty open to improving support for different languages and character
sets and once they understand the issue, will typically respond with
improvements fairly quickly provided someone is will ing to help test
etc. The hard part is defining the issue - once it is understood, a
solution is often not too far away.

--
Tim Cross



[PATCH] ob-sql.el: Add support for SAP HANA

2021-02-06 Thread Robin Campbell Joy
* lisp/ob-sql.el (org-babel-execute:sql, org-babel-sql-dbstring-saphana):
Add basic support for SAP HANA to SQL blocks
* testing/lisp/test-ob-sql.el: Basic tests for generated db connection
string

This change adds basic support for SAP HANA to SQL blocks by
specifying saphana as :engine.

It also adds a new header arg `dbinstance' in order to specify the SAP
HANA instance to connect to.

Signed-off-by: Robin Campbell Joy 
---
 lisp/ob-sql.el  |  25 ++-
 testing/lisp/test-ob-sql.el | 382 
 2 files changed, 406 insertions(+), 1 deletion(-)
 create mode 100644 testing/lisp/test-ob-sql.el

diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
index 902194ae8..5398c85aa 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -40,6 +40,7 @@
 ;; - dbuser
 ;; - dbpassword
 ;; - dbconnection (to reference connections in sql-connection-alist)
+;; - dbinstance
 ;; - database
 ;; - colnames (default, nil, means "yes")
 ;; - result-params
@@ -58,6 +59,7 @@
 ;; - postgresql (postgres)
 ;; - oracle
 ;; - vertica
+;; - saphana
 ;;
 ;; TODO:
 ;;
@@ -85,6 +87,7 @@
 (dbport   . :any)
 (dbuser   . :any)
 (dbpassword   . :any)
+(dbinstance   . :any)
 (database   . :any))
   "SQL-specific header arguments.")

@@ -174,6 +177,18 @@ SQL Server on Windows and Linux platform."
   (when database (format "-d %s" database
   " "))

+(defun org-babel-sql-dbstring-saphana (host port instance user password
database)
+  "Make SAP HANA command line args for database connection. Pass nil to
omit that arg."
+  (mapconcat #'identity
+ (delq nil
+   (list (when (and host port) (format "-n %s:%s" host
port))
+ (when (and host (not port)) (format "-n %s" host))
+ (when instance (format "-i %d" instance))
+ (when user (format "-u %s" user))
+ (when password (format "-p %s"
(shell-quote-argument password)))
+ (when database (format "-d %s" database
+ " "))
+
 (defun org-babel-sql-convert-standard-filename (file)
   "Convert FILE to OS standard file name.
 If in Cygwin environment, uses Cygwin specific function to
@@ -197,6 +212,7 @@ database connections."
  (:dbport . sql-port)
  (:dbuser . sql-user)
  (:dbpassword . sql-password)
+ (:dbinstance . sql-dbinstance)
  (:database . sql-database)))
  (mapped-name (cdr (assq name name-mapping
 (cadr (assq mapped-name
@@ -212,6 +228,7 @@ This function is called by
`org-babel-execute-src-block'."
  (dbport (org-babel-find-db-connection-param params :dbport))
  (dbuser (org-babel-find-db-connection-param params :dbuser))
  (dbpassword (org-babel-find-db-connection-param params
:dbpassword))
+ (dbinstance (org-babel-find-db-connection-param params
:dbinstance))
  (database (org-babel-find-db-connection-param params :database))
  (engine (cdr (assq :engine params)))
  (colnames-p (not (equal "no" (cdr (assq :colnames params)
@@ -276,6 +293,12 @@ footer=off -F \"\t\"  %s -f %s -o %s %s"
   dbhost dbport dbuser dbpassword database)
  (org-babel-process-file-name in-file)
  (org-babel-process-file-name out-file)))
+(saphana (format "hdbsql %s -I %s -o %s %s"
+ (org-babel-sql-dbstring-saphana
+  dbhost dbport dbinstance dbuser dbpassword database)
+ (org-babel-process-file-name in-file)
+ (org-babel-process-file-name out-file)
+ (or cmdline "")))
 (t (user-error "No support for the %s SQL engine"
engine)
 (with-temp-file in-file
   (insert
@@ -309,7 +332,7 @@ SET COLSEP '|'
  (progn (insert-file-contents-literally out-file) (buffer-string)))
   (with-temp-buffer
  (cond
- ((memq (intern engine) '(dbi mysql postgresql postgres sqsh vertica))
+ ((memq (intern engine) '(dbi mysql postgresql postgres saphana sqsh
vertica))
   ;; Add header row delimiter after column-names header in first line
   (cond
(colnames-p
diff --git a/testing/lisp/test-ob-sql.el b/testing/lisp/test-ob-sql.el
new file mode 100644
index 0..51edd2309
--- /dev/null
+++ b/testing/lisp/test-ob-sql.el
@@ -0,0 +1,382 @@
+;;; test-ob-sql.el --- tests for ob-sql.el
+
+;; Copyright (C) 2021 Robin Joy
+
+;; Author: Robin Joy 
+;; Keywords: lisp
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU Gene

org-no-popups nilling display-buffer-alist

2021-02-06 Thread "Joshua O'Connor"
Hi,
I wanted to control the positioning of the *Org Select* buffer, so I
first went to add a rule to 'display-buffer-alist'.
But I found it didn't work, as the function in question calls
'org-switch-to-buffer-other-window', which in turn calls an odd macro
'org-no-popups', which appears to let-nil the 'display-buffer-alist'.

I was wondering what the reason is for this? To me I expected this
variable to be reserved for me as a user to choose where windows can go,
which I think is a good plan given that you cannot possible know all the
configurations a user may want the window to appear.

As it stands, I resorted to redefining this function and removing the
'org-no-popups' section, but I have a sinking feeling that it's going to
end up with some odd window behaviour one day.

  (defun org-switch-to-buffer-other-window (args)
  ;;  (org-no-popups
  ;; (apply 'switch-to-buffer-other-window args)))
(switch-to-buffer-other-window args))

Thanks,

Joshua



[PATCH] org-clock.el: clocktable ':formula %' now includes per-file time pct

2021-02-06 Thread Alan D. Salewski

* lisp/org-clock.el (org-clocktable-write-default): When ':formula %'
  is in-effect, show the per-file time percentage in the '%' column.

This change only has an effect when multiple files are contributing
to a given clocktable (such as when ':scope agenda' has been
specified).  The existing behavior is that such tables have an extra
'File' column, and each individual file that contributes has its own
summary line with the headline value '*File time*'.  Those summary
rows also produce a rollup time value for the file in the 'Time'
column.

Prior to this change, the built-in '%' formula does not produce a
calculation for those per-file times in the '%' column (the relevant
cells in the '%' column were blank).  With this change, the
percentage contribution of each individual file time to the total
time is shown.

The more agenda files you have, the more useful this behavior
becomes.

TINYCHANGE

Signed-off-by: Alan D. Salewski 
---
 lisp/org-clock.el | 20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index cfd112ec3..8e91609c2 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -2697,7 +2697,18 @@ from the dynamic block definition."
 (format (concat "| %s %s | %s%s%s"
 (format org-clock-file-time-cell-format
 (org-clock--translate "File time" lang))
-" | *%s*|\n")
+
+;; The file-time rollup value goes in the first 
time
+;; column (of which there is always at least 
one)...
+" | *%s*|"
+;; ...and the remaining file time cols (if any) 
are blank.
+(make-string (max 0 (1- time-columns)) ?|)
+
+;; Optionally show the percentage contribution of 
"this"
+;; file time to the total time.
+(if (eq formula '%) " %s |" "")
+"\n")
+
 (file-name-nondirectory file-name)
 (if level?"| " "") ;level column, maybe
 (if timestamp "| " "") ;timestamp column, maybe
@@ -2705,7 +2716,12 @@ from the dynamic block definition."
 (if properties ;properties columns, maybe
 (make-string (length properties) ?|)
   "")
-(org-duration-from-minutes file-time ;time
+(org-duration-from-minutes file-time) ;time
+
+(cond ((not (eq formula '%)) "");time percentage, maybe
+  ((or (not total-time) (= total-time 0)) "0.0")
+  (t
+   (format "%.1f" (* 100 (/ file-time (float 
total-time)
 
 	  ;; Get the list of node entries and iterate over it

  (when (> maxlevel 0)
--
a l a n   d.   s a l e w s k i
ads@salewski.email
salew...@att.net
https://github.com/salewski



[PATCH] ob-sql.el: Add support for SAP HANA

2021-02-06 Thread Robin Campbell Joy
* lisp/ob-sql.el (org-babel-execute:sql, org-babel-sql-dbstring-saphana):
Add basic support for SAP HANA to SQL blocks
* testing/lisp/test-ob-sql.el: Basic tests for generated db connection
string

This change adds basic support for SAP HANA to SQL blocks by
specifying saphana as :engine.

It also adds a new header arg `dbinstance' in order to specify the SAP
HANA instance to connect to.

Signed-off-by: Robin Campbell Joy 
---
 lisp/ob-sql.el  |  25 ++-
 testing/lisp/test-ob-sql.el | 382 
 2 files changed, 406 insertions(+), 1 deletion(-)
 create mode 100644 testing/lisp/test-ob-sql.el

diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el
index 902194ae8..5398c85aa 100644
--- a/lisp/ob-sql.el
+++ b/lisp/ob-sql.el
@@ -40,6 +40,7 @@
 ;; - dbuser
 ;; - dbpassword
 ;; - dbconnection (to reference connections in sql-connection-alist)
+;; - dbinstance
 ;; - database
 ;; - colnames (default, nil, means "yes")
 ;; - result-params
@@ -58,6 +59,7 @@
 ;; - postgresql (postgres)
 ;; - oracle
 ;; - vertica
+;; - saphana
 ;;
 ;; TODO:
 ;;
@@ -85,6 +87,7 @@
 (dbport   . :any)
 (dbuser   . :any)
 (dbpassword   . :any)
+(dbinstance   . :any)
 (database   . :any))
   "SQL-specific header arguments.")

@@ -174,6 +177,18 @@ SQL Server on Windows and Linux platform."
   (when database (format "-d %s" database
   " "))

+(defun org-babel-sql-dbstring-saphana (host port instance user password
database)
+  "Make SAP HANA command line args for database connection. Pass nil to
omit that arg."
+  (mapconcat #'identity
+ (delq nil
+   (list (when (and host port) (format "-n %s:%s" host
port))
+ (when (and host (not port)) (format "-n %s" host))
+ (when instance (format "-i %d" instance))
+ (when user (format "-u %s" user))
+ (when password (format "-p %s"
(shell-quote-argument password)))
+ (when database (format "-d %s" database
+ " "))
+
 (defun org-babel-sql-convert-standard-filename (file)
   "Convert FILE to OS standard file name.
 If in Cygwin environment, uses Cygwin specific function to
@@ -197,6 +212,7 @@ database connections."
  (:dbport . sql-port)
  (:dbuser . sql-user)
  (:dbpassword . sql-password)
+ (:dbinstance . sql-dbinstance)
  (:database . sql-database)))
  (mapped-name (cdr (assq name name-mapping
 (cadr (assq mapped-name
@@ -212,6 +228,7 @@ This function is called by
`org-babel-execute-src-block'."
  (dbport (org-babel-find-db-connection-param params :dbport))
  (dbuser (org-babel-find-db-connection-param params :dbuser))
  (dbpassword (org-babel-find-db-connection-param params
:dbpassword))
+ (dbinstance (org-babel-find-db-connection-param params
:dbinstance))
  (database (org-babel-find-db-connection-param params :database))
  (engine (cdr (assq :engine params)))
  (colnames-p (not (equal "no" (cdr (assq :colnames params)
@@ -276,6 +293,12 @@ footer=off -F \"\t\"  %s -f %s -o %s %s"
   dbhost dbport dbuser dbpassword database)
  (org-babel-process-file-name in-file)
  (org-babel-process-file-name out-file)))
+(saphana (format "hdbsql %s -I %s -o %s %s"
+ (org-babel-sql-dbstring-saphana
+  dbhost dbport dbinstance dbuser dbpassword database)
+ (org-babel-process-file-name in-file)
+ (org-babel-process-file-name out-file)
+ (or cmdline "")))
 (t (user-error "No support for the %s SQL engine"
engine)
 (with-temp-file in-file
   (insert
@@ -309,7 +332,7 @@ SET COLSEP '|'
  (progn (insert-file-contents-literally out-file) (buffer-string)))
   (with-temp-buffer
  (cond
- ((memq (intern engine) '(dbi mysql postgresql postgres sqsh vertica))
+ ((memq (intern engine) '(dbi mysql postgresql postgres saphana sqsh
vertica))
   ;; Add header row delimiter after column-names header in first line
   (cond
(colnames-p
diff --git a/testing/lisp/test-ob-sql.el b/testing/lisp/test-ob-sql.el
new file mode 100644
index 0..51edd2309
--- /dev/null
+++ b/testing/lisp/test-ob-sql.el
@@ -0,0 +1,382 @@
+;;; test-ob-sql.el --- tests for ob-sql.el
+
+;; Copyright (C) 2021 Robin Joy
+
+;; Author: Robin Joy 
+;; Keywords: lisp
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU Gene

Bug: org-attach-follow with wrong-number-of-arguments [ ( @ /home/sbrass/.emacs.d/elpa/org-9.4.4/)]

2021-02-06 Thread Simon Braß
Hi all,

I've tried to open an attached file (added with org-attach-attach), however,
when I try to open it with C-c C-o I got the following backtrace:

#+begin_example
Debugger entered--Lisp error: (wrong-number-of-arguments (2 . 2) 1)
  org-attach-follow("1805.00020.pdf")
  org-link-open((link (:type "attachment" :path "1805.00020.pdf" :format
bracket :raw-link "attachment:1805.00020.pdf" :application nil
:search-option nil :begin 717 :end 818 :contents-begin 746 :contents-end
816 :post-blank 0 :parent (paragraph (:begin 717 :end 819 :contents-begin
717 :contents-end 819 :post-blank 0 :post-affiliated 717 :parent (item
(:bullet "- " :begin 708 :end 819 :contents-begin 717 :contents-end 819
:checkbox off :counter nil :structure (... ... ... ... ...) :pre-blank 0
:post-blank 0 :post-affiliated 708 :tag nil :parent (plain-list ...)))
nil)
  org-open-at-point(nil)
  funcall-interactively(org-open-at-point nil)
  call-interactively(org-open-at-point nil nil)
  command-execute(org-open-at-point)
#+end_example

After adding =&optional= to the definition of =org-attach-follow=, and
reloading org-mode (uncompiled) I could get through org-attach-follow.
But, then I hit another issue:

#+begin_example
Debugger entered--Lisp error: (void-function org-link-open-as-file)
  (org-link-open-as-file (org-attach-expand file) arg)
  org-attach-follow("0906.4487.pdf")
  …
#+end_example

After an =eval-defun= on =org-link-open-as-file=, I finally could
open my attachment.

I used =emacs -q=, installed org freshly and used a clean org-file with
only a single header entry and the attachment to reproduce my issue.

Cheers,
Simon Braß

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  ( @ /home/sbrass/.emacs.d/elpa/org-9.4.4/)


org-no-popups overriding display-buffer-alist

2021-02-06 Thread "Joshua O'Connor"
Hi,

I was wondering what the reason is for Org to employ the tactic of
overriding the variable 'display-buffer-alist' in a few places, using
the 'org-no-popups' macro?

It's my understanding that this variable is to be exclusively set by
users, and acts as the "it's my program, I'll put windows where I want
them" setting.

The manual has this to say

"display-buffer-alist and display-buffer-base-action are user options—Lisp 
programs must never set or rebind them. display-buffer-overriding-action, on 
the other hand, is reserved for applications—who seldom use that option and if 
they use it, then with utmost care."

I've ended up with this rather inelegant cludge:

(defun org-switch-to-buffer-other-window (args)
"Switch to buffer in a second window on the current frame.
In particular, do not allow pop-up frames.
Returns the newly created buffer.
Redefined to allow pop-up windows."
  ;;  (org-no-popups
  ;; (apply 'switch-to-buffer-other-window args)))
  (switch-to-buffer-other-window args))


Does anyone know of a better way to reassert my window preferences?

If concrete context will help: I'm specifically wanting to shift the
"*Org Select*" buffers into a side window rather than them do whatever
they want.

Cheers,
Joshua



Re: OT: M-S-$ Not Working

2021-02-06 Thread Maxim Nikulin

On 06/02/2021 13:28, Tim Cross wrote:


In general, standard Emacs key bindings are robust and reliable. If a
standard key binding like M-S $ doesn't work, first step is to try emacs
-Q.


Sorry, but I do not agree that key bindings are robust in emacs. I use 
English and Russian keyboard layouts. Last years most of application 
could handle shortcuts independently of active layout (E.g. Ctrl+C and 
Ctrl+V works for copy-paste even if Russian layout is currently chosen.)
In Emacs, only Control + Latin C works, Control + Cyrillic S (the same 
physical key) is undefined. Location of punctuation symbols depends on 
active layout, "$" is absent in Russian layout at all. It is extremely 
inconvenient to switch to US layout before any shortcut. Emacs uses its 
own input methods, but it means that desktop environment should treat 
emacs in a special way in respect to keyboard layouts. I have a kind of 
solution, I found its variants in blog posts. It is quite tricky, so I 
do not consider it as reliable and suitable for any user.





Re: OT: M-S-$ Not Working

2021-02-06 Thread Bo Grimes
To consolidate I'm replying to both Marcin and Tim together, and if
anyone has further advice I welcome it!!!, but I feel guilty, so reply
to me off-list, please.

On Sat, 06 Feb 2021 17:28:52 +1100
Tim Cross  wrote:

> Marcin Borkowski  writes:
> 
> > Hi Bo,
> >
> > I know your problem is resolved now, but in case you don't know,
> > check also what `C-h c' does (and `C-h k' is also useful at times).
> >  In general, spending 20 minutes on looking through what `C-h C-h'
> > says might save you some trouble later;-).

Thanks!  I resolve to work through the help files from time to time, but
life and attenuation... C-h c looks very useful! I have a couple of
simple capture templates that I copied into my init.el, but I didn't
know one could create them like that!

Right now I am slowly working my way through Harley Hahn's Emacs Field
Guide, and I am determined to master Emacs and Org, which I have been
using extensively for 10 years now, I'm embarrassed to say.

My biggest challenge is that I use Emacs for Org and Org because after
trying everything else, it simply meets all my demands (plain text,
FOSS, etc), all my needs (notes, agendas, and writing), and it is so
stable and configurable that I can grow with it.  However, the
challenge is that duties and obligations (willed and wanted) often keep
me from working on notes, knowledge base, writing stuff for days and
even weeks, so I am constantly relearning.

> >  
> 
> This is good advice. I would add that if you find that Emacs does not
> respond, even to say that the key is not bound or defined, it is
> typically a sign that something in the environment e.g. window manager
> or X (or Wayland) layer is not passing the key press through. These
> are layers which are often overlooked and I've seen people spend hours
> inside Emacs trying to work out what the issue is, only to later find
> it is at a different layer (OS, windowing environment, window manager,
> etc).

> In general, standard Emacs key bindings are robust and reliable. If a
> standard key binding like M-S $ doesn't work, first step is to try
> emacs -Q. If that still does not work, odds are high it is an issue
> outside of Emacs. Most common causes are WM shortcuts, modified input
> device definitions (as seems to be the culprit here) and modified
> modmap settings. Utilities like 'xev' can be useful here (not sure
> what wayland has).

Yeah, I knew that had to be the case, but the Internet is now so awash,
and *nixes so divergent, it's sometimes very difficult, no matter how
good one's searchFu is, to find a solution.  Once I saw that S-4 gave
me a $ in a buffer and M-S-$ in a shell spellchecked the word, I knew it
had to be outside Emacs.  I even made sure it happened with Right M and
Right S as well.

I used Unix in grad school in the early 90s for email, gopher, usenet,
etc so when I heard about Linux in '99 I switched.  The Gnome/KDE wars,
Unity, SystemD, Wayland and more...they all left me behind.

It is INSANE that the problem could have been in Wayland, X, Gnome,
PopShell, Mutter, and that it's all so hidden now.  I still have no
idea what was making the Num Lock prevent the $ from working when M was
pressed but not when S was pressed alone.

I am just not adept enough to switch to something like AwesomeWM or i3.
I have to shepherd my time to focus on Emacs and Org.

In desperation, I turned to a reliable, ancient (in Internet years)
resource: the mailing list, and I am grateful for the patience,
tolerance, and guidance I found.  I have used this list, the only one I
subscribe to, a few times for real org problems, and I learn a lot just
reading any subject that interest me.

> 
> 
> When I install a new system (regardless of platform, linux, mac,
> windows), my first task is usually to remove or remap shortcuts. These
> days, most environments use super, alt, meta and control based
> shortcuts, many of which interfere with my Emacs. I rarely use super
> in my Emacs key bindings, so often I remap useful WM shortcuts to use
> super.
> --
> Tim Cross

This is excellent!  I have a super on all my keyboards, so I could
easily do this on both my laptop (this one) and my desktop.  I usually
only remap caps lock to control and try to learn the shortcuts as
given, but since I really ever only use my two computers (my laptop and
desktop), it makes no sense to worry about muscle memory if I use
another, so I should just change them all to what fits me best.

Thanks again, and for reading this discursive ramble if you got this
far.  This list is an example of what drew me to Linux/Emacs/Org to
begin with!

Gratefully,  
Bo Grimes




Re: [Resolved]Re: OT: M-S-$ Not Working

2021-02-06 Thread Maxim Nikulin

On 06/02/2021 00:38, Bo Grimes wrote:


I have no idea what 3rd level is, but before I ticked it I turned off
my number lock, and C-S-$ worked!  So I ticked it and it stopped
working.  So I unticked it and ticked Number keypad always enters
digits, which is, of course, why I use Num Lock to begin with.


Definitely "xev" is your friend if your want to realize actual effect of 
such changes, along with "setxkbmap -query" (or "setxkbmap -print") and 
"xkbcomp -xkb :0 -".


3rd level is intended to type some characters absent in regular layout 
using a special modifier key. Personally I use 2 keyboard layouts and 
compose key for some symbols that are not directly available, so I do 
not need 3rd level as well.



With that ticked Emacs behaves as expected.  I have always used Num
Lock and never had that problems


You could have a look into /usr/share/X11/xkb/rules/evdev.lst 
/usr/share/X11/xkb/symbols/keypad /usr/share/X11/xkb/types/numpad files. 
If I do not mistake, $ is mapped for keypad with keypad:oss_wang option. 
Likely you could achieve what you want with custom Xkb configuration. I 
have not tried such tricks however. The most comprehensive guide on Xkb, 
I have seen, was in Russian. Its English variant is incomplete, the 
author's site is down. 
https://web.archive.org/web/20121108145326/http://pascal.tsu.ru/en/xkb/


X Keyboard Extension Protocol and library specifications could be hard 
to read, XKB Configuration Guide hosted on x.org is too brief.


P.S. Have you checked that it is possible to swap Ctrl and Caps in 
wayland session? If not it is likely worth filing a bug. It seems 
wayland will be default soon. Some Xkb stuff is already broken in gnome 
(rather intentionally). My first experience with wayland was that it 
took enough time to realize why I could not authenticate. Gdm was using 
wayland by default and in password fields (hidden input!) shift does not 
allow several capital letters in a row.





Bug: org-attach-follow with wrong-number-of-arguments [ ( @ /home/sbrass/.emacs.d/elpa/org-9.4.4/)]

2021-02-06 Thread Simon Braß
Hi all,

I've tried to open an attached file (added with org-attach-attach), however,
when I try to open it with C-c C-o I got the following backtrace:

#+begin_example
Debugger entered--Lisp error: (wrong-number-of-arguments (2 . 2) 1)
  org-attach-follow("1805.00020.pdf")
  org-link-open((link (:type "attachment" :path "1805.00020.pdf" :format
bracket :raw-link "attachment:1805.00020.pdf" :application nil
:search-option nil :begin 717 :end 818 :contents-begin 746 :contents-end
816 :post-blank 0 :parent (paragraph (:begin 717 :end 819 :contents-begin
717 :contents-end 819 :post-blank 0 :post-affiliated 717 :parent (item
(:bullet "- " :begin 708 :end 819 :contents-begin 717 :contents-end 819
:checkbox off :counter nil :structure (... ... ... ... ...) :pre-blank 0
:post-blank 0 :post-affiliated 708 :tag nil :parent (plain-list ...)))
nil)
  org-open-at-point(nil)
  funcall-interactively(org-open-at-point nil)
  call-interactively(org-open-at-point nil nil)
  command-execute(org-open-at-point)
#+end_example

After adding =&optional= to the definition of =org-attach-follow=
and
reloading org-mode (uncompiled) I could get through org-attach-follow.
But, then I hit another issue:

#+begin_example
Debugger entered--Lisp error: (void-function org-link-open-as-file)
  (org-link-open-as-file (org-attach-expand file) arg)
  org-attach-follow("0906.4487.pdf")
  =E2=80=A6
#+end_example

After an =eval-defun= on =org-link-open-as-file=, I finally could
open my attachment.

I used =emacs -q=, installed org freshly and used a clean org-file with
only a single header entry and the attachment to reproduce my issue.

Cheers,
Simon Braß

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  ( @ /home/sbrass/.emacs.d/elpa/org-9.4.4/)


Re: Bug: (org-release) returns empty string on Elpa [ ( @ /home/pierre/.guix-profile/share/emacs/site-lisp/)]

2021-02-06 Thread Pierre Langlois
Hi there,

Kyle Meyer writes:

> Stefan Monnier writes:
>
>> Indeed that's the origin of the problem.
>
> Thanks for confirming.
>
>> I don't know exactly how `org-version.el` is created and how the release
>> version is extracted&inserted, so I'm not sure how to fix it.
>>
>> The approach I'd advocate would be to use `package-get-version` (or
>> something similar since `package-get-version` doesn't exist in
>> Emacs<27).
>
> Based on tested in a `git clone --no-tags ...` repo, should be fixed by
> 61336f80d.

Fantastic! Thanks for chasing and fixing this!
Pierre


signature.asc
Description: PGP signature