Re: Bug: Missing key definition for org-resolve-clocks [9.3.6 (9.3.6-25-g685b2c-elpa @ c:/users/ian/.emacs.d/elpa/org-20200316/)]

2020-05-05 Thread Kyle Meyer
[ Sorry for the delayed reply. ]

Ian Garmaise writes:

> According to the manual section 8.4.3, org-resolve-clocks should be
> bound to C-c C-x C-z
>
> This doesn't seem to be the case.

That's odd.  That binding has been around for a while (f250f6beb,
2012-07-28) and is in the version you reported to be running:

  $ git grep org-resolve-clocks 685b2c -- lisp/org-keys.el
  685b2c:lisp/org-keys.el:(declare-function org-resolve-clocks "org" (&optional 
only-dangling-p prompt-fn last-valid))
  685b2c:lisp/org-keys.el:(org-defkey org-mode-map (kbd "C-c C-x C-z") 
#'org-resolve-clocks)

Perhaps there's something in your configuration that's clobbering the
default binding.



Re: [PATCH 0/4] dynamic block-related fixes

2020-05-05 Thread Kyle Meyer
Pushed with fixes for the orgcard issues Axel noted and dropping the
notmuch message ID prefix that I unintentionally included in two commit
messages.


Range-diff:

1:  6f990dbc4 ! 1:  861ffb313 manual: Remove stale information about dynamic 
block bindings
@@ Commit message
 for inserting dynamic blocks, 2018-12-23).
 
 Reported-by: Axel Kielhorn 
-
+<3ce37ef0-6c7a-4cc0-afee-2b82296d6...@axelkielhorn.de>
 
  ## doc/org-manual.org ##
 @@ doc/org-manual.org: *** Capturing column view
2:  4ef9d38f5 ! 2:  c53ff9b25 orgcard: Update binding for 
org-columns-insert-dblock
@@ doc/orgcard.tex: \section{Properties and Column View}
  \key{next/previous allowed value}{S-LEFT/RIGHT}
  \key{turn on column view}{C-c C-x C-c}
 -\key{capture columns view in dynamic block}{C-c C-x i}
-+\key{capture columns view in dynamic block}{C-c C-x}
++\key{capture columns view in dynamic block}{C-c C-x x}
  
  \key{quit column view}{q}
  \key{show full value}{v}
+@@ doc/orgcard.tex: \section{Timestamps}
+ \key{stop/cancel clock on current item}{C-c C-x C-o/x}
+ \key{display total subtree times}{C-c C-x C-d}
+ \key{remove displayed times}{C-c C-c}
+-\key{insert/update table with clock report}{C-c C-x C-r}
++\key{insert/update table with clock report}{C-c C-x C-x}
+ 
+ \section{Agenda Views}
+ 
3:  fcbc16a5f ! 3:  8368c38e0 Autoload dynamic block definitions
@@ Commit message
 associated library is loaded.
 
 Reported-by: Axel Kielhorn 
-
+<3ce37ef0-6c7a-4cc0-afee-2b82296d6...@axelkielhorn.de>
 
  ## lisp/org-clock.el ##
 @@ lisp/org-clock.el: (defun org-clock-report (&optional arg)
4:  79d13a221 = 4:  f4fed7ea0 org: Retain prefix arg when dispatching dynamic 
block commands



Re: Additonal slashes in URI sent to org-protocol

2020-05-05 Thread Nicolas Goaziou
Hello,

Ferdinand Pieper  writes:

> Subject: [PATCH] org-protocol: Allow slashes after sub-protocol

Thank you.

Please add the function modified in the commit message. Also, if you
haven't signed FSF papers for copyright, you need to insert TINYCHANGE.

> This change lets org-protocol handle URIs with additional slashes
> before the start of the query string, e.g.
>
> org-protocol:/capture/?template=...
>
> instead of
>
> org-protocol:/capture?template=...
> ---
>  lisp/org-protocol.el | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/org-protocol.el b/lisp/org-protocol.el
> index 55a534d0d..8fbff9611 100644
> --- a/lisp/org-protocol.el
> +++ b/lisp/org-protocol.el
> @@ -617,13 +617,13 @@ CLIENT is ignored."
>  (let ((proto
>  (concat the-protocol
>  (regexp-quote (plist-get (cdr prolist) :protocol))
> -"\\(:/+\\|\\?\\)")))
> +"\\(:/+\\|/*\\?\\)")))
>(when (string-match proto fname)
>  (let* ((func (plist-get (cdr prolist) :function))
> (greedy (plist-get (cdr prolist) :greedy))
> (split (split-string fname proto))
> (result (if greedy restoffiles (cadr split)))
> -(new-style (string= (match-string 1 fname) "?")))
> +(new-style (string-match (match-string 1 fname) "/*?")))

I don't understand this line. Aren't you calling string-match backwards?
I think you mean:

  (new-style (string-match "?" (match-string 1 fname)))

Could you also insert a comment explaining why this workaround is
required?

Regards,

-- 
Nicolas Goaziou



Re: Bug: menu item: Add Source Example [9.2.6 (9.2.6-dist @ /path/to/org/install/emacs/site-lisp/org/)]

2020-05-05 Thread Nicolas Goaziou
Hello,

John Ciolfi  writes:

> I just started using 9.2.6 and like the change for 
> org-insert-structure-template to use key C-c C-, instead of the various 
> 
> Could you add this to the menu in org.el:
>
> ("Editing"
>  ["Emphasis..." org-emphasize t]
>  ["Add Source Example" org-insert-structure-template t] ;; << please 
> add
>  ["Edit Source Example" org-edit-special t]
>
> This way it's easy to both add or edit them for people who don't have
> the key bindings memorized.

Done. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: Scheduling in a narrowed subtree: Bug?

2020-05-05 Thread Nicolas Goaziou
Hello,

MichaΓ«l Cadilhac  writes:

> Is this the expected behavior?
>
> 1. Create an empty org file
> 2. Insert
> * Test
> * Test 2
> 3. With the cursor at Test, hit C-x n s to narrow the view to the Test
> subtree
> 4. Hit C-c C-s to schedule the line at any date.
>
> As a result, the SCHEDULED keyword is _not_ included in the narrow view,
> and inserting things after the Test heading moves the SCHEDULED keyword
> away from its second-line position.

Fixed. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: Bug: org-ellipsis does not work as a local variable [9.3.1 (release_9.3.1-95-gf93020 @ /home/mark/git-repos/org-mode/lisp/)]

2020-05-05 Thread Nicolas Goaziou
Hello,

"Mark E. Shoulson"  writes:

> The "org-ellipsis" variable is specifically marked as (potentially) a
> safe local variable, so obviously someone intended for it possibly to be
> used that, and believed that it might be useful to someone as a local
> variable.
>
> However, there is no setup that I can find which makes this work.
> Placing
>
> :  #  Local Variables:
> :  #  org-ellipsis: "XXX"
> :  #  End:
>
> at the end of the file, or setting it in the top line, makes no change
> in the ellipsis, even if you do M-x org-mode again or reload the file
> (with find-alternate-file).  Indeed, M-x org-mode clears the local value
> assignment altogether.  Setting it by hand with setq-local doesn't work
> (it is cleared when you do M-x org-mode again anyway, as mentioned.)
>
> So, is org-ellipsis really not meant ever to be a local variable?  If
> so, that likely should be documented, and certainly the :safe annotation
> on it should be removed, as it strongly implies that using it as a local
> variable is acceptable and useful.

I removed :safe keyword and specified it isn't meant to be a set as
a local variable in its docstring.

Patches are welcome to enable it, tho.

Thank you for the report.

Regards,

-- 
Nicolas Goaziou



Re: [Bug]: org-capture-place-plain-text error when template :unnarrowed

2020-05-05 Thread No Wayman



Note, the empty string or a nil template do not cause the error.



[Bug]: org-capture-place-plain-text error when template :unnarrowed

2020-05-05 Thread No Wayman



org-capture-place-plain-text throws an error for templates which 
meet the following criteria:

 - entry type is 'plain
 - the template has a non-nil :unnarrowed option
 - the template string is not empty and does not explicitly 
 include "%?"


Seems to be thrown in this section of 
org-capture-place-plain-text:

 #+begin_src emacs-lisp
(when (or (search-backward "%?" beg t)
  (search-forward "%?" end t))
 #+end_src

A minimal failing case:
#+begin_src emacs-lisp
(let ((org-capture-templates
  '(("t" "test" plain (file "/tmp/bug.org")
 "FAIL" :unnarrowed t
 (org-capture nil "t"))
#+end_src

And a minimal passing case:
#+begin_src emacs-lisp
(let ((org-capture-templates
  '(("t" "test" plain (file "/tmp/bug.org")
 "PASS%?" :unnarrowed t
 (org-capture nil "t"))
#+end_src



Re: Fwd: Support compilation of Haskell in org mode babel blocks.

2020-05-05 Thread Roland Coeurjoly
Sorry about that. This attached patch should be good.

On Tue, May 5, 2020 at 11:31 PM Nicolas Goaziou 
wrote:

> Hello,
>
> Roland Coeurjoly  writes:
>
> > Please see attached patch.
>
> Great!
>
> It seems that this is a patch that needs to be applied on top of the
> previous one. Could you merge them into a single patch and send it
> again?
>
> Please let me know when the FSF registers you.
>
> Regards,
>
> --
> Nicolas Goaziou
>
From 35d637fdad355787ce739d9b42997d3ba781a64f Mon Sep 17 00:00:00 2001
From: Roland Coeurjoly 
Date: Sat, 25 Apr 2020 20:35:22 +0200
Subject: [PATCH 1/1] ob-haskell: introduce :compile header argument

* lisp/ob-haskell (org-babel-haskell-compiler):
(org-babel-header-args:haskell): new variables.
(org-babel-haskell-execute):
(org-babel-haskell-interpret): new functions.
(org-babel-execute:haskell): use new functions.
---
 lisp/org/ob-haskell.el | 78 ++
 1 file changed, 73 insertions(+), 5 deletions(-)

diff --git a/lisp/org/ob-haskell.el b/lisp/org/ob-haskell.el
index e004a34..55989ad 100644
--- a/lisp/org/ob-haskell.el
+++ b/lisp/org/ob-haskell.el
@@ -23,12 +23,13 @@
 
 ;;; Commentary:
 
-;; Org-Babel support for evaluating haskell source code.  This one will
-;; be sort of tricky because haskell programs must be compiled before
+;; Org Babel support for evaluating Haskell source code.
+;; Haskell programs must be compiled before
 ;; they can be run, but haskell code can also be run through an
 ;; interactive interpreter.
 ;;
-;; For now lets only allow evaluation using the haskell interpreter.
+;; By default we evaluate using the Haskell interpreter.
+;; To use the compiler, specify :compile yes in the header.
 
 ;;; Requirements:
 
@@ -47,6 +48,7 @@
 (declare-function run-haskell "ext:inf-haskell" (&optional arg))
 (declare-function inferior-haskell-load-file
 		  "ext:inf-haskell" (&optional reload))
+(declare-function org-entry-get "org" (pom property &optional inherit literal-nil))
 
 (defvar org-babel-tangle-lang-exts)
 (add-to-list 'org-babel-tangle-lang-exts '("haskell" . "hs"))
@@ -60,8 +62,66 @@ org-babel-haskell-eoe
 
 (defvar haskell-prompt-regexp)
 
-(defun org-babel-execute:haskell (body params)
-  "Execute a block of Haskell code."
+(defcustom org-babel-haskell-compiler "ghc"
+  "Command used to compile a Haskell source code file into an executable.
+May be either a command in the path, like \"ghc\"
+or an absolute path name, like \"/usr/local/bin/ghc\".
+The command can include a parameter, such as \"ghc -v\""
+  :group 'org-babel
+  :package-version '(Org "9.4")
+  :type 'string)
+
+(defconst org-babel-header-args:haskell '(compile . :any)
+  "Haskell-specific header arguments.")
+
+(defun org-babel-haskell-execute (body params)
+  "This function should only be called by `org-babel-execute:haskell'"
+  (let* ((tmp-src-file (org-babel-temp-file
+			"Haskell-src-"
+".hs"))
+ (tmp-bin-file
+  (org-babel-process-file-name
+   (org-babel-temp-file "Haskell-bin-" org-babel-exeext)))
+ (cmdline (cdr (assq :cmdline params)))
+ (cmdline (if cmdline (concat " " cmdline) ""))
+ (flags (cdr (assq :flags params)))
+ (flags (mapconcat #'identity
+		   (if (listp flags)
+   flags
+ (list flags)) " "))
+ (libs (org-babel-read
+	(or (cdr (assq :libs params))
+	(org-entry-get nil "libs" t))
+	nil))
+ (libs (mapconcat #'identity
+		  (if (listp libs) libs (list libs))
+		  " ")))
+(with-temp-file tmp-src-file (insert body))
+(org-babel-eval
+ (format "%s -o %s %s %s %s"
+ org-babel-haskell-compiler
+	 tmp-bin-file
+	 flags
+	 (org-babel-process-file-name tmp-src-file)
+	 libs)
+ "")
+(let ((results
+	   (org-babel-eval
+	(concat tmp-bin-file cmdline) "")))
+  (when results
+(setq results (org-trim (org-remove-indentation results)))
+(org-babel-reassemble-table
+ (org-babel-result-cond (cdr (assq :result-params params))
+	   (org-babel-read results t)
+	   (let ((tmp-file (org-babel-temp-file "Haskell-")))
+	 (with-temp-file tmp-file (insert results))
+	 (org-babel-import-elisp-from-file tmp-file)))
+ (org-babel-pick-name
+	  (cdr (assq :colname-names params)) (cdr (assq :colnames params)))
+ (org-babel-pick-name
+	  (cdr (assq :rowname-names params)) (cdr (assq :rownames params
+
+(defun org-babel-interpret-haskell (body params)
   (require 'inf-haskell)
   (add-hook 'inferior-haskell-hook
 (lambda ()
@@ -96,6 +156,14 @@ org-babel-execute:haskell
  (org-babel-pick-name (cdr (assq :rowname-names params))
 			  (cdr (assq :rowname-names params))
 
+
+(defun org-babel-execute:haskell (body params)
+  "Execute a block of Haskell code."
+  (let ((compile (string= "yes" (cdr (assq :compile params)
+  (if

Re: Fwd: Support compilation of Haskell in org mode babel blocks.

2020-05-05 Thread Nicolas Goaziou
Hello,

Roland Coeurjoly  writes:

> Please see attached patch.

Great!

It seems that this is a patch that needs to be applied on top of the
previous one. Could you merge them into a single patch and send it
again?

Please let me know when the FSF registers you.

Regards,

-- 
Nicolas Goaziou



Re: Fwd: Support compilation of Haskell in org mode babel blocks.

2020-05-05 Thread Roland Coeurjoly
I have sent the form.
Thank you.

On Mon, May 4, 2020 at 11:52 PM Nicolas Goaziou 
wrote:

> Roland Coeurjoly  writes:
>
> > I have read the page about signing FSF papers, but I am unclear about how
> > to proceed.
> > Could you give some pointers?
>
> Certainly. See
>
>   https://orgmode.org/worg/org-contribute.html#copyright-issues
>
> You basically need to fill a form and send it to ass...@gnu.org.
>
> Thank you for considering signing it.
>


Re: Fwd: Support compilation of Haskell in org mode babel blocks.

2020-05-05 Thread Roland Coeurjoly
Please see attached patch.
Regards.

On Mon, May 4, 2020 at 11:50 PM Nicolas Goaziou 
wrote:

> Roland Coeurjoly  writes:
>
> > I am confused about the last point:
> > Use a let-binding instead of setq.
> >
> > If I use:
> >
> > (let* compile (string= (cdr (assq :compile params)) "yes"))
>
> I meant:
>
>   (let ((compile (string= "yes" (cdr (assq :compile params)
>...)
>
From 2c05ba85bffac4019432fa461c0e4f75cd24a0f6 Mon Sep 17 00:00:00 2001
From: Roland Coeurjoly 
Date: Tue, 5 May 2020 23:09:58 +0200
Subject: [PATCH 1/1] ob-haskell: introduce :compile header argument

* lisp/ob-haskell (org-babel-haskell-compiler):
(org-babel-header-args:haskell): new variables.
(org-babel-haskell-execute):
(org-babel-haskell-interpret): new functions.
(org-babel-execute:haskell): use new functions.
---
 lisp/org/ob-haskell.el | 38 --
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/lisp/org/ob-haskell.el b/lisp/org/ob-haskell.el
index d32a2f7bc0..55989adba1 100644
--- a/lisp/org/ob-haskell.el
+++ b/lisp/org/ob-haskell.el
@@ -23,7 +23,7 @@
 
 ;;; Commentary:
 
-;; Org-Babel support for evaluating Haskell source code.
+;; Org Babel support for evaluating Haskell source code.
 ;; Haskell programs must be compiled before
 ;; they can be run, but haskell code can also be run through an
 ;; interactive interpreter.
@@ -62,19 +62,19 @@ org-babel-haskell-eoe
 
 (defvar haskell-prompt-regexp)
 
-(defcustom org-babel-Haskell-compiler "ghc"
+(defcustom org-babel-haskell-compiler "ghc"
   "Command used to compile a Haskell source code file into an executable.
-May be either a command in the path, like ghc
-or an absolute path name, like /usr/local/bin/ghc
-parameter may be used, like ghc -v"
+May be either a command in the path, like \"ghc\"
+or an absolute path name, like \"/usr/local/bin/ghc\".
+The command can include a parameter, such as \"ghc -v\""
   :group 'org-babel
-  :version "27.0"
+  :package-version '(Org "9.4")
   :type 'string)
 
-(defconst org-babel-header-args:haskell '((compile . :any))
+(defconst org-babel-header-args:haskell '(compile . :any)
   "Haskell-specific header arguments.")
 
-(defun org-babel-Haskell-execute (body params)
+(defun org-babel-haskell-execute (body params)
   "This function should only be called by `org-babel-execute:haskell'"
   (let* ((tmp-src-file (org-babel-temp-file
 			"Haskell-src-"
@@ -85,8 +85,10 @@ org-babel-Haskell-execute
  (cmdline (cdr (assq :cmdline params)))
  (cmdline (if cmdline (concat " " cmdline) ""))
  (flags (cdr (assq :flags params)))
- (flags (mapconcat 'identity
-		   (if (listp flags) flags (list flags)) " "))
+ (flags (mapconcat #'identity
+		   (if (listp flags)
+   flags
+ (list flags)) " "))
  (libs (org-babel-read
 	(or (cdr (assq :libs params))
 	(org-entry-get nil "libs" t))
@@ -97,11 +99,12 @@ org-babel-Haskell-execute
 (with-temp-file tmp-src-file (insert body))
 (org-babel-eval
  (format "%s -o %s %s %s %s"
- org-babel-Haskell-compiler
+ org-babel-haskell-compiler
 	 tmp-bin-file
 	 flags
 	 (org-babel-process-file-name tmp-src-file)
-	 libs) "")
+	 libs)
+ "")
 (let ((results
 	   (org-babel-eval
 	(concat tmp-bin-file cmdline) "")))
@@ -116,10 +119,9 @@ org-babel-Haskell-execute
  (org-babel-pick-name
 	  (cdr (assq :colname-names params)) (cdr (assq :colnames params)))
  (org-babel-pick-name
-	  (cdr (assq :rowname-names params)) (cdr (assq :rownames params)
-  )))
+	  (cdr (assq :rowname-names params)) (cdr (assq :rownames params
 
-(defun org-babel-interpret-Haskell (body params)
+(defun org-babel-interpret-haskell (body params)
   (require 'inf-haskell)
   (add-hook 'inferior-haskell-hook
 (lambda ()
@@ -157,10 +159,10 @@ org-babel-interpret-Haskell
 
 (defun org-babel-execute:haskell (body params)
   "Execute a block of Haskell code."
-  (setq compile (string= (cdr (assq :compile params)) "yes"))
+  (let ((compile (string= "yes" (cdr (assq :compile params)
   (if (not compile)
-  (org-babel-interpret-Haskell body params)
-(org-babel-Haskell-execute body params)))
+  (org-babel-interpret-haskell body params)
+(org-babel-haskell-execute body params
 
 (defun org-babel-haskell-initiate-session (&optional _session _params)
   "Initiate a haskell session.
-- 
2.20.1



Re: Tricking org-mode into using markdown conventions

2020-05-05 Thread Berry, Charles


> On May 5, 2020, at 1:46 AM, Ihor Radchenko  wrote:
> 
>> I am assuming though, from the lack of answers back, that there appears to
>> be no way to have org-mode grok markdown code blocks (triple backticks)
>> when it parses as a substitute for `#+BEGIN_SRC` ?
> 
> #+BEGIN_SRC is a part of org syntax, "```" is not.
> You will need to modify the org-mode internals to do change it.
> Depending on implementation details of org-mode, changing
> org-block-regexp and all the occurrences of "BEGIN_SRC" and "END_SRC" in
> org mode sources might achieve what you want, but there is no guarantee
> that it will not be broken in future versions of org.
> 

True. 

However, if your interest is only in exporting a document with such markup, 
there is `org-export-before-processing-hook'.

I haven't tried this but if you want to execute such src blocks, maybe polymode 
would work.

HTH,

Chuck


> Best,
> Ihor
> 
> 
> Daryl Manning  writes:
> 
>> This looks great (your elisp-fu is impressive) and definitely fulfills
>> making it look markdown-ish. Thanks! Will plug it in tonight and take it
>> for a pain.
>> 
>> I am assuming though, from the lack of answers back, that there appears to
>> be no way to have org-mode grok markdown code blocks (triple backticks)
>> when it parses as a substitute for `#+BEGIN_SRC` ?
>> 
>> Daryl.
>> 
>> 
>> On Mon, May 4, 2020 at 3:37 PM Diego Zamboni  wrote:
>> 
>>> Ihor,
>>> 
>>> Awesome, thanks for the tip. Using your code, the following config (inside
>>> the code from https://pank.eu/blog/pretty-babel-src-blocks.html) produces
>>> a display with the backticks instead of begin/end_src:
>>> 
>>>  (defun yant/str-to-glyph (str)
>>>"Transform string into glyph, displayed correctly."
>>>(let ((composition nil))
>>>  (dolist (char (string-to-list str)
>>>(nreverse (cdr composition)))
>>>(push char composition)
>>>(push '(Br . Bl) composition
>>> 
>>>  (defun rasmus/org-prettify-symbols ()
>>>(mapc (apply-partially 'add-to-list 'prettify-symbols-alist)
>>>  (cl-reduce 'append
>>> (mapcar (lambda (x) (list x (cons (upcase (car
>>> x)) (cdr x
>>> `(("#+begin_src" . ,(yant/str-to-glyph
>>> "```")) ;; ⎑ ➀ πŸ– ➟ ➀ ✎
>>>   ("#+end_src"   . ,(yant/str-to-glyph
>>> "```")) ;; ⎣ ✐
>>>   ("#+header:" . ,rasmus/ob-header-symbol)
>>>   ("#+begin_quote" . ?Β«)
>>>   ("#+end_quote" . ?Β»)
>>>(turn-on-prettify-symbols-mode)
>>>(add-hook 'post-command-hook 'rasmus/org-prettify-src t t))
>>> 
>>> It looks like this in my config (the bars hide the header arguments):
>>> 
>>> [image: image.png]
>>> 
>>> --Diego
>>> 
>>> 
>>> On Mon, May 4, 2020 at 6:19 AM Ihor Radchenko  wrote:
>>> 
> I did a quick test, and it seems
> that =prettify-symbols-alist= (which is what this code uses) can only
> replace for a single character, so I was not able to make it display
> the three backticks, but there might be other techniques that can be
> used.
 
 Yes, there is another technique.
 See part of my config below:
 
 
  (defun yant/str-to-glyph (str)
"Transform string into glyph, displayed correctly."
(let ((composition nil))
  (dolist (char (string-to-list str)
(nreverse (cdr composition)))
(push char composition)
(push '(Br . Bl) composition
 
  (append pretty-symbol-patterns
`(((yant/str-to-glyph " ") org-specific ,(format
 "^\\(\\*\\{%d,%d\\}\\)\\*[^*]" (1- org-inlinetask-min-level) (1-
 org-inlinetask-max-level)) (org-mode) 1)
  ((yant/str-to-glyph "β‡’β‡’β‡’") org-specific ,(format
 "^\\(\\*\\{%d,%d\\}\\)\\(\\*\\)[^*]" (1- org-inlinetask-min-level) (1-
 org-inlinetask-max-level)) (org-mode) 2)
  (?β•­ org-specific "^[ ]*#[+]NAME" (org-mode))
  (?β•­ org-specific "^[ ]*#[+]name" (org-mode))
  (?β”œ org-specific "[ ]*#[+]begin_src" (org-mode))
  (?β”œ org-specific "[ ]*#[+]BEGIN_SRC" (org-mode))
  (?β•° org-specific "[ ]*#[+]end_src" (org-mode))
  (?β•° org-specific "[ ]*#[+]END_SRC" (org-mode))
  ((yant/str-to-glyph "πŸ“πŸ“πŸ“") org-specific ":\\(ATTACH\\):"
 (org-mode) 1)
  ((yant/str-to-glyph "☠D") org-specific "\\>>> (org-mode))
  ((yant/str-to-glyph "β—΄S") org-specific "\\>>> (org-mode
 
 Diego Zamboni  writes:
 
> Hi Daryl,
> 
> If it's for display purposes only, you might be able to simply use
> display substitutions for things to appear the way you want. For
> example, I use the technique described here:
> https://pank.eu/blog/pretty-babel-src-blocks.html to replace the
> begin/end_src strings with symbols. I did a qu

Re: Inserting org-mode heading links the org-refile way

2020-05-05 Thread Ihor Radchenko


> This looks impressive, and is *similar* to the effect I am going for, but
> what I am looking at is intercepting the `org-insert-link` functionality
> (or replacing it) with the ability to insert a link from the global
> filter-and-select interface via ivy for `org-refile`. So, in other words,
> global access to the (say 3 levels down) headings and files available
> through the ivy interface (which further allows me to filter that down).

I feel that I am missing something. Probably, because I am not using
ivy. For helm (which I am using), org-refile-get-location provides
filter-and-select interface automatically. So, I can get on-the-fly
filtering for id: link automatically. I just type `C-c C-l id: RET` and 
filter the candidates just like in org-refile. Do you need to call some
special function to use ivy with org-refile? If so, just replace
org-refile-get-location in my code with your ivy version. If you want to
go straight into inserting the link without a need to type `C-c C-l id:
RET`, you may just bind (insert "[[" (org-id-link-complete) "]]") to key
binding of your choice.

Best,
Ihor



Daryl Manning  writes:

> This looks impressive, and is *similar* to the effect I am going for, but
> what I am looking at is intercepting the `org-insert-link` functionality
> (or replacing it) with the ability to insert a link from the global
> filter-and-select interface via ivy for `org-refile`. So, in other words,
> global access to the (say 3 levels down) headings and files available
> through the ivy interface (which further allows me to filter that down).
>
> This would give me the ability to arbitrarily add links across all files
> (and particularly handy with org-contact for adding in links in cal entries
> for meetings).  Since the viy interface seems to work fine for refiling
> tasks (except for initial load of refile targets), it seems it'd be
> sufficiently performant.
>
> Daryl.
>
>
> On Mon, May 4, 2020 at 1:14 PM Ihor Radchenko  wrote:
>
>> If I understand you correctly, the following code should achieve what
>> you want. The code reuses org-refile interface to complete id: links.
>>
>> (defun org-id-prompt-id ()
>>   "Prompt for the id during completion of id: link."
>>   (let ((org-refile-history nil)
>> (org-refile-cache nil)
>> (org-refile-target-verify-function nil))
>> (let ((prompt-ans (org-refile-get-location "Select org entry")))
>>   (prog1
>>   (or (org-id-get (seq-find #'markerp
>> prompt-ans)
>>   'create)
>>   (user-error "Cannot find ID of the entry: %s" prompt-ans))
>> (setq org-id-history org-refile-history)
>> (setq org-id-cache org-refile-cache)
>>
>>
>> (defun org-id-link-complete (&optional arg)
>>   "Completion function for id: link."
>>   (let* ((id (org-id-prompt-id)))
>> (format "id:%s" id)))
>>
>> (defun org-id-link-desk (link desk)
>>   "Description function for id: link."
>>   (or desk
>>   (let ((id (cadr (split-string link ":"
>> (org-with-point-at (org-id-find id 'marker)
>>   (org-get-heading 'strip 'all 'the 'extra)
>>
>> (org-link-set-parameters "id"
>>  :complete #'org-id-link-complete
>>  :desk #'org-id-link-desk)
>>
>>
>>
>> Daryl Manning  writes:
>>
>> > I use ivy and org-refile to process my inbox.org file hyper-efficiently
>> and
>> > get things into my GTD system.
>> >
>> > In a recent discussion on org-roam (which nicely links to files in a nice
>> > wiki-like manner) it occurred to me if I had a similar interface to
>> search
>> > for headlines in the manner of org-refile and then insert them
>> effortlessly
>> > without having to switch to a doc and copy/store them and then switching
>> > back to my doc and inserting them, I'd be a happy camper.
>> >
>> > Is there a package/functions that does/do that in some fashion (say
>> > configurable to avoid link sprawl so say, like 3 heading levels down and
>> to
>> > files in specific directories like deft). Googling did not give joy,
>> though
>> > I noticed someone had used a similar approach for addressing link
>> *within*
>> > a document, but not quite there (swiper and worf combo and an ivy-org-ref
>> > package looked interesting).
>> >
>> > (I always worry when I post these questions that someone is going to just
>> > say "but did you not know about M-x org-insert-link-like-ivy-with-refile"
>> > so go gentle on me if I've missed something obvious. It seems I often do.
>> > This weekend in particular I've added on a whole bunch of small but in
>> the
>> > aggregate, large productivity improvements to my emacs setup which I
>> > approached solving the wrong way until I asked and someone mentioned
>> > another way to do things, so ).
>> >
>> > thanks,
>> > Daryl.
>>
>> --
>> Ihor Radchenko,
>> PhD,
>> Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
>> State Key Laboratory for

Re: Inserting org-mode heading links the org-refile way

2020-05-05 Thread Daryl Manning
This looks impressive, and is *similar* to the effect I am going for, but
what I am looking at is intercepting the `org-insert-link` functionality
(or replacing it) with the ability to insert a link from the global
filter-and-select interface via ivy for `org-refile`. So, in other words,
global access to the (say 3 levels down) headings and files available
through the ivy interface (which further allows me to filter that down).

This would give me the ability to arbitrarily add links across all files
(and particularly handy with org-contact for adding in links in cal entries
for meetings).  Since the viy interface seems to work fine for refiling
tasks (except for initial load of refile targets), it seems it'd be
sufficiently performant.

Daryl.


On Mon, May 4, 2020 at 1:14 PM Ihor Radchenko  wrote:

> If I understand you correctly, the following code should achieve what
> you want. The code reuses org-refile interface to complete id: links.
>
> (defun org-id-prompt-id ()
>   "Prompt for the id during completion of id: link."
>   (let ((org-refile-history nil)
> (org-refile-cache nil)
> (org-refile-target-verify-function nil))
> (let ((prompt-ans (org-refile-get-location "Select org entry")))
>   (prog1
>   (or (org-id-get (seq-find #'markerp
> prompt-ans)
>   'create)
>   (user-error "Cannot find ID of the entry: %s" prompt-ans))
> (setq org-id-history org-refile-history)
> (setq org-id-cache org-refile-cache)
>
>
> (defun org-id-link-complete (&optional arg)
>   "Completion function for id: link."
>   (let* ((id (org-id-prompt-id)))
> (format "id:%s" id)))
>
> (defun org-id-link-desk (link desk)
>   "Description function for id: link."
>   (or desk
>   (let ((id (cadr (split-string link ":"
> (org-with-point-at (org-id-find id 'marker)
>   (org-get-heading 'strip 'all 'the 'extra)
>
> (org-link-set-parameters "id"
>  :complete #'org-id-link-complete
>  :desk #'org-id-link-desk)
>
>
>
> Daryl Manning  writes:
>
> > I use ivy and org-refile to process my inbox.org file hyper-efficiently
> and
> > get things into my GTD system.
> >
> > In a recent discussion on org-roam (which nicely links to files in a nice
> > wiki-like manner) it occurred to me if I had a similar interface to
> search
> > for headlines in the manner of org-refile and then insert them
> effortlessly
> > without having to switch to a doc and copy/store them and then switching
> > back to my doc and inserting them, I'd be a happy camper.
> >
> > Is there a package/functions that does/do that in some fashion (say
> > configurable to avoid link sprawl so say, like 3 heading levels down and
> to
> > files in specific directories like deft). Googling did not give joy,
> though
> > I noticed someone had used a similar approach for addressing link
> *within*
> > a document, but not quite there (swiper and worf combo and an ivy-org-ref
> > package looked interesting).
> >
> > (I always worry when I post these questions that someone is going to just
> > say "but did you not know about M-x org-insert-link-like-ivy-with-refile"
> > so go gentle on me if I've missed something obvious. It seems I often do.
> > This weekend in particular I've added on a whole bunch of small but in
> the
> > aggregate, large productivity improvements to my emacs setup which I
> > approached solving the wrong way until I asked and someone mentioned
> > another way to do things, so ).
> >
> > thanks,
> > Daryl.
>
> --
> Ihor Radchenko,
> PhD,
> Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
> State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong
> University, Xi'an, China
> Email: yanta...@gmail.com, ihor_radche...@alumni.sutd.edu.sg
>


Re: [PATCH 2/4] orgcard: Update binding for org-columns-insert-dblock

2020-05-05 Thread Kyle Meyer
Axel Kielhorn writes:

>> diff --git a/doc/orgcard.tex b/doc/orgcard.tex
>> index fa233b620..121a86442 100644
>> --- a/doc/orgcard.tex
>> +++ b/doc/orgcard.tex
>> @@ -513,7 +513,7 @@ \section{Properties and Column View}
>> \key{special commands in property lines}{C-c C-c}
>> \key{next/previous allowed value}{S-LEFT/RIGHT}
>> \key{turn on column view}{C-c C-x C-c}
>> -\key{capture columns view in dynamic block}{C-c C-x i}
>> +\key{capture columns view in dynamic block}{C-c C-x}
>
> That should be {C-c C-x x}

Oops, thanks for catching my typo.

> Orgcard.tex still has 
> \key{insert/update table with clock report}{C-c C-x C-r}
>
> that should be:
>
> \key{insert/update table with clock report}{C-c C-x x}

Guh, I'm not sure how I botched my search for that last night.  Thanks.



Re: Tricking org-mode into using markdown conventions

2020-05-05 Thread Ihor Radchenko
> I am assuming though, from the lack of answers back, that there appears to
> be no way to have org-mode grok markdown code blocks (triple backticks)
> when it parses as a substitute for `#+BEGIN_SRC` ?

#+BEGIN_SRC is a part of org syntax, "```" is not.
You will need to modify the org-mode internals to do change it.
Depending on implementation details of org-mode, changing
org-block-regexp and all the occurrences of "BEGIN_SRC" and "END_SRC" in
org mode sources might achieve what you want, but there is no guarantee
that it will not be broken in future versions of org.

Best,
Ihor


Daryl Manning  writes:

> This looks great (your elisp-fu is impressive) and definitely fulfills
> making it look markdown-ish. Thanks! Will plug it in tonight and take it
> for a pain.
>
> I am assuming though, from the lack of answers back, that there appears to
> be no way to have org-mode grok markdown code blocks (triple backticks)
> when it parses as a substitute for `#+BEGIN_SRC` ?
>
> Daryl.
>
>
> On Mon, May 4, 2020 at 3:37 PM Diego Zamboni  wrote:
>
>> Ihor,
>>
>> Awesome, thanks for the tip. Using your code, the following config (inside
>> the code from https://pank.eu/blog/pretty-babel-src-blocks.html) produces
>> a display with the backticks instead of begin/end_src:
>>
>>   (defun yant/str-to-glyph (str)
>> "Transform string into glyph, displayed correctly."
>> (let ((composition nil))
>>   (dolist (char (string-to-list str)
>> (nreverse (cdr composition)))
>> (push char composition)
>> (push '(Br . Bl) composition
>>
>>   (defun rasmus/org-prettify-symbols ()
>> (mapc (apply-partially 'add-to-list 'prettify-symbols-alist)
>>   (cl-reduce 'append
>>  (mapcar (lambda (x) (list x (cons (upcase (car
>> x)) (cdr x
>>  `(("#+begin_src" . ,(yant/str-to-glyph
>> "```")) ;; ⎑ ➀ πŸ– ➟ ➀ ✎
>>("#+end_src"   . ,(yant/str-to-glyph
>> "```")) ;; ⎣ ✐
>>("#+header:" . ,rasmus/ob-header-symbol)
>>("#+begin_quote" . ?Β«)
>>("#+end_quote" . ?Β»)
>> (turn-on-prettify-symbols-mode)
>> (add-hook 'post-command-hook 'rasmus/org-prettify-src t t))
>>
>> It looks like this in my config (the bars hide the header arguments):
>>
>> [image: image.png]
>>
>> --Diego
>>
>>
>> On Mon, May 4, 2020 at 6:19 AM Ihor Radchenko  wrote:
>>
>>> > I did a quick test, and it seems
>>> > that =prettify-symbols-alist= (which is what this code uses) can only
>>> > replace for a single character, so I was not able to make it display
>>> > the three backticks, but there might be other techniques that can be
>>> > used.
>>>
>>> Yes, there is another technique.
>>> See part of my config below:
>>>
>>>
>>>   (defun yant/str-to-glyph (str)
>>> "Transform string into glyph, displayed correctly."
>>> (let ((composition nil))
>>>   (dolist (char (string-to-list str)
>>> (nreverse (cdr composition)))
>>> (push char composition)
>>> (push '(Br . Bl) composition
>>>
>>>   (append pretty-symbol-patterns
>>> `(((yant/str-to-glyph " ") org-specific ,(format
>>> "^\\(\\*\\{%d,%d\\}\\)\\*[^*]" (1- org-inlinetask-min-level) (1-
>>> org-inlinetask-max-level)) (org-mode) 1)
>>>   ((yant/str-to-glyph "β‡’β‡’β‡’") org-specific ,(format
>>> "^\\(\\*\\{%d,%d\\}\\)\\(\\*\\)[^*]" (1- org-inlinetask-min-level) (1-
>>> org-inlinetask-max-level)) (org-mode) 2)
>>>   (?β•­ org-specific "^[ ]*#[+]NAME" (org-mode))
>>>   (?β•­ org-specific "^[ ]*#[+]name" (org-mode))
>>>   (?β”œ org-specific "[ ]*#[+]begin_src" (org-mode))
>>>   (?β”œ org-specific "[ ]*#[+]BEGIN_SRC" (org-mode))
>>>   (?β•° org-specific "[ ]*#[+]end_src" (org-mode))
>>>   (?β•° org-specific "[ ]*#[+]END_SRC" (org-mode))
>>>   ((yant/str-to-glyph "πŸ“πŸ“πŸ“") org-specific ":\\(ATTACH\\):"
>>> (org-mode) 1)
>>>   ((yant/str-to-glyph "☠D") org-specific "\\>> (org-mode))
>>>   ((yant/str-to-glyph "β—΄S") org-specific "\\>> (org-mode
>>>
>>> Diego Zamboni  writes:
>>>
>>> > Hi Daryl,
>>> >
>>> > If it's for display purposes only, you might be able to simply use
>>> > display substitutions for things to appear the way you want. For
>>> > example, I use the technique described here:
>>> > https://pank.eu/blog/pretty-babel-src-blocks.html to replace the
>>> > begin/end_src strings with symbols. I did a quick test, and it seems
>>> > that =prettify-symbols-alist= (which is what this code uses) can only
>>> > replace for a single character, so I was not able to make it display
>>> > the three backticks, but there might be other techniques that can be
>>> > used.
>>> >
>>> > --Diego
>>> >
>>> > On Sun, May 3, 2020 at 6:24 PM Daryl Manning 
>>> wrote:
>>> >>
>>> >> While using C-c C-, is easy enough f

Re: Tricking org-mode into using markdown conventions

2020-05-05 Thread Diego Zamboni
Hi Daryl,

I am assuming though, from the lack of answers back, that there appears to
> be no way to have org-mode grok markdown code blocks (triple backticks)
> when it parses as a substitute for `#+BEGIN_SRC` ?
>

I am no expert in the Org internals, but a quick search shows the strings
BEGIN/END_SRC are hardcoded in a few places, so it seems to me you are
correct, there's probably no easy way to do this.

--Diego


Re: Tricking org-mode into using markdown conventions

2020-05-05 Thread Daryl Manning
This looks great (your elisp-fu is impressive) and definitely fulfills
making it look markdown-ish. Thanks! Will plug it in tonight and take it
for a pain.

I am assuming though, from the lack of answers back, that there appears to
be no way to have org-mode grok markdown code blocks (triple backticks)
when it parses as a substitute for `#+BEGIN_SRC` ?

Daryl.


On Mon, May 4, 2020 at 3:37 PM Diego Zamboni  wrote:

> Ihor,
>
> Awesome, thanks for the tip. Using your code, the following config (inside
> the code from https://pank.eu/blog/pretty-babel-src-blocks.html) produces
> a display with the backticks instead of begin/end_src:
>
>   (defun yant/str-to-glyph (str)
> "Transform string into glyph, displayed correctly."
> (let ((composition nil))
>   (dolist (char (string-to-list str)
> (nreverse (cdr composition)))
> (push char composition)
> (push '(Br . Bl) composition
>
>   (defun rasmus/org-prettify-symbols ()
> (mapc (apply-partially 'add-to-list 'prettify-symbols-alist)
>   (cl-reduce 'append
>  (mapcar (lambda (x) (list x (cons (upcase (car
> x)) (cdr x
>  `(("#+begin_src" . ,(yant/str-to-glyph
> "```")) ;; ⎑ ➀ πŸ– ➟ ➀ ✎
>("#+end_src"   . ,(yant/str-to-glyph
> "```")) ;; ⎣ ✐
>("#+header:" . ,rasmus/ob-header-symbol)
>("#+begin_quote" . ?Β«)
>("#+end_quote" . ?Β»)
> (turn-on-prettify-symbols-mode)
> (add-hook 'post-command-hook 'rasmus/org-prettify-src t t))
>
> It looks like this in my config (the bars hide the header arguments):
>
> [image: image.png]
>
> --Diego
>
>
> On Mon, May 4, 2020 at 6:19 AM Ihor Radchenko  wrote:
>
>> > I did a quick test, and it seems
>> > that =prettify-symbols-alist= (which is what this code uses) can only
>> > replace for a single character, so I was not able to make it display
>> > the three backticks, but there might be other techniques that can be
>> > used.
>>
>> Yes, there is another technique.
>> See part of my config below:
>>
>>
>>   (defun yant/str-to-glyph (str)
>> "Transform string into glyph, displayed correctly."
>> (let ((composition nil))
>>   (dolist (char (string-to-list str)
>> (nreverse (cdr composition)))
>> (push char composition)
>> (push '(Br . Bl) composition
>>
>>   (append pretty-symbol-patterns
>> `(((yant/str-to-glyph " ") org-specific ,(format
>> "^\\(\\*\\{%d,%d\\}\\)\\*[^*]" (1- org-inlinetask-min-level) (1-
>> org-inlinetask-max-level)) (org-mode) 1)
>>   ((yant/str-to-glyph "β‡’β‡’β‡’") org-specific ,(format
>> "^\\(\\*\\{%d,%d\\}\\)\\(\\*\\)[^*]" (1- org-inlinetask-min-level) (1-
>> org-inlinetask-max-level)) (org-mode) 2)
>>   (?β•­ org-specific "^[ ]*#[+]NAME" (org-mode))
>>   (?β•­ org-specific "^[ ]*#[+]name" (org-mode))
>>   (?β”œ org-specific "[ ]*#[+]begin_src" (org-mode))
>>   (?β”œ org-specific "[ ]*#[+]BEGIN_SRC" (org-mode))
>>   (?β•° org-specific "[ ]*#[+]end_src" (org-mode))
>>   (?β•° org-specific "[ ]*#[+]END_SRC" (org-mode))
>>   ((yant/str-to-glyph "πŸ“πŸ“πŸ“") org-specific ":\\(ATTACH\\):"
>> (org-mode) 1)
>>   ((yant/str-to-glyph "☠D") org-specific "\\> (org-mode))
>>   ((yant/str-to-glyph "β—΄S") org-specific "\\> (org-mode
>>
>> Diego Zamboni  writes:
>>
>> > Hi Daryl,
>> >
>> > If it's for display purposes only, you might be able to simply use
>> > display substitutions for things to appear the way you want. For
>> > example, I use the technique described here:
>> > https://pank.eu/blog/pretty-babel-src-blocks.html to replace the
>> > begin/end_src strings with symbols. I did a quick test, and it seems
>> > that =prettify-symbols-alist= (which is what this code uses) can only
>> > replace for a single character, so I was not able to make it display
>> > the three backticks, but there might be other techniques that can be
>> > used.
>> >
>> > --Diego
>> >
>> > On Sun, May 3, 2020 at 6:24 PM Daryl Manning 
>> wrote:
>> >>
>> >> While using C-c C-, is easy enough for insertion and such, I was
>> wondering if there was any way of having org-mode honour markdown
>> conventions for things like code fences and quotes.
>> >>
>> >> ``` elisp
>> >> #+begin_src
>> >> #+end_src
>> >>
>> >> #+begin_quote
>> >> #+end_quote
>> >> ```
>> >>
>> >> being a bit nicer to read with
>> >>
>> >> ``` go
>> >> code block
>> >> ```
>> >> as well as
>> >>
>> >> > And gentlemen in England now-a-bed.
>> >> > Shall think themselves accurs'd they were not here,
>> >> > And hold their manhoods cheap whiles any speaks.
>> >> > That fought with us upon Saint Crispin's day.
>> >>
>> >> Just curious as to whether that's possible. YMMV before you start
>> debating on whether you think this is a good idea or not... =

Re: [PATCH 2/4] orgcard: Update binding for org-columns-insert-dblock

2020-05-05 Thread Axel Kielhorn
Hi Kyle!

Thanks for the quick reaction.

> Am 05.05.2020 um 06:15 schrieb Kyle Meyer :
> 
> As of 34b71a0ca (Add a dispatcher command for inserting dynamic
> blocks, 2018-12-23), the binding was removed and the command is
> available via org-dynamic-block-insert-dblock.
> ---
> doc/orgcard.tex | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/doc/orgcard.tex b/doc/orgcard.tex
> index fa233b620..121a86442 100644
> --- a/doc/orgcard.tex
> +++ b/doc/orgcard.tex
> @@ -513,7 +513,7 @@ \section{Properties and Column View}
> \key{special commands in property lines}{C-c C-c}
> \key{next/previous allowed value}{S-LEFT/RIGHT}
> \key{turn on column view}{C-c C-x C-c}
> -\key{capture columns view in dynamic block}{C-c C-x i}
> +\key{capture columns view in dynamic block}{C-c C-x}

That should be {C-c C-x x}

Orgcard.tex still has 
\key{insert/update table with clock report}{C-c C-x C-r}

that should be:

\key{insert/update table with clock report}{C-c C-x x}

Everything else is fine.

Greetings 
Axel