[O] patch for custom colored links in org-mode
Hi all, I tried this aproach to enable custom colored links in org-mode if an org-link-type face is defined. If no face is applied, then it just gets the default org-link face For example this will make all doi links red. (defface org-link-doi `((t (:inherit org-link :foreground "red"))) "Color for doi links.") It seems to work pretty well for me. What do you think about making this a feature in org-mode? diff --git a/lisp/org.el b/lisp/org.el index af68539..f1c500d 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5851,14 +5851,19 @@ prompted for." "Add link properties for plain links." (when (and (re-search-forward org-plain-link-re limit t) (not (org-in-src-block-p))) -(let ((face (get-text-property (max (1- (match-beginning 0)) (point-min)) - 'face)) - (link (org-match-string-no-properties 0))) +(let* ((face (get-text-property (max (1- (match-beginning 0)) (point-min)) + 'face)) + (link (org-match-string-no-properties 0)) + (type (org-match-string-no-properties 1)) + (link-face-symbol (intern (format "org-link-%s" type))) + (link-face (if (facep link-face-symbol) + link-face-symbol + 'org-link))) (unless (if (consp face) (memq 'org-tag face) (eq 'org-tag face)) (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) (add-text-properties (match-beginning 0) (match-end 0) (list 'mouse-face 'highlight - 'face 'org-link + 'face link-face 'htmlize-link `(:uri ,link) 'keymap org-mouse-map)) (org-rear-nonsticky-at (match-end 0)) @@ -6340,8 +6345,8 @@ needs to be inserted at a specific position in the font-lock sequence.") ;; Links (if (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend))) (if (memq 'angle lk) '(org-activate-angle-links (0 'org-link t))) - (if (memq 'plain lk) '(org-activate-plain-links (0 'org-link t))) - (if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t))) + (if (memq 'plain lk) '(org-activate-plain-links (0 'org-link))) + (if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link))) (if (memq 'radio lk) '(org-activate-target-links (1 'org-link t))) (if (memq 'date lk) '(org-activate-dates (0 'org-date t))) (if (memq 'footnote lk) '(org-activate-footnote-links)) -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu
[O] Two numerical solutions from fsolve inside calc source block
Hi, I have this block which is intended to get the two numerical solutions of the equations system: #+begin_src calc fsolve([8.66e10 = r * v, -7.51e6 = 0.5*v^2 - 6.67e-11*6e24/r],[r,v]) #+end_src This way I get the generic form of a multiple solution, and citing the manual "It will invent variables n1, n2, …, which represent independent arbitrary integers, and s1, s2, …, which represent independent arbitrary signs (either +1 or -1)." So I get #+RESULTS: : [r = 866. / (4621.24711316 - 2517.12631405 s1), v = 4621.24711316 - 2517.12631405 s1] Now, to get the two solutions I have to evaluate manually the result expression replacing s1 by "*1" and "*-1" #+begin_src calc [r = 866. / (4621.24711316 - 2517.12631405 *1), v = 4621.24711316 - 2517.12631405 *1] #+end_src #+RESULTS: : [r = 41157332.8093, v = 2104.12079911] And #+begin_src calc [r = 866. / (4621.24711316 - 2517.12631405 *-1), v = 4621.24711316 - 2517.12631405 *-1] #+end_src #+RESULTS: : [r = 12131615.2598, v = 7138.37342721] Emacs calc manual states "Note that variables like n1 and s1 are not given any special interpretation in Calc except by the equation solver itself. As usual, you can use the s l (calc-let) command to obtain solutions for various actual values of these variables.", but I cannot figure out a way to call (calc-let) or its algebraic equivalent inside a calc source block. I can accept a only-elisp workaround if it is more convenient. Any hint to do everything commented without user interaction? Regards.
[O] [PATCH] Make links colored if a custom link face exists.
--- lisp/org.el | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index af68539..f1c500d 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5851,14 +5851,19 @@ prompted for." "Add link properties for plain links." (when (and (re-search-forward org-plain-link-re limit t) (not (org-in-src-block-p))) -(let ((face (get-text-property (max (1- (match-beginning 0)) (point-min)) - 'face)) - (link (org-match-string-no-properties 0))) +(let* ((face (get-text-property (max (1- (match-beginning 0)) (point-min)) + 'face)) + (link (org-match-string-no-properties 0)) + (type (org-match-string-no-properties 1)) + (link-face-symbol (intern (format "org-link-%s" type))) + (link-face (if (facep link-face-symbol) + link-face-symbol + 'org-link))) (unless (if (consp face) (memq 'org-tag face) (eq 'org-tag face)) (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) (add-text-properties (match-beginning 0) (match-end 0) (list 'mouse-face 'highlight - 'face 'org-link + 'face link-face 'htmlize-link `(:uri ,link) 'keymap org-mouse-map)) (org-rear-nonsticky-at (match-end 0)) @@ -6340,8 +6345,8 @@ needs to be inserted at a specific position in the font-lock sequence.") ;; Links (if (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend))) (if (memq 'angle lk) '(org-activate-angle-links (0 'org-link t))) - (if (memq 'plain lk) '(org-activate-plain-links (0 'org-link t))) - (if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t))) + (if (memq 'plain lk) '(org-activate-plain-links (0 'org-link))) + (if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link))) (if (memq 'radio lk) '(org-activate-target-links (1 'org-link t))) (if (memq 'date lk) '(org-activate-dates (0 'org-date t))) (if (memq 'footnote lk) '(org-activate-footnote-links)) -- 2.4.4
Re: [O] Programmatically constructing org documents
I don't know if there is a "correct" way. It might depend on how sophisticated the document is. I usually use strings and format. Sometimes that is a pain though, if there is a lot of conditional formatting. So the question is which is easier for your situation, and I would say easier is "correct" ;) Arun Isaac writes: > What is the "correct" way to programmatically construct org documents? > > Should I construct a parse tree, and then use > `org-element-interpret-data' to convert it org syntax? > > Or, should I use string and buffer functions (such as `format' and > `insert') to construct org syntax directly? > > Thank you, > Arun Isaac. -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu
Re: [O] Nested ordered (numbered) lists
On Saturday, 25 Jun 2016 at 19:34, ST wrote: > Hi, > > is there a way to produce nested ordered (numbered) lists and get it > exported (to pdf/html) properly? Like: > > 1. item_1 > 2. item_2 >2.1. subitem_2_1 > 2.1.1. subsubitem_2_1_1 >2.2. subitem_2_2 > 3. item_3 For pdf export, you can use LaTeX settings, as described in https://vantr.wordpress.com/2011/12/16/multi-level-enumerated-list-in-latex/ For HTML, I have no idea. Sorry. -- : Eric S Fraga (0xFFFCF67D), Emacs 25.0.94.1, Org release_8.3.4-869-gf2c421
[O] export to ics a specific buffer every X hours
Hi all so i have pathetic coding skill but managed somehow to come up with this (defun z/save-meeting-to-ics () "If the current file is in '~/.dotfiles', the code blocks are tangled" (when (equal (buffer-file-name) (expand-file-name "/home/zeltak/org/files/agenda/ meetings.org")) (org-icalendar-export-to-ics) (message "exported to ics"))) this does save the org file "meetings.org" to an ICS file in the same folder as the file. but i want to do 2 additional things: 1)save the resulting ICS file to a different directory 2)run this function every X hours (lets say every 2 hours) any clue guys? thx! Z
[O] using property drawer to track header creation and last change?
Hi all is there a way to auto have entries in the property drawer to to track header creation and last change of the header? anyone using something like this? best Z
Re: [O] using property drawer to track header creation and last change?
You might adapt something like this http://emacs.stackexchange.com/questions/12369/automatic-clocking-in-org-mode-when-moving-into-section On Sunday, June 26, 2016, Xebar Saram wrote: > Hi all > > is there a way to auto have entries in the property drawer to to track > header creation and last change of the header? anyone using something like > this? > > best > > Z > -- John --- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu
Re: [O] export to ics a specific buffer every X hours
Hi, I don't know if this would help, but I export an Org buffer every time it is saved. On OS X, I have a LaunchAgent that watches the file: http://www.apple.com/DTDs/PropertyList-1.0.dtd";> Label com.kenmankoff.org2ical ProgramArguments /Users/mankoff/bin/org2ical.sh WatchPaths /Users/mankoff/Documents/Org/events.org And then the shell script that is executed: /Applications/Emacs.app/Contents/MacOS/Emacs --batch --directory=~/Documents/Org --visit=~/Documents/Org/events.org --eval '(progn (setq org-agenda-default-appointment-duration 1) (org-icalendar-export-to-ics))' -k.
Re: [O] Programmatically constructing org documents
> I don't know if there is a "correct" way. It might depend on how > sophisticated the document is. I usually use strings and format. > Sometimes that is a pain though, if there is a lot of conditional > formatting. So the question is which is easier for your situation, and I > would say easier is "correct" ;) Fair enough. Sounds good. Thank you.
[O] patch to make descriptive display link type dependent
The attached patch makes it possible to make some links not descriptively if a variable for the link is defined and its value is not 'org-link. There are a few scenarios where this would be good. In org-ref I apply an advice to the activate-bracket-link function to undo the descriptive link showing for cite links which use the description for additional information like page numbers. Another use that inspired this is a set of commenting links that might look like: [[replace:JK some old text][some new text]] where it might be desirable to see the whole link, but keep other descriptive links in the descriptive form. Thoughts? >From 591cd3487591dca3d55c1c7a6c2c6039771388ef Mon Sep 17 00:00:00 2001 From: John Kitchin Date: Sun, 26 Jun 2016 18:27:51 -0400 Subject: [PATCH] make individual bracket links invisible To: emacs-orgmode@gnu.org if org-link-type-visibility is 'org-link or non-existant the link type will behave normallay. If not, it will not be folded so the path and descripbtion is visible. --- lisp/org.el | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index f1c500d..b41d139 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6048,11 +6048,17 @@ by a #." (defun org-activate-bracket-links (limit) "Add text properties for bracketed links." (if (and (re-search-forward org-bracket-link-regexp limit t) - (not (org-in-src-block-p))) + (not (org-in-src-block-p))) (let* ((hl (org-match-string-no-properties 1)) (help (concat "LINK: " (save-match-data (org-link-unescape hl + (type (save-match-data + (string-match "\\(.*?\\):" hl) + (match-string 1 hl))) (ip (org-maybe-intangible - (list 'invisible 'org-link + (list 'invisible (let ((li (intern (format + "org-link-%s-invisibility" + type + (if (boundp li) (symbol-value li) 'org-link)) 'keymap org-mouse-map 'mouse-face 'highlight 'font-lock-multiline t 'help-echo help 'htmlize-link `(:uri ,hl -- 2.4.4 -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu