Re: Question Regarding Yasnippet With Org Mode (Emacs 27.2)
Samuel Banya writes: Do you think that maybe changing the setting you had mentioned before, 'org-src-tab-acts-natively' to false (aka nil or '0' (zero) value) via a change in my configuration would make this error not happen within Org-Mode in that case? Yes, that should work. I have not tested it though. Regards, -- Sébastien Miquel
[RFH] thoughts on porting an Emacs etc/schema/ change
I'm trying to figure out how to port changes to etc/schema/ files in the Emacs repo back to the Org repo. I'd appreciate feedback from anyone who knows anything about the etc/schema/ files in Org's tree and/or ox-odt. Background == Org has a few files in etc/schema: org$ git ls-files --stage etc/schema 100644 87f84d1ea87e1e0eef759fac1bd7db74ce0a704e 0 etc/schema/od-manifest-schema-v1.2-os.rnc 100644 8d679d62e4ef1a21707250cf4cabcd5b657d7683 0 etc/schema/od-schema-v1.2-os.rnc 100644 f1e0ed7856f24c58488bbeac1df922a7d5100776 0 etc/schema/schemas.xml Two of those are in Emacs's tree as is: emacs$ git ls-tree -r origin/emacs-27 -- etc/schema/ | grep od 100644 blob 87f84d1ea87e1e0eef759fac1bd7db74ce0a704e etc/schema/od-manifest-schema-v1.2-os.rnc 100644 blob 8d679d62e4ef1a21707250cf4cabcd5b657d7683 etc/schema/od-schema-v1.2-os.rnc The contents of Org's etc/schema/schemas.xml, on the other hand, are _added_ within Emacs's etc/schema/schemas.xml. org$ git show f1e0ed7856f24c58488bbeac1df922a7d5100776 http://thaiopensource.com/ns/locating-rules/1.0;> emacs$ git show origin/emacs-27:etc/schema/schemas.xml | wc -l 65 emacs$ git show origin/emacs-27:etc/schema/schemas.xml | grep -i 'opendoc\|od-' Changes on the Emacs master branch == A commit on Emacs's master branch (author cc'd) makes changes to these files. emacs $ git ls-tree -r master -- etc/schema/ | grep od 100644 blob 87f84d1ea87e1e0eef759fac1bd7db74ce0a704e etc/schema/od-manifest-schema-v1.2-os.rnc emacs$ git show --numstat --format=%B f1f351def3d84813d2c4b2174dfef07b01bec058 Update rnc to use Open Document's Relax-NG schema to version 1.3 * Use the LibreOffice Relax-NG files since they include a hack to support 1.2. * rng source: https://raw.githubusercontent.com/freedesktop/libreoffice-core/master/ schema/libreoffice/OpenDocument-schema-v1.3%2Blibreoffice.rng * translation to rnc with trang: trang -I rng -O rnc OpenDocument-schema-v1.3+libreoffice.rng \ OpenDocument-schema-v1.3+libreoffice.rnc 892 0 etc/schema/OpenDocument-schema-v1.3+libreoffice.rnc 59145780etc/schema/{od-schema-v1.2-os.rnc => OpenDocument-schema-v1.3.rnc} 5 1 etc/schema/schemas.xml Here are the changes to schemas.xml: emacs$ git diff f1f351def3d84813d2c4b2174dfef07b01bec058^- etc/schema/schemas.xml diff --git a/etc/schema/schemas.xml b/etc/schema/schemas.xml index 7fd91b8c72..f8acb0d40c 100644 --- a/etc/schema/schemas.xml +++ b/etc/schema/schemas.xml @@ -31,6 +31,10 @@ http://relaxng.org/ns/structure/1.0; typeId="RELAX NG"/> http://thaiopensource.com/ns/locating-rules/1.0; uri="locate.rnc"/> + + + + @@ -59,7 +63,7 @@ - + Porting to Org's tree = So, coming back to the Org repo, I guess that'd be * delete the od-schema-v1.2-os.rnc file and add OpenDocument-schema-v1.3.rnc * update the typeID line for od-schema-v1.2-os.rnc in Org's etc/schema/schemas.xml to match the OpenDocument-schema-v1.3+libreoffice.rnc line in the diff above * add the namespace lines to Org's etc/schema/schemas.xml (?) But I know nothing about those files or ox-odt, so testing it on my end would mostly be fumbling around to see if I spot any breakage when exporting with ox-odt. Does the above approach look reasonable? Will it break ox-odt or be problematic for some other reason?
Re: Sad tweet
Ypo writes: > I've read this: > > "Contributing to Emacs is so frustrating. It's not worth it for minor > things and if I cannot get some experience and confidence with minor > things, then I likely won't ever make major contributions." > https://twitter.com/magit_emacs/status/1396536686570610697?s=19 Do you know if there is any more context around that? Did Jonas mention any specific pain points around contributing to Emacs and/or concrete things that he thinks could be improved? Last time I'd seen him post on emacs-devel it seemed like things were going fairly smoothly with his work on adding transient to Emacs(?).
Re: Question Regarding Yasnippet With Org Mode (Emacs 27.2)
hi, Sam, i was thinking you might be happier, or at least experiment, *without* =org-tempo=. so, if you customize =org-modules=, and see =org-tempo= enabled there, you might try disabling it. (to move one more chance Org is getting in the way of yasnippet.) but, i don't know if this will help. also, the advice from Sébastien Miquel seems based on more actual knowledge. cheers, Greg
Re: Question Regarding Yasnippet With Org Mode (Emacs 27.2)
Hey there Greg, Gotcha. Just to confirm, you're saying I should add a "(require 'org-tempo)" in my Emacs config in that case? Or are you saying that I should disable "org-modules" setting value by setting it to nil or '0' (zero)? If that is the case, what would be the syntax to do this change? Just wanted to ask since I'd be happy to make the changes my config to see if that would help, but needed to know what you meant for me to try out to fix the issue. Thanks, Sam On Sun, May 23, 2021, at 4:33 PM, Greg Minshall wrote: > Samuel, > > i think that by default, Org no longer listens to, e.g., = but, if you load =org-tempo=, it still does. i wonder if you might see > if you are loading =org-tempo= (maybe [C-h v org-modules]), disable > that, and see if that clears away some of the underbrush. > > (you can get something like the old behavior with =C-c C-,=.) > > i use yasnippet to expand = > # key: # name: latex equation environment > # -- > \begin{equation} > $0 > \end{equation} > > and, that works for me. > > if i re-format your snippet (maybe this was the original formatting?) > > # name: src > # key: # -- > #+BEGIN_SRC $1 > $0 > #+END_SRC > > > and open an org file, = name and then =[TAB]= to commit. if i commit with =[RET]= instead, it > still *seems* to work (in terms of the buffer contents), but i get this > message > > [yas] Committing snippets. Action would destroy a protection overlay. > > > i didn't run into any lisp errors. > > in case any of that helps. > > cheers, Greg >
Re: Question Regarding Yasnippet With Org Mode (Emacs 27.2)
Hey Sébastien, Thanks for this insight. Do you think that maybe changing the setting you had mentioned before, 'org-src-tab-acts-natively' to false (aka nil or '0' (zero) value) via a change in my configuration would make this error not happen within Org-Mode in that case? On a related note, I use Emacs Org Mode every day for my support job, and am super thankful it exists. I have never been more productive in the last 2 years switching to Emacs than I ever have been in my entire life, so just wanted to say thanks to the best piece of software on earth. Thanks again, Sam On Sun, May 23, 2021, at 9:18 PM, Sébastien Miquel wrote: > Hi Samuel, > > > I'm guessing its some kind of Org Mode vs Yasnippet issue where > > Org-mode is expanding it too fast, when it should wait for user input > > hence the "$1" section. > > I guess yasnippet tries to indent the inside of the block (see > =yas-indent-line=) before the lang part of the src block is specified. > > In Emacs 27.2, the default value of =org-src-tab-acts-natively= was > changed to `t`. With this setting, trying to indent a src block with > no language results in this error. > > -- > Sébastien Miquel > >
Sad tweet
I've read this: "Contributing to Emacs is so frustrating. It's not worth it for minor things and if I cannot get some experience and confidence with minor things, then I likely won't ever make major contributions." https://twitter.com/magit_emacs/status/1396536686570610697?s=19
Re: Question Regarding Yasnippet With Org Mode (Emacs 27.2)
Hi Samuel, I'm guessing its some kind of Org Mode vs Yasnippet issue where Org-mode is expanding it too fast, when it should wait for user input hence the "$1" section. I guess yasnippet tries to indent the inside of the block (see =yas-indent-line=) before the lang part of the src block is specified. In Emacs 27.2, the default value of =org-src-tab-acts-natively= was changed to `t`. With this setting, trying to indent a src block with no language results in this error. -- Sébastien Miquel
Re: Bug: [PATCH] Can't set background color of latex fragment
Hi, Here's a patch that fixes this bug by calling `dvipng' with the `-bg Transparent' argument only when no background color is set. Regards, -- Sébastien Miquel >From 5872fc3143162fbda11cf2aa5a3798567664be99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= Date: Sun, 23 May 2021 22:07:25 +0200 Subject: [PATCH] org.el (org-create-formula-image): Fix ignored background color * lisp/org.el (org-preview-latex-process-alist): add a `:transparent-image-converter' property for `dvipng'. (org-create-formula-image): If available, use `:transparent-image-converter' when no background color is set. --- lisp/org.el | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 1bd9e02eb..d544e62fb 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -3319,7 +3319,9 @@ All available processes and theirs documents can be found in :image-output-type "png" :image-size-adjust (1.0 . 1.0) :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f") - :image-converter ("dvipng -D %D -T tight -bg Transparent -o %O %f")) + :image-converter ("dvipng -D %D -T tight -o %O %f") + :transparent-image-converter + ("dvipng -D %D -T tight -bg Transparent -o %O %f")) (dvisvgm :programs ("latex" "dvisvgm") :description "dvi > svg" @@ -3374,6 +3376,9 @@ PROPERTIES accepts the following attributes: given to the shell and supports any of the following place-holders defined below. +If set, :transparent-image-converter is used instead of :image-converter to +convert an image when the background color is nil or \"Transparent\". + Place-holders used by `:image-converter' and `:latex-compiler': %finput file name @@ -16288,7 +16293,6 @@ a HTML file." org-format-latex-header 'snippet))) (latex-compiler (plist-get processing-info :latex-compiler)) - (image-converter (plist-get processing-info :image-converter)) (tmpdir temporary-file-directory) (texfilebase (make-temp-name (expand-file-name "orgtex" tmpdir))) @@ -16302,7 +16306,11 @@ a HTML file." "Black")) (bg (or (plist-get options (if buffer :background :html-background)) "Transparent")) - (log-buf (get-buffer-create "*Org Preview LaTeX Output*")) + (image-converter + (or (and (string= bg "Transparent") + (plist-get processing-info :transparent-image-converter)) + (plist-get processing-info :image-converter))) + (log-buf (get-buffer-create "*Org Preview LaTeX Output*")) (resize-mini-windows nil)) ;Fix Emacs flicker when creating image. (dolist (program programs) (org-check-external-command program error-message)) -- 2.31.1
Re: Bug: Double trailing slash for default candidate in org-refile-get-target [9.4 (9.4-7-g3eccc5-elpaplus @ /home/gustavo/.emacs.d/elpa/org-plus-contrib-20200921/)]
Hi Bhavin, On Sun, 23 May 2021 at 15:05, Bhavin Gandhi wrote: Finally after spending a couple of hours, I was able to understand the code of org-refile-get-location \o/. The detailed bug report helped me to understand the issue. I'm attaching a patch here which should fix the problem, it has other details as well. I have tested a few basic scenarios as mentioned in the report. Thank you very much for working on this patch. I couldn't offer it myself (out of my legal bounds) and had gone as far as I was allowed to here, so I'm happy you took it from there. The patch looks good to me, and corresponds to my analysis of the problem and suggested fix. I have only one minor nitpick: you could go with a simple `let' there, instead of a `let*', since we only have one let-bound variable there anyway. About: [...] it has other details as well. As far as I could see, we are very much aligned on the problem and fix. But perhaps I'm missing something, could you elaborate on that? Thanks again. Best, Gustavo.
Re: Bug: Double trailing slash for default candidate in org-refile-get-target [9.4 (9.4-7-g3eccc5-elpaplus @ /home/gustavo/.emacs.d/elpa/org-plus-contrib-20200921/)]
Hi Bhavin! Great to see you on the mailing list :) Thank you so much for looking at the bugs, investigating one, /and/ working out a fix. That's absolutely fantastic of you! For cumulative contributions under 15 (non-trivial) lines from a contributor (such as yourself) we can accept (i.e. merge without FSF papers) the changes and with a "TINYCHANGE" line at the end of the commit message --- but I see you've noticed this and have a nicely formatted commit message, brilliant! Thanks again, and I hope to see you around, Timothy. p.s. For merging hopefully someone like Nicolas or Bastien will be able to take a look at the commit. It looks good to me though :) Bhavin Gandhi writes: > Finally after spending a couple of hours, I was able to understand the code > of org-refile-get-location \o/. The detailed bug report helped me to > understand the issue. I'm attaching a patch here which should fix the > problem, it has other details as well. I have tested a few basic scenarios > as mentioned in the report. > > OTOH, I haven't signed the FSF Copyright assignment yet, should I do it > before this gets merged or it can be done later?
Re: Bug: Double trailing slash for default candidate in org-refile-get-target [9.4 (9.4-7-g3eccc5-elpaplus @ /home/gustavo/.emacs.d/elpa/org-plus-contrib-20200921/)]
Finally after spending a couple of hours, I was able to understand the code of org-refile-get-location \o/. The detailed bug report helped me to understand the issue. I'm attaching a patch here which should fix the problem, it has other details as well. I have tested a few basic scenarios as mentioned in the report. OTOH, I haven't signed the FSF Copyright assignment yet, should I do it before this gets merged or it can be done later? From 234316ed49023362d116d884ba7f2859e5f04c1b Mon Sep 17 00:00:00 2001 From: Bhavin Gandhi Date: Sun, 23 May 2021 23:07:13 +0530 Subject: [PATCH] org-refile: Fix double slashes in the refile targets * org-refile.el (org-refile-get-location): When we generate the `tbl' variable, we add extra slash depending on the value of `org-refile-use-outline-path'. This patch updates some locations which add another extra slash assuming the target did not have it. `org-refile--get-location' does lookup for entries with and without slash, so it was not causing any issues before. It works as it is now as well. Thanks to Gustavo Barros for a very detailed bug report. TINYCHANGE --- lisp/org-refile.el | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lisp/org-refile.el b/lisp/org-refile.el index bffad0a81..c4ac1c108 100644 --- a/lisp/org-refile.el +++ b/lisp/org-refile.el @@ -649,20 +649,18 @@ this function appends the default value from (setq old-hist org-refile-history) (setq answ (funcall cfunc prompt tbl nil (not new-nodes) nil 'org-refile-history - (or cdef (concat (car org-refile-history) extra + (or cdef (car org-refile-history (if (setq pa (org-refile--get-location answ tbl)) - (let* ((last-refile-loc (car org-refile-history)) - (last-refile-loc-path (concat last-refile-loc extra))) + (let* ((last-refile-loc (car org-refile-history))) (org-refile-check-position pa) (when (or (not org-refile-history) (not (eq old-hist org-refile-history)) - (not (equal (car pa) last-refile-loc-path))) + (not (equal (car pa) last-refile-loc))) (setq org-refile-history (cons (car pa) (if (assoc last-refile-loc tbl) org-refile-history (cdr org-refile-history - (when (or (equal last-refile-loc-path (nth 1 org-refile-history)) - (equal last-refile-loc (nth 1 org-refile-history))) + (when (equal last-refile-loc (nth 1 org-refile-history)) (pop org-refile-history))) pa) (if (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ) -- 2.31.1
Re: Question Regarding Yasnippet With Org Mode (Emacs 27.2)
Samuel, i think that by default, Org no longer listens to, e.g., =
Bug: org-table-clean-line may not return only | and space [9.4.4 (release_9.4.4 @ /home/tbb/code/emacs/emacs/lisp/org/)] [9.4.4 (release_9.4.4 @ /home/tbb/code/emacs/emacs/lisp/org/)]
Starting from emacs -Q: 1. C-x C-f test.org 2. Write something like the following: Here is a table: |Data1|Data2 3. Make sure to leave the last column without the "|" 4. C-o, with point at the table row. 5. I expected to get a clean row: Here is a table: | | | | Data1 | Data2 | but I got: Here is a table: | | Data2 | | Data1 | Data2 | I realize this might be a corner-case, but I'm used to leave the last column without "|", because TAB is smart enough to add it for me. So the "Data2" repetition becomes a little annoying. If I put point at the row | Data1 | Data2 the following: (org-table-clean-line (buffer-substring (line-beginning-position) (line-end-position))) evaluates to a string that has characters other than "|" and space, but org-table-clean-line says it returns a string with only "|" and space. I've tweaked the relevant regexp in org-table-clean-line to "|\\([ \t]*?[^ \t\r\n|][^\r\n|]*\\)|?" and that fixes it for me. Best regards, Mauro. Emacs : GNU Emacs 28.0.50 (build 5, i686-pc-linux-gnu, GTK+ Version 2.24.33, cairo version 1.16.0) of 2021-05-19 Package: Org mode version 9.4.4 (release_9.4.4 @ /home/tbb/code/emacs/emacs/lisp/org/)
Question Regarding Yasnippet With Org Mode (Emacs 27.2)
I haven't been able to utilize the Yasnippet I've been using to override the newer one that Org-Mode created aka ' :end # :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--exit :marker # :next nil))) :exit #s(yas--exit :marker # :next nil) :id 3 :control-overlay nil :active-field nil :previous-active-field nil :force-exit nil)) yas--indent(#s(yas--snippet :expand-env nil :fields (#s(yas--field :number 1 :start # :end # :parent-field nil :mirrors nil :transform nil :modified-p nil :next #s(yas--exit :marker # :next nil))) :exit #s(yas--exit :marker # :next nil) :id 3 :control-overlay nil :active-field nil :previous-active-field nil :force-exit nil)) #f(compiled-function () #)() funcall(#f(compiled-function () #)) (let nil (funcall '#f(compiled-function () #))) eval((let nil (funcall '#f(compiled-function () # yas--snippet-create("#+BEGIN_SRC $1\n $0\n#+END_SRC" nil 115534 115534) yas-expand-snippet(#s(yas--template :key "")) :group nil :perm-group nil :table #s(yas--table :name "org-mode" :hash # :uuidhash # :parents nil :direct-keymap (keymap))) 115534 115536) yas--expand-or-prompt-for-template((("src" . #s(yas--template :key "")) :group nil :perm-group nil :table #s(yas--table :name "org-mode" :hash # :uuidhash # :parents nil :direct-keymap (keymap) 115534 115536) yas-expand() funcall-interactively(yas-expand) call-interactively(yas-expand nil nil) command-execute(yas-expand) Thanks.
Re: Empty headline titles unsupported: Bug?
Nicolas Goaziou writes: >>> I suggest to not tag emptiness. `org-set-tags' could raise an error in >>> this case. >> >> Of course, we can go the other way around and recognise "* :myheadline:" >> as non-empty headline with no tags. > > There is no spoon^W way. Or, no way is satisfactory. "Don't tag empty > headlines" is better. > > In any case, I'm not convinced Org Element is wrong here. Either way is fine while it is consistent. I just tried to test some edge cases with existing org-element code: * TODO COMMENT :tag: org-element-at-point returns :raw-value "". * TODO :tag: :raw-value ":tag:" >> Though it will be more tricky than >> simply changing `org-set-tags' as you suggest. > > It probably boils down to changing `org-tag-line-re'. I didn't check > though. org-tag-line-re and also org-tag-group-re, I think. Best, Ihor
Re: Empty headline titles unsupported: Bug?
Ihor Radchenko writes: > Actually, my patch would solve the existing inconsistency. > Org mode already puts tag fontification on :tag: in "* :tag:" headline; > org-get-tags returns ("tag") on such headline; org-set-tags sets the > :tag: on "*" headline making it look like "* :tag:" (which is even > tested in test-org/set-tags); org-tag-line-re used across the > codebase also parses "* :tag:" as headline containing tags. It is only > the org-element parser that does not recognise the :tag: in empty > headline. > >> I suggest to not tag emptiness. `org-set-tags' could raise an error in >> this case. > > Of course, we can go the other way around and recognise "* :myheadline:" > as non-empty headline with no tags. There is no spoon^W way. Or, no way is satisfactory. "Don't tag empty headlines" is better. In any case, I'm not convinced Org Element is wrong here. > Though it will be more tricky than > simply changing `org-set-tags' as you suggest. It probably boils down to changing `org-tag-line-re'. I didn't check though. Regards,
Re: Empty headline titles unsupported: Bug?
Nicolas Goaziou writes: > Because, as I wrote, this is ambiguous. You cannot distinguish the > following two cases: > > * :mytag: > * :myheadline: Makes sense. > So, your patch would only move the problem elsewhere. Actually, my patch would solve the existing inconsistency. Org mode already puts tag fontification on :tag: in "* :tag:" headline; org-get-tags returns ("tag") on such headline; org-set-tags sets the :tag: on "*" headline making it look like "* :tag:" (which is even tested in test-org/set-tags); org-tag-line-re used across the codebase also parses "* :tag:" as headline containing tags. It is only the org-element parser that does not recognise the :tag: in empty headline. > I suggest to not tag emptiness. `org-set-tags' could raise an error in > this case. Of course, we can go the other way around and recognise "* :myheadline:" as non-empty headline with no tags. Though it will be more tricky than simply changing `org-set-tags' as you suggest. Best, Ihor
declaring :var in a property drawer
hi. i noticed the following behavior, and am curious if it is intentional. if i declare a :tangle and a :var in a property drawer and then, in that subtree, have N>1 source blocks (which will all end up in the same tangled file), the :var'iable will be assigned a value N times. below i have an example using bash source blocks, where it doesn't make sense, afaics(ee). (when exporting elisp blocks, each :var'iable is assigned a value in a =let= form that surrounds the code for that block, so i guess it makes sense.) cheers, Greg * :var's and property drawers :properties: :header-args: :tangle "foo.bar" :header-args+: :var x=1 :end: #+begin_src bash echo x is $x #+end_src #+begin_src bash echo "'x.*=.*1' occurences:" grep 'x.*=.*1' foo.bar | grep -v grep #+end_src
Re: Empty headline titles unsupported: Bug?
Hello, Ihor Radchenko writes: >> However, empty headline + tags is ambiguous. The right solution is to >> disambiguate it by inserting "something" as the headline you want to >> tag, like a non-breaking space. > > Yet, why not simply alter the headline parser a little bit to support > empty titles + tag? Because, as I wrote, this is ambiguous. You cannot distinguish the following two cases: * :mytag: * :myheadline: So, your patch would only move the problem elsewhere. I suggest to not tag emptiness. `org-set-tags' could raise an error in this case. Regards, -- Nicolas Goaziou
Bug: Add an option for org-html-self-link-headlines to add an anchor-link instead of making the headline a link. [9.4.5 (9.4.5-16-g94be20-elpaplus @ /home/lockywolf/.emacs.d/elpa/org-plus-contrib-2021
Hello, everyone! May I suggest a feature addition in org? The setting org-html-self-link-headlines at the moment turns headlines into links to themselves. While this is an excellent tool to make references to the "place where I am reading now", it is a bit confusing, because the reader may think that this link leads to some external valuable content. Would it be possible to, instead, add a small link, with the same href, and the visible part of something short, such as (#) or (*) hear the headline. Such "small anchors" are almost universally seen as "technical", and thus not leading to valuable content, but are still noticeable enough to just "copy link location" when required. Many thanks to people who develop org! Emacs : GNU Emacs 27.1 (build 1, x86_64-slackware-linux-gnu, GTK+ Version 3.24.24) of 2021-02-18 Package: Org mode version 9.4.5 (9.4.5-16-g94be20-elpaplus @ /home/lockywolf/.emacs.d/elpa/org-plus-contrib-20210412/) -- Vladimir Nikishkin (MiEr, lockywolf) (Laptop)
Re: [PATCH] org.el: use only link descriptions in indirect buffer names
Ihor Radchenko writes: > You can simply do (org-link-display-format (org-get-heading 'no-tags)) > > Best, > Ihor Oh!! I see that with my code I just reinvented the wheel :-D: --- org-link-display-format is a compiled Lisp function in ‘ol.el’. (org-link-display-format S) Replace links in string S with their description. If there is no description, use the link target. --- Thank you very much for the suggestion, Ihor! (new patch attached) Best regards, Juan Manuel >From b859f45abaa94e546e625b7b8c9f47ed64d6b4b4 Mon Sep 17 00:00:00 2001 From: Juan Manuel Macias Date: Sat, 22 May 2021 15:33:15 +0200 Subject: [PATCH] org.el: use only link descriptions in indirect buffer names * lisp/org.el (org-tree-to-indirect-buffer): If the variable `heading' contains a link with a description, it is replaced by the description string. --- lisp/org.el | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 1bd9e02eb..ca87cac67 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6895,8 +6895,7 @@ frame is not changed." (while (> (setq level (org-outline-level)) arg) (org-up-heading-safe))) (setq beg (point) - heading (org-get-heading 'no-tags)) + heading (org-link-display-format (org-get-heading 'no-tags))) (org-end-of-subtree t t) (when (org-at-heading-p) (backward-char 1)) (setq end (point))) -- 2.26.0
Re: [PATCH] org.el: use only link descriptions in indirect buffer names
Juan Manuel Macías writes: > + heading (replace-regexp-in-string > + org-link-bracket-re > + (lambda (x) > + (pcase (match-string 2 x) > + (`nil (match-string 1 x)) > + ((pred stringp) (match-string 2 x > + (org-get-heading 'no-tags))) You can simply do (org-link-display-format (org-get-heading 'no-tags)) Best, Ihor
Re: [PATCH] org-table.el: Fix usage of user-error
On 2021-05-23, 14:24 +0530, Utkarsh Singh wrote: Hi, This patch tries to fix usage of `user-error' in `org-table-convert-region' which is currently _not_ taking benefit of non-local exit of `user-error' function and using `if' to carry out it's operations. Please note that this is just an aesthetic improvement. Thank you, Utkarsh Singh -- Utkarsh Singh http://utkarshsingh.xyz
[PATCH] org-table.el: Fix usage of user-error
>From 96b1a0b6095ecefed0f7103ea1e08e325452d3a6 Mon Sep 17 00:00:00 2001 From: Utkarsh Singh Date: Sun, 23 May 2021 13:48:33 +0530 Subject: [PATCH] org-table.el: Fix usage of user-error * lisp/org-table.el (org-table-convert-region): Don't use `if' because Elisp has no concept of continuable errors. --- lisp/org-table.el | 88 +++ 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index cc69542f9..3e5563573 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -861,52 +861,52 @@ nil When nil, the command tries to be smart and figure out the (let* ((beg (min beg0 end0)) (end (max beg0 end0)) re) -(if (> (count-lines beg end) org-table-convert-region-max-lines) - (user-error "Region is longer than `org-table-convert-region-max-lines' (%s) lines; not converting" - org-table-convert-region-max-lines) - (when (equal separator '(64)) - (setq separator (read-regexp "Regexp for field separator"))) - (goto-char beg) - (beginning-of-line 1) - (setq beg (point-marker)) - (goto-char end) - (if (bolp) (backward-char 1) (end-of-line 1)) - (setq end (point-marker)) - ;; Get the right field separator - (unless separator - (goto-char beg) - (setq separator - (cond - ((not (re-search-forward "^[^\n\t]+$" end t)) '(16)) - ((not (re-search-forward "^[^\n,]+$" end t)) '(4)) - (t 1 +(when (> (count-lines beg end) org-table-convert-region-max-lines) + (user-error "Region is longer than `org-table-convert-region-max-lines' (%s) lines; not converting" + org-table-convert-region-max-lines)) +(when (equal separator '(64)) + (setq separator (read-regexp "Regexp for field separator"))) +(goto-char beg) +(beginning-of-line 1) +(setq beg (point-marker)) +(goto-char end) +(if (bolp) (backward-char 1) (end-of-line 1)) +(setq end (point-marker)) +;; Get the right field separator +(unless separator (goto-char beg) - (if (equal separator '(4)) - (while (< (point) end) - ;; parse the csv stuff + (setq separator (cond - ((looking-at "^") (insert "| ")) - ((looking-at "[ \t]*$") (replace-match " |") (beginning-of-line 2)) - ((looking-at "[ \t]*\"\\([^\"\n]*\\)\"") - (replace-match "\\1") - (if (looking-at "\"") (insert "\""))) - ((looking-at "[^,\n]+") (goto-char (match-end 0))) - ((looking-at "[ \t]*,") (replace-match " | ")) - (t (beginning-of-line 2 - (setq re (cond - ((equal separator '(4)) "^\\|\"?[ \t]*,[ \t]*\"?") - ((equal separator '(16)) "^\\|\t") - ((integerp separator) - (if (< separator 1) - (user-error "Number of spaces in separator must be >= 1") - (format "^ *\\| *\t *\\| \\{%d,\\}" separator))) - ((stringp separator) - (format "^ *\\|%s" separator)) - (t (error "This should not happen" - (while (re-search-forward re end t) - (replace-match "| " t t))) - (goto-char beg) - (org-table-align + ((not (re-search-forward "^[^\n\t]+$" end t)) '(16)) + ((not (re-search-forward "^[^\n,]+$" end t)) '(4)) + (t 1 +(goto-char beg) +(if (equal separator '(4)) + (while (< (point) end) + ;; parse the csv stuff + (cond + ((looking-at "^") (insert "| ")) + ((looking-at "[ \t]*$") (replace-match " |") (beginning-of-line 2)) + ((looking-at "[ \t]*\"\\([^\"\n]*\\)\"") + (replace-match "\\1") + (if (looking-at "\"") (insert "\""))) + ((looking-at "[^,\n]+") (goto-char (match-end 0))) + ((looking-at "[ \t]*,") (replace-match " | ")) + (t (beginning-of-line 2 + (setq re (cond + ((equal separator '(4)) "^\\|\"?[ \t]*,[ \t]*\"?") + ((equal separator '(16)) "^\\|\t") + ((integerp separator) + (if (< separator 1) + (user-error "Number of spaces in separator must be >= 1") + (format "^ *\\| *\t *\\| \\{%d,\\}" separator))) + ((stringp separator) + (format "^ *\\|%s" separator)) + (t (error "This should not happen" + (while (re-search-forward re end t) + (replace-match "| " t t))) +(goto-char beg) +(org-table-align))) ;;;###autoload (defun org-table-import (file separator) -- 2.31.1 -- Utkarsh Singh http://utkarshsingh.xyz