Re: [O] ob-core.el macro org-babel-comint-with-output has error
stardiviner writes: > When I try to evaluate js src block code with session. > I found it is suspended. After edebug, found the problem is on macro > org-babel-comint-with-output. > > Here is a minimal reproduce code: > > #+begin_src emacs-lisp > (org-babel-comint-with-output > ("*skewer-repl*" (format "%S" org-babel-js-eoe) t "x.innerHTML=\"Hello, > Welcome!\";") > (mapc >(lambda (line) > (insert (org-babel-chomp line)) > (comint-send-input nil t)) >(list "x.innerHTML=\"Hello, Welcome!\";" (format "%S" org-babel-js-eoe > #+end_src > > Hope someone can fix it. I can't help on elisp macro Anyone can help me on this? Why this email does not have any reply? Maybe because my old invalid mu4e message sign configuration? -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
Re: [O] [PATCH 2/4] ob-clojure.el: Add ClojureScript interface
roberthambr...@gmail.com writes: > From: Robert Hambrock > > * lisp/ob-clojure.el (org-babel-execute:clojure): Implemented :target, > which allows selection of connection. > * lisp/ob-clojure.el (org-babel-execute:clojurescript): New > ClojureScript interface that uses :target flag to specify `cljs` > evaluation target. > --- > lisp/ob-clojure.el | 10 +++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/lisp/ob-clojure.el b/lisp/ob-clojure.el > index 93674b552..7f7c24ff1 100644 > --- a/lisp/ob-clojure.el > +++ b/lisp/ob-clojure.el > @@ -129,7 +129,8 @@ using the :show-process parameter." >(cider > (require 'cider) > (let ((result-params (cdr (assq :result-params params))) > - (show (cdr (assq :show-process params > + (show (cdr (assq :show-process params))) > + (connection (cider-current-connection (cdr (assq :target > params) > (if (member show '(nil "no")) >;; Run code without showing the process. >(progn > @@ -137,7 +138,7 @@ using the :show-process parameter." >(let ((nrepl-sync-request-timeout > org-babel-clojure-sync-nrepl-timeout)) > (nrepl-sync-request:eval expanded > - (cider-current-connection > + connection))) > (setq result >(concat > (nrepl-dict-get response > @@ -171,7 +172,7 @@ using the :show-process parameter." > (nrepl--merge response resp) > ;; Update the status of the nREPL output session. > (setq status (nrepl-dict-get response "status"))) > - (cider-current-connection)) > + connection) > >;; Wait until the nREPL code finished to be processed. >(while (not (member "done" status)) > @@ -211,6 +212,9 @@ using the :show-process parameter." >(condition-case nil (org-babel-script-escape result) > (error result) > > +(defun org-babel-execute:clojurescript (body params) > + (org-babel-execute:clojure body (cons '(:target . "cljs") params))) > + > (provide 'ob-clojure) > > ;;; ob-clojure.el ends here Hi, @roberthambrock. I would like to have ob-clojure support ClojureScript too. But seems this patch is not merged yet, for a long time. Can I modify this patch and send to Org Mode? @Nicolas, can I do this? set Git commit author as "roberthambrock", and commiter as me. -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
Re: [O] [PATCH] migrate ob-clojure initiate session code from ob-clojure-literate.el into ob-clojure.el
Nicolas Goaziou writes: > Hello, > > stardiviner writes: > >> Nicolas Goaziou writes: >> >> Hi, sorry for late response, because I'm a little lazy on give effort on >> review my patch and improve it again. But now I finished it. Actually I >> corrected my patch as soon as you replied email with mentioned. Today I >> pick up this task again, and add a new improve which support CIDER new >> API which using sesman to manage REPL sessions. > > OK. So does it qualify as a bug fix, i.e., should that go into master > branch, or is it a new feature, for next branch? > > BTW, there are some compilation warning: > > --8<---cut here---start->8--- > Compiling /home/ngz/dev/org-mode/lisp/ob-clojure.el... > > In toplevel form: > ob-clojure.el:215:1:Warning: Unused lexical variable ‘sesman-system’ > > In org-babel-clojure-initiate-session: > ob-clojure.el:225:47:Warning: reference to free variable ‘cider-version’ > > In end of data: > ob-clojure.el:278:1:Warning: the function ‘cider-repls’ is not known to be > defined. > --8<---cut here---end--->8--- > > Could you fix them? > > Thank you. > > Regards, Hi, Nicolas. I fixed those warning. I think this should be a feature. not a patch. And run `make test`. Here is the result: ``` ... executing Vala source code block Code block evaluation complete. passed 138/814 ob-vala/static-output failed 139/814 org-missing-dependency/test-ob-R failed 140/814 org-missing-dependency/test-ob-clojure failed 141/814 org-missing-dependency/test-ob-lua failed 142/814 org-missing-dependency/test-ob-maxima failed 143/814 org-missing-dependency/test-ob-plantuml failed 144/814 org-missing-dependency/test-ob-ruby failed 145/814 org-missing-dependency/test-ob-scheme failed 146/814 org-missing-dependency/test-org-attach-annex failed 147/814 org-missing-dependency/test-org-protocol passed 148/814 test-ob-exp/org-babel-exp-src-blocks/w-no-file passed 149/814 test-ob-exp/org-babel-exp-src-blocks/w-no-headers passed 150/814 test-ob-exp/org-babel-exp-src-blocks/w-no-headers2 executing Emacs-Lisp code block... . . 6 unexpected results: FAILED ob-D/inhomogeneous_table FAILED ob-D/list-list-var FAILED ob-D/list-var FAILED ob-D/vector-var FAILED test-org-clock/clocktable/lang FAILED test-org-colview/columns-width ``` Also I added an entry in ORG-NEWS mentioned about this new feature. >From f495c5b4e65fd8c6a64e8619d974d6eb051fb1f7 Mon Sep 17 00:00:00 2001 From: stardiviner Date: Thu, 19 Apr 2018 18:16:27 +0800 Subject: [PATCH 1/2] ob-clojure.el: Support `org-babel-initiate-session' to initialize. * ob-clojure.el (org-babel-clojure-initiate-session): Initialize session for src block. (org-babel-prep-session:clojure): Prepare Clojure session. (org-babel-clojure-var-to-clojure): Convert header argument :var into clojure variables definitions. (org-babel-variable-assignments:clojure): Support assign variables when initialize session. --- contrib/lisp/ob-clojure-literate.el | 56 - lisp/ob-clojure.el | 55 + testing/lisp/test-ob-clojure.el | 77 + 3 files changed, 132 insertions(+), 56 deletions(-) create mode 100644 testing/lisp/test-ob-clojure.el diff --git a/contrib/lisp/ob-clojure-literate.el b/contrib/lisp/ob-clojure-literate.el index 4c4d38a0f..b1cc386ee 100644 --- a/contrib/lisp/ob-clojure-literate.el +++ b/contrib/lisp/ob-clojure-literate.el @@ -184,62 +184,6 @@ If it is a directory, `ob-clojure-literate' will try to create Clojure project a (lambda (cons) (if (eq (car cons) :session) t cons)) org-babel-default-header-args:clojure) -;;; Support `org-babel-initiate-session' / [C-c C-v z] to initialize Clojure session. - -(defun org-babel-clojure-initiate-session (&optional session _params) - "Initiate a session named SESSION according to PARAMS." - (when (and session (not (string= session "none"))) -(save-window-excursion - (unless (org-babel-comint-buffer-livep session) -;; CIDER jack-in to the Clojure project directory. -(cond - ((eq org-babel-clojure-backend 'cider) - (require 'cider) - (let ((session-buffer (save-window-excursion - (cider-jack-in t) - (current-buffer -(if (org-babel-comint-buffer-livep session-buffer) -(progn (sit-for .25) session-buffer - ((eq org-babel-clojure-backend 'slime) - (error "Session evaluation with SLIME is not supported")) - (t - (error "Session initiate failed"))) -) - (get-buffer session) - ))) - -(defun org-babel-prep-session:clojure (session params) - "Prepare SESSION according to the header arguments specified in PARAMS." - (let* ((session (org-babe
[O] org-babel-execute:go crashes on Mac
Morning, recently I tried to use ob-go and ran immediately into: org-babel-execute:go: Invalid function: (results (org-babel-eval (format "%s run %s \"%s\" %s" org-babel-go-command (mapconcat (quote identity) (org-babel-go-as-list flags) " ") (org-babel-process-file-name tmp-src-file) (mapconcat (function (lambda (a) (format "%S" (if (symbolp a) (let* (... ...) (if ... ... out)) a (org-babel-go-as-list args) " ")) "")) The strange thing is, that this only happens on my Mac. On my CentOS machine it works like a charm. Both machines run on Emacs 26.1b1 and org mode 9.1.9-65-g5e454. All packages are from Melpa and the machines share the same .emacs. I have no idea how to get to the bottom of this phenomenon. Any hint or help would be appreciated very much. Thank you Mario —
Re: [O] Inline code block syntax highlighting absence
Nicolas Goaziou writes: > Hello, > > stardiviner writes: > >> Garreau, Alexandre writes: >> >>> Why is there no syntax highlighting for *inline* source/code blocks? >>> >>> For instance, if I type the following: >>> >>> #+BEGIN_SRC org >>> src_emacs-lisp{(foo bar (quux))} >>> #+END_SRC >>> >>> The underscore is not displayed, “emacs” is displayed in face >>> ~org-latex-and-related~ *and* in subscript display (smaller and >>> negatively raised), and all the rest in default face, with no syntax >>> highlighting, even inside the braces (that I would expect as it is done >>> inside non-inline blocks). >> >> I used to asked similar question, and answered my own question with >> a font-lock solution. This link might be helpful. >> https://stackoverflow.com/questions/20309842/how-to-syntax-highlight-for-org-mode-inline-source-code-src-lang > > Would you want to provide a patch for that? > > Thank you. > > Regards, I did a search of "font-lock-add-keywords", "begin_src", "src_" etc in Org Mode source code, but have not found exact place where fontify function are. So I don't know where to modify the source code. Now I put my current config here: #+begin_src emacs-lisp ;; inline code face => src_ruby{require 'something'} ;; ;; (REGEXP . FACE) ;; Highlight REGEXP with FACE ;; (REGEXP N FACE) ;; Highlight group N in REGEXP with FACE ;; (REGEXP (N1 FACE1) (N2 FACE2) (N3 FACE3) …) ;; Highlight group Ni in REGEXP with FACEi ;; ;; src_lang{code...}[:header arguments] / NOTE: override by `org-verbatim'. ;; result in following =[result]= ;; src_ (font-lock-add-keywords 'org-mode '(("\\(src_\\)\\([^[{]+\\)\\(\\[:.*\\]\\)\\({\\)\\([^}]*\\)\\(}\\)" (1 '(:foreground "black" :weight 'normal :height 0.1)) ; src_ part (2 '(:foreground "cyan" :weight 'bold :height 0.8 :box '(:color "light gray"))) ; "lang" part. (3 '(:foreground "#55" :height 0.7)) ; [:header arguments] part. (4 '(:foreground "#33")) ; { (5 'org-code) ; "code..." part. (6 '(:foreground "#33")) ; } )) 'append) ;; src without arguments (font-lock-add-keywords 'org-mode '(("\\(src_\\)\\([^[{]+\\)\\({\\)\\([^}]*\\)\\(}\\)" (1 '(:foreground "black" :weight 'normal :height 0.1)) ; src_ part (2 '(:foreground "cyan" :weight 'bold :height 0.8 :box '(:color "light gray"))) ; "lang" part. (3 '(:foreground "#33")) ; { (4 'org-code) ; "code..." part. (5 '(:foreground "#33")) ; } )) 'append) ;; inline babel call ;; ... call_[]()[] ... (font-lock-add-keywords 'org-mode '(("\\(call_\\)\\([^[(]*\\)\\[\\(.*\\)\\](\\(.*\\))\\[\\(.*\\)\\]" ;; "\\(call_\\)\\([^[(]*\\)\\([([][^)]*]\\)+" (1 '(:foreground "orange red" :height 0.6)) ; call_ (2 '(:foreground "yellow" :weight 'bold :underline "dark gray")) ; (3 '(:foreground "gray" :height 0.6)) ; [] (4 '(:foreground "cyan" :weight 'bold)) ; () (5 '(:foreground "gray" :height 0.6)) ; [] )) 'append) ;; call_[]() (font-lock-add-keywords 'org-mode '(("\\(call_\\)\\([^[(]*\\)\\[\\(.*\\)\\](\\(.*\\))" (1 '(:foreground "orange red" :height 0.6)) ; call_ (2 '(:foreground "yellow" :weight 'bold :underline "dark gray")) ; (3 '(:foreground "gray" :height 0.6)) ; [] (4 '(:foreground "cyan" :weight 'bold)) ; () )) 'append) ;; call_(arguments) (font-lock-add-keywords 'org-mode '(("\\(call_\\)\\([^[(]*\\)\\((.*)\\)" (1 '(:foreground "orange red" :height 0.6)) ; call_ (2 '(:foreground "yellow" :weight 'bold :underline "dark gray")) ; (3 '(:foreground "cyan" :weight 'bold)) ; () )) 'append) #+end_src -- [ stardiviner ] I try to make every word tell the meaning what I want to express. Blog: https://stardiviner.github.io/ IRC(freenode): stardiviner GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
Re: [O] org-mode: Would like to add custom chars as org-list bullets
On Sat, Oct 13, 2018 at 1:56 AM Colin Baxter wrote: > > > Tom Burbage writes: > > > When I use simple lists, I would like to be able to mix in '!' and > > '?' with '-' as these are sometimes more expressive of what the > > list item represents. My request is that the list of characters > > org-list recognizes as being a valid "bullet" be customizable by > > the user. > > Have a look at > https://emacs.stackexchange.com/questions/35626/how-to-make-my-own-org-mode-text-emphasis-work-again. Which code are you recommending?
[O] newlines and buffer corruption [was Re: [PATCH] org-capture: fix capture breaking next headline]
whether it is an example of it i am not sure, but the case in the org-capture thread is typical of a class of buffer corruption bugs that is common in org. if you have found similar corruption in your org files and wondered why, this is probably the cause. newlines that you didn't enter are also related. examples: 1 in capture i use hooks to fix whitespace. 2 in block editing, c-c ', you can get similar issues at the end of the block. [this example, however, might be a cultural influence of the root cause and not a bug caused by the root cause.] 3 at one point long ago i reported a bug where sorting in a narrowed region would corrupt the buffer. this had gone unnoticed probably because when you sort it is not obvious that the buffer was corrupted. also there are similar things with org tree to indirect buffer. === when i looked into it a long time ago, the root cause was the design of outline mode of which org was or is a derived mode. at least one outline mode function acts as if an entry or subtree starts before the first star and ends before -- yes, before -- the final newline in the entry text contents. frequent org coders probably know this, but probably not everybody does. people write workarounds to fix it, or they have no problem with it and they code to it, or they aren't aware of it and don't account for it. for edge cases. which they forget all about when the bug occurs. then code gets called by other code, which means there are assumptions sometimes broken, or workarounds that are necessary, and then there is buffer corruption. this touches on old debates. it isn't just emacs. look at crontab and wc. i predict that more bugs [and user workarounds] will occur.
Re: [O] electric-pair, autopair, smartparens, etc in org-mode
Eric S Fraga writes: > On Wednesday, 24 Oct 2018 at 12:38, Roland Everaert wrote: >> Pleased to see it was helpful. The funny thing is that I use that config >> for, maybe, 10 years and never think about changing it. > > I've been using emacs for well over 30 years now. You would not believe the > crud that has built up in my config files... ;-) :Q > > Mind you, with org, I have started rationalizing the config files but it's a > time consuming task and the adage of "if it ain't broke, don't fix it" has > power... +1 Likewise, started with Emacs 19 and I still have some code which I added back then in my init! I went through the pain of cleaning up my init file some time ago when I moved to make better use of 'use-package'. Have to say that while things were not 'broken' before my cleanup, they are certainly working better now and my init is much smaller. What I found was that a lot of what was in my init file was simply no longer required as similar (often superior) functionality has crept into the main Emacs distribution - all I needed to do was remove my code and turn the feature on. The two big benefits from the clean up have been much faster start up (something which never really bothered me as I run emacs for weeks without re-starting anyway) and far more predictable behaviour when I try out or add a new mode (I often found my custom tweaks would not always work well with new modes etc). Org is extremely useful in this process. Create an org file and put all your existing init in there as source blocks so that you can reproduce your setup using tangle. Then create a new-init.org file and just add the stuff you must have i.e. email config, essential modes etc. Then you can switch between old and new setups using tangle to generate new init.el file. When you have time, start with the new-init version and start adding/tweaking to get the behaviour you want. Rather than just copy across your old setup, check to see what is available in core - if your like me, you will find lots of we use to tweak in code is now part of core emacs and all you need to do is turn it on. At some point, you will find you stay in your new init file and no longer need to revert to the old version. You will likely find lots of stuff never gets migrated. It really is worth the time and effort. Tim -- Tim Cross
Re: [O] Ox-html: Replace with and with
Kaushal Modi writes: > On Wed, Oct 24, 2018 at 2:04 AM Nicolas Goaziou > wrote: >> >> >> No objection from me. Thank you! > > Actually, before making this change, I started reading up on the HTML5 > spec on the b, strong, i, em tags, and now I am confused as ever. > > Facts: > > - b and i are not deprecated > - b and strong are both valid but their use depends on the writer's > context (but Org mode has just one mark for either "*") > - i and em are both valid but their use depends on the writer's > context (but Org mode has just one mark for either "/"). > > From "em" docs[em], in the NOTE section there: > >> The em element isn’t a generic "italics" element. Sometimes, text is >> intended to stand out from the rest of the paragraph, as if it was in a >> different mood or voice. For this, the i element is more appropriate. > > See the b tag docs[b] and i tag docs[i], and this W3C FAQ on using b > and i tags[faq] for more. > > > *Summary* (/see what I did there?/): > > I guess there's no need to change what "*" and "/" do right now in > ox-html, as there doesn't seem "one right way" to do things here. > > And folks strongly wanting to use and for bold and > italic can customize org-html-text-markup-alist. > > HTML experts, please chime in. > > > > [em]: https://www.w3.org/TR/html5/textlevel-semantics.html#the-em-element > [b]: https://www.w3.org/TR/html5/textlevel-semantics.html#the-b-element > [i]: https://www.w3.org/TR/html5/textlevel-semantics.html#the-i-element > [faq]: https://www.w3.org/International/questions/qa-b-and-i-tags I'll start by stating I'm definitely not an HTML expert. I do believe we should move away from b/i to strong/em as I think these are the correct semantic tags to use and are generally what is preferred. This means they are also likely to already have appropriate 'styling' in many 'canned' styles and valid consistent interpretations for different media types. The problem with b and i is that they specify how rather than what and don't always make sense for all possible media types. For example, what does 'bold' or 'italic' mean for a screen reader? I don't think this is something that is urgent, but it is the direction we should go. The only real reason for sooner rather than later is that we can probably simplify some of the exporters and ensure any new exporters are correct and won't need to be change retrospectively. Tim -- Tim Cross
Re: [O] Fixed [
"Garreau, Alexandre" writes: > Le 24/10/2018 à 18h15, Nicolas Goaziou a écrit : >> >> Note that orgstruct-mode, and orgstruct++-mode are removed from the code >> base. > > No really? how sad! do anyone knows why? You may want to browse the mailing list archives for discussions about it. Essentially, Orgstruct mode was very buggy and its implementation was wrong. > And also what are we supposed to use to support src blocks and > outline-like headings in Gnus? Orgstruct mode, AFAIK, has nothing to do with source blocks in Gnus. For outline-like headings, you have Outline, Outorg, Outshine and probably other solutions out there. Regards,
Re: [O] [feature proposal] Export in foreign buffers - ASCII (ox-ascii)
Hello Nicolas, Many thanks for your swift response! On 2018-10-24, at 09:04 , Nicolas Goaziou wrote: > [...] > I see you are not including Latin1 export. Is there any reason to > implement pure ASCII export? Wouldn't UTF-8 be sufficient? > > More generally, I wonder if, in 2018, it still makes sense to provide > ASCII-only and Latin1 export. I was of the same opinion, hence I didn't include Latin-1. Is pure ASCII still useful? I admit using UTF-8 99% of the time. But sometimes there's the odd guy using that arcane email client and who complains that my message came out garbled. That's when the pure ASCII comes in handy. That will always work; 100% guaranteed. No strong feelings on whether to include pure ASCII or not. On the other hand, it seems so cheap implementation wise, you might just as well choose to include all three (i.e. UTF-8, ASCII, and Latin-1). > [...] > (let ((org-ascii-charset 'utf-8)) >(org-export-replace-region-by 'ascii)) > > would be simpler. Bummer! This was my initial version, actually. But for some reason it didn't seem to work (maybe I forgot eval-region?). You are right (of course), and I have switched my implementation back to my original approach (which copied below for completeness). > The manual needs to be updated, too. > [...] Indeed. Many thanks again and cheers, --alexander -- (defun org-ascii-convert-region-to-ascii () "Assume the current region has Org syntax, and convert it to plain ASCII. This can be used in any buffer. For example, you could write an itemized list or a table in Org syntax in a mail buffer and then use this command to convert it." (interactive) (let ((org-ascii-charset 'ascii)) (org-export-replace-region-by 'ascii))) (defun org-ascii-convert-region-to-utf8 () "Assume the current region has Org syntax, and convert it to UTF-8. This can be used in any buffer. For example, you could write an itemized list or a table in Org syntax in a mail buffer and then use this command to convert it." (interactive) (let ((org-ascii-charset 'utf-8)) (org-export-replace-region-by 'ascii))) --
Re: [O] Fixed [
Le 24/10/2018 à 18h15, Nicolas Goaziou a écrit : > "Garreau, Alexandre" writes: >> On 2018-10-24 at 17:31, Garreau, Alexandre wrote: >>> I finally found how people naturally made their mail with org, with >>> orgstruct++-mode, that I just tried. However that triggers an infinite >>> loop error (“car: Lisp nesting exceeds ‘max-lisp-eval-depth’”), because >>> then indent-line-function refers to org-indent-line, which when >>> orgstruct-is-++ is true, calls indent-line-function. >>> >>> Why that garbage? how is it supposed to be? >> >> Ok, then (cl-cadadr (assq 'indent-line-function org-fb-vars)) is >> supposed *not* to return org-indent-line, as now I cleaned my hooks >> (some modes where called several times redundantly in message-mode, >> text-mode, etc.), I see no more problems, sorry for the disturbance. > > Note that orgstruct-mode, and orgstruct++-mode are removed from the code > base. No really? how sad! do anyone knows why? And also what are we supposed to use to support src blocks and outline-like headings in Gnus?
Re: [O] Fixed [
Hello, "Garreau, Alexandre" writes: > On 2018-10-24 at 17:31, Garreau, Alexandre wrote: >> I finally found how people naturally made their mail with org, with >> orgstruct++-mode, that I just tried. However that triggers an infinite >> loop error (“car: Lisp nesting exceeds ‘max-lisp-eval-depth’”), because >> then indent-line-function refers to org-indent-line, which when >> orgstruct-is-++ is true, calls indent-line-function. >> >> Why that garbage? how is it supposed to be? > > Ok, then (cl-cadadr (assq 'indent-line-function org-fb-vars)) is > supposed *not* to return org-indent-line, as now I cleaned my hooks > (some modes where called several times redundantly in message-mode, > text-mode, etc.), I see no more problems, sorry for the disturbance. Note that orgstruct-mode, and orgstruct++-mode are removed from the code base. Regards, -- Nicolas Goaziou
[O] Fixed [Was: Re: org-indent-line loops infinitely (when orgstruct++)]
On 2018-10-24 at 17:31, Garreau, Alexandre wrote: > I finally found how people naturally made their mail with org, with > orgstruct++-mode, that I just tried. However that triggers an infinite > loop error (“car: Lisp nesting exceeds ‘max-lisp-eval-depth’”), because > then indent-line-function refers to org-indent-line, which when > orgstruct-is-++ is true, calls indent-line-function. > > Why that garbage? how is it supposed to be? Ok, then (cl-cadadr (assq 'indent-line-function org-fb-vars)) is supposed *not* to return org-indent-line, as now I cleaned my hooks (some modes where called several times redundantly in message-mode, text-mode, etc.), I see no more problems, sorry for the disturbance.
[O] org-indent-line loops infinitely (when orgstruct++)
I finally found how people naturally made their mail with org, with orgstruct++-mode, that I just tried. However that triggers an infinite loop error (“car: Lisp nesting exceeds ‘max-lisp-eval-depth’”), because then indent-line-function refers to org-indent-line, which when orgstruct-is-++ is true, calls indent-line-function. Why that garbage? how is it supposed to be?
Re: [O] Ox-html: Replace with and with
On Wed, Oct 24, 2018 at 2:04 AM Nicolas Goaziou wrote: > > > No objection from me. Thank you! Actually, before making this change, I started reading up on the HTML5 spec on the b, strong, i, em tags, and now I am confused as ever. Facts: - b and i are not deprecated - b and strong are both valid but their use depends on the writer's context (but Org mode has just one mark for either "*") - i and em are both valid but their use depends on the writer's context (but Org mode has just one mark for either "/"). >From "em" docs[em], in the NOTE section there: > The em element isn’t a generic "italics" element. Sometimes, text is intended > to stand out from the rest of the paragraph, as if it was in a different mood > or voice. For this, the i element is more appropriate. See the b tag docs[b] and i tag docs[i], and this W3C FAQ on using b and i tags[faq] for more. *Summary* (/see what I did there?/): I guess there's no need to change what "*" and "/" do right now in ox-html, as there doesn't seem "one right way" to do things here. And folks strongly wanting to use and for bold and italic can customize org-html-text-markup-alist. HTML experts, please chime in. [em]: https://www.w3.org/TR/html5/textlevel-semantics.html#the-em-element [b]: https://www.w3.org/TR/html5/textlevel-semantics.html#the-b-element [i]: https://www.w3.org/TR/html5/textlevel-semantics.html#the-i-element [faq]: https://www.w3.org/International/questions/qa-b-and-i-tags
Re: [O] electric-pair, autopair, smartparens, etc in org-mode
On Wednesday, 24 Oct 2018 at 09:12, Matt Price wrote: > Eric, you seem to be replying to an email that I sometimes don't have -- I > would love to see what @stardiviner wrote, do you stil lhave the email? I've forwarded that email to you but it's strange that you missed it as it was sent to the org mode mailing list. -- Eric S Fraga via Emacs 27.0.50, Org release_9.1.13-783-g97fac4
Re: [O] electric-pair, autopair, smartparens, etc in org-mode
Eric, you seem to be replying to an email that I sometimes don't have -- I would love to see what @stardiviner wrote, do you stil lhave the email? On Tue, Oct 23, 2018 at 9:12 AM Eric S Fraga wrote: > On Tuesday, 23 Oct 2018 at 19:48, stardiviner wrote: > > This is really helpful for me, I use smartparens before, but it is a > > little heavy. So I disabled it. I found your solution is simple and > > fast. I modified a little: > > +1 > > I gave up long ago on smartparens but skeleton seems to work well. > > -- > Eric S Fraga via Emacs 27.0.50, Org release_9.1.13-783-g97fac4 > >
Re: [O] access a let* value whe ndefining a function?
On Tue, Oct 23, 2018 at 4:34 PM John Kitchin wrote: > > Matt Price writes: > > > On Tue, Oct 23, 2018 at 2:32 PM John Kitchin > > wrote: > > > >> I think that what you really want to do here is modify org-mime-compose > so > >> that you can use the send-actions argument to message-mail. In > >> scimax-email.el I use that to be able to turn an org-heading into an > email, > >> send it, and then jump back to the heading to insert some information > about > >> the email into the heading properties after it is sent. A lot of the > >> information gets passed via global variables. Maybe there is a better > way > >> to do that, I wrote that code a long time ago. > >> > >> > > I'm trying to use mu4e~compose-mail instead of message-compose, I guess > > mostly because I want to be able to use the mu4e email address completion > > features in the `To:` header. And it wouldalso be nice to save the email > > to the appropriate mu folder. But I didn't seem to be able to make mu4e > > bounce back to my buffer no matter what I do, and though > mu4e~compose-mail > > accepts a return-action argument it doesn't actually use it :-(. > > This is kind of tricky. Here is an approach that seems to work: > > (defun my-compose () > (interactive) > (mu4e~compose-mail) > (advice-add 'mu4e~switch-back-to-mu4e-buffer :after > `(lambda () > (switch-to-buffer (get-buffer ,(buffer-name) )) > (advice-remove 'mu4e~switch-back-to-mu4e-buffer > "om-temp-advice")) > '((name . "om-temp-advice" > > You just call M-x my-compose to get this behavior. I guess you could > advise mu4e~compose too to add the advice. > > Right now I am adding my advice from inside of ~org-mime-org-*-htmlize~ in the org-mime code (which I guess you no longer use, since you have written your own email handler). It seems to be a good place for it & is minimally invasive to other packages. Here's the code ` code I attempted but which didn't work for me: (advice-add 'mu4e~switch-back-to-mu4e-buffer :after (eval `(lambda () (switch-to-buffer (get-buffer ,(buffer-name) )) (advice-remove 'mu4e~switch-back-to-mu4e-buffer "om-temp-advice") '((name . "om-temp-advice") Seems like maybe the problem fore me is the extra "eval". What maybe I don't understand is why the backquote works when the ordinary way to add an advice is the unquoted (advice-add 'sym (lambda () (message "I am an advice")) while IIUC yours should evaluate to (advice-add 'sym '(lambda () (message "I am an advice")) There should be a difference, shouldn't there? But clearly I don't understand. > It seems necessary to use a temporary advice here. I wasn't aware of the > name way of removing advice, that is pretty nice here, since we use a > changing anonymous function. > > yes it's nice right? > >> Otherwise, you need to figure out how to use something like a macro that > >> captures the current-buffer and creates a lambda function with that > >> information in it, and attaches it to the message-buffer hook somehow. > For > >> example this will display a message-box for me after the message is > sent. > >> > >> (let ((f `(lambda () > >> (message-box "Came from %s" ,(current-buffer) > >> (message-mail) > >> (add-hook 'kill-buffer-hook f nil t)) > >> > >> Some important notes is this hook is added in local mode, so it only > >> affects that email buffer. > >> > >> > > Can you explain to me what yo umean by "added in local mode" -- how is > that > > achieved? > > This is what the final t argument in the add-hood function does. I think > it makes the hook local to the buffer it runs in, as opposed to in every > buffer. > > OK thanks that's very helpful. I guess my problem was that there was no built-in hook that executed *after* mu4e~switch-back-to-buffer. Which is why I have had to learn about advice. > > > > Meanwhile, htis is what I've done and it seems to work: > > > > (eval (car (read-from-string > > (concat > > "(advice-add 'mu4e~switch-back-to-mu4e-buffer :after > > (lambda () > > (switch-to-buffer > >(get-buffer \"" > > (buffer-name) > > "\" )) > > (advice-remove > > 'mu4e~switch-back-to-mu4e-buffer \"om-temp-advice\")) > > '((name . \"om-temp-advice\")))" > > This is practically the same as my `, solution above, you just use > strings to protect some parts of code from evaluation, regular function > calls in places, and then you concat it all together and read it. The `, > syntax is optional, but without it you have to use list and quotes to > build up the code in a similar way: > > (let ((f (list > 'lambda () > (list 'message-box "Came from %s" (current-buffer) > (message-mail) > (add-hook
Re: [O] Display-level automatic subtree numbering
Le 24/10/2018 à 13h40, Nicolas Goaziou a écrit : > "Garreau, Alexandre" writes: > >> As said in the previously mentioned stackoverflow question: helps >> seeing where you are and how much sections are there. To me it is >> especially useful to avoid writing manually the number of the section to >> know I’m currently in “exercice 8” or something alike. > > But you don't need to number the whole buffer, do you? At least the screen. > A breadcrumb like feature could be enough. E.g., you hit at the > beginning of a headline and get the numbering in addition to the > outline path. I’d prefer. I find sad that all export backend supports this while raw emacs doesn’t. It is neat to see, and to, just by looking at the screen, which section has which number. >> Btw, some desirable feature as well would be automatic naming (as I >> already do sometimes in LaTeX), such as appending whole “Exercice 8” or >> “Section 8” for a desired specific level, instead of just a number. > > I don't understand what you mean. Getting displayed, given “* Foo”, instead of “* 3.2 — Foo”, “* Exercice 3.2 — Foo” (with this naming configurable).
Re: [O] [PATCH] migrate ob-clojure initiate session code from ob-clojure-literate.el into ob-clojure.el
Hello, stardiviner writes: > Nicolas Goaziou writes: > > Hi, sorry for late response, because I'm a little lazy on give effort on > review my patch and improve it again. But now I finished it. Actually I > corrected my patch as soon as you replied email with mentioned. Today I > pick up this task again, and add a new improve which support CIDER new > API which using sesman to manage REPL sessions. OK. So does it qualify as a bug fix, i.e., should that go into master branch, or is it a new feature, for next branch? BTW, there are some compilation warning: --8<---cut here---start->8--- Compiling /home/ngz/dev/org-mode/lisp/ob-clojure.el... In toplevel form: ob-clojure.el:215:1:Warning: Unused lexical variable ‘sesman-system’ In org-babel-clojure-initiate-session: ob-clojure.el:225:47:Warning: reference to free variable ‘cider-version’ In end of data: ob-clojure.el:278:1:Warning: the function ‘cider-repls’ is not known to be defined. --8<---cut here---end--->8--- Could you fix them? Thank you. Regards, -- Nicolas Goaziou
Re: [O] Display-level automatic subtree numbering
"Garreau, Alexandre" writes: > As said in the previously mentioned stackoverflow question: helps > seeing where you are and how much sections are there. To me it is > especially useful to avoid writing manually the number of the section to > know I’m currently in “exercice 8” or something alike. But you don't need to number the whole buffer, do you? A breadcrumb like feature could be enough. E.g., you hit at the beginning of a headline and get the numbering in addition to the outline path. > Btw, some desirable feature as well would be automatic naming (as I > already do sometimes in LaTeX), such as appending whole “Exercice 8” or > “Section 8” for a desired specific level, instead of just a number. I don't understand what you mean.
Re: [O] electric-pair, autopair, smartparens, etc in org-mode
On Wednesday, 24 Oct 2018 at 12:38, Roland Everaert wrote: > Pleased to see it was helpful. The funny thing is that I use that config > for, maybe, 10 years and never think about changing it. I've been using emacs for well over 30 years now. You would not believe the crud that has built up in my config files... ;-) :Q Mind you, with org, I have started rationalizing the config files but it's a time consuming task and the adage of "if it ain't broke, don't fix it" has power... -- Eric S Fraga via Emacs 27.0.50, Org release_9.1.13-783-g97fac4
Re: [O] electric-pair, autopair, smartparens, etc in org-mode
I will borrow your config for the emphasis symbols, but for all the paren-related symbols, I will keep the global mapping, so it will still work when writing codes and the like ;) Pleased to see it was helpful. The funny thing is that I use that config for, maybe, 10 years and never think about changing it. stardiviner writes: > Roland Everaert writes: > >> Hi, >> >> I use the following configuration: >> >> parenthèses, accolades et brackets ;; >> (setq skeleton-pair t) >> (global-set-key "[" 'skeleton-pair-insert-maybe) >> (global-set-key "{" 'skeleton-pair-insert-maybe) >> (global-set-key "(" 'skeleton-pair-insert-maybe) >> (global-set-key "\"" 'skeleton-pair-insert-maybe) >> (global-set-key "'" 'skeleton-pair-insert-maybe) >> >> This will only close the defined characters. >> >> >> Hope this will help. >> >> Roland. >> > > This is really helpful for me, I use smartparens before, but it is a little > heavy. So I disabled it. I found your solution is simple and fast. I modified > a little: > > #+begin_src emacs-lisp > (require 'skeleton) > (setq skeleton-pair t) > > (define-key org-mode-map (kbd "~") 'skeleton-pair-insert-maybe) > (define-key org-mode-map (kbd "=") 'skeleton-pair-insert-maybe) > (define-key org-mode-map (kbd "*") 'skeleton-pair-insert-maybe) > (define-key org-mode-map (kbd "+") 'skeleton-pair-insert-maybe) > > (define-key org-mode-map (kbd "[") 'skeleton-pair-insert-maybe) > (define-key org-mode-map (kbd "{") 'skeleton-pair-insert-maybe) > (define-key org-mode-map (kbd "(") 'skeleton-pair-insert-maybe) > (define-key org-mode-map (kbd "\"") 'skeleton-pair-insert-maybe) > (define-key org-mode-map (kbd "'") 'skeleton-pair-insert-maybe) > #+end_src -- Luke, use the FOSS Sent from Emacs
Re: [O] Display-level automatic subtree numbering
Le 24/10/2018 à 09h38, Nicolas Goaziou a écrit : > Hello, > > "Garreau, Alexandre" writes: > >> But that doesn’t answer the question: why “doesn’t it exist”? shouldn’t >> these functions be mainlined, if legally permitted? > > What kind of numbering are we talking about? A semi-permanent (i.e., > togglable) naive numbering (e.g., not taking into account UNNUMBERED > property) for every headline? Yes. Didn’t know about UNNUMBERED, thanks, it is of interest for this issue. > Could you explain what are the use cases for that? As said in the previously mentioned stackoverflow question: helps seeing where you are and how much sections are there. To me it is especially useful to avoid writing manually the number of the section to know I’m currently in “exercice 8” or something alike. Btw, some desirable feature as well would be automatic naming (as I already do sometimes in LaTeX), such as appending whole “Exercice 8” or “Section 8” for a desired specific level, instead of just a number.
Re: [O] Inline code block syntax highlighting absence
Hello, stardiviner writes: > Garreau, Alexandre writes: > >> Why is there no syntax highlighting for *inline* source/code blocks? >> >> For instance, if I type the following: >> >> #+BEGIN_SRC org >> src_emacs-lisp{(foo bar (quux))} >> #+END_SRC >> >> The underscore is not displayed, “emacs” is displayed in face >> ~org-latex-and-related~ *and* in subscript display (smaller and >> negatively raised), and all the rest in default face, with no syntax >> highlighting, even inside the braces (that I would expect as it is done >> inside non-inline blocks). > > I used to asked similar question, and answered my own question with > a font-lock solution. This link might be helpful. > https://stackoverflow.com/questions/20309842/how-to-syntax-highlight-for-org-mode-inline-source-code-src-lang Would you want to provide a patch for that? Thank you. Regards, -- Nicolas Goaziou
Re: [O] Display-level automatic subtree numbering
Hello, "Garreau, Alexandre" writes: > But that doesn’t answer the question: why “doesn’t it exist”? shouldn’t > these functions be mainlined, if legally permitted? What kind of numbering are we talking about? A semi-permanent (i.e., togglable) naive numbering (e.g., not taking into account UNNUMBERED property) for every headline? Could you explain what are the use cases for that? Regards, -- Nicolas Goaziou
Re: [O] [PATCH] org-capture: fix capture breaking next headline
Hello, Martin Yrjölä writes: > I have noticed my capture workflow breaking org document hierarchies. > Here is an example: > > Start with the org document: > > * A > * B > > An org capture template inserts a headline under A. > > * A > ** [point here] > * B > > When I navigate to the end of the narrowed capture buffer (e.g. > `(end-of-buffer)') and insert text, it will break the B headline like > this: > > * A > ** > inserted text[point here]* B > > I expected the following behavior > > * A > ** inserted text[point here] > * B > [...] > --- > lisp/org-capture.el | 2 +- > testing/lisp/test-org-capture.el | 15 +++ > 2 files changed, 16 insertions(+), 1 deletion(-) > > diff --git a/lisp/org-capture.el b/lisp/org-capture.el > index cbc72d43b..fb445d22b 100644 > --- a/lisp/org-capture.el > +++ b/lisp/org-capture.el > @@ -1139,7 +1139,7 @@ may have been stored before." >(unless (org-at-heading-p) (outline-next-heading)) >(let ((end (point))) > (org-capture-mark-kill-region beg end) > - (org-capture-narrow beg end) > + (org-capture-narrow beg (1- end)) > (when (or (re-search-backward "%\\?" beg t) > (re-search-forward "%\\?" end t)) > (replace-match "")) > diff --git a/testing/lisp/test-org-capture.el > b/testing/lisp/test-org-capture.el > index 31522c1f2..351fe5101 100644 > --- a/testing/lisp/test-org-capture.el > +++ b/testing/lisp/test-org-capture.el > @@ -160,6 +160,21 @@ > (org-capture-kill)) >(buffer-string) > > +(ert-deftest test-org-capture/insert-at-end-safe () > + "Test that capture does not break next headline." > + (should > + (equal > +"* A\n** H1 Capture text\n* B\n" > +(org-test-with-temp-text-in-file "* A\n* B\n" > + (let* ((file (buffer-file-name)) > + (org-capture-templates > + `(("t" "Todo" entry (file+headline ,file "A") "** H1 %?" > + (org-capture nil "t") > + (goto-char (point-max)) > + (insert "Capture text") > + (org-capture-finalize)) > + (buffer-string) Fixed. I used a slightly different fix, but kept your test. Thank you. Regards, -- Nicolas Goaziou
Re: [O] [feature proposal] Export in foreign buffers - ASCII (ox-ascii)
Hello, Alexander Adolf writes: > I was missing convert-region functions in the ox-ascii export back-end > as are provided by the HTML, LaTeX, Texinfo, and MarkDown back-ends [1], > and hence crafted my own (copied below) to go into my init file. My use > case is composing emails using notmuch-message-mode. > > [1] https://orgmode.org/manual/Export-in-foreign-buffers.html > > I though this feature might be useful to others, too, and would likely > also seem a low hanging fruit to implement? ;-)) It looks like an omission, indeed. > (defun org-ascii-convert-region-to-ascii () > "Assume the current region has org-mode syntax, and convert it to plain > ASCII. > This can be used in any buffer. For example, you could write an > itemized list in org-mode syntax in a Mail buffer and then use > this command to convert it." > (interactive) > (let ((my/org-ascii-charset org-ascii-charset)) > (setq org-ascii-charset 'ascii) > (org-export-replace-region-by 'ascii) > (setq org-ascii-charset my/org-ascii-charset))) I see you are not including Latin1 export. Is there any reason to implement pure ASCII export? Wouldn't UTF-8 be sufficient? More generally, I wonder if, in 2018, it still makes sense to provide ASCII-only and Latin1 export. > (defun org-ascii-convert-region-to-utf8 () > "Assume the current region has org-mode syntax, and convert it to UTF-8. Org syntax > This can be used in any buffer. For example, you could write an > itemized list in org-mode syntax in a Mail buffer and then use in Org syntax in a mail buffer Anyway, I don't think the example is useful. > this command to convert it." > (interactive) > (let ((my/org-ascii-charset org-ascii-charset)) > (setq org-ascii-charset 'utf-8) > (org-export-replace-region-by 'ascii) > (setq org-ascii-charset my/org-ascii-charset))) I think (let ((org-ascii-charset 'utf-8)) (org-export-replace-region-by 'ascii)) would be simpler. The manual needs to be updated, too. Thank you. Regards, -- Nicolas Goaziou