Re: [O] Disable typo-mode in org source code blocks
Hi John, this is a greet bit of info. My first thought when the question was asked was "Hmm, what you need is some sort of facility that could run a function when the cursor moves in and out of a region". I then discounted the idea because of the amount of supporting functionality which would need to be developed. The pointer to cursor-sensor sounds like exactly the supporting functionality I was thinking of. Should have guessed Emacs would have something already! Using org's font-lock mechanism as the 'trigger' is a great idea too. I can see some great uses for this package as I have some pretty ugly hacks which could be simplified if cursor-sensor works reliably. thanks for the pointer. Tim John Kitchin writes: > You can use cursor-sensor mode for this if you have emacs 26ish. The idea > is you set cursor-sensor functions on a region that do something depending > on whether you enter or leave the region. Below, I tie into the org font > lock mechanisms to add these properties so that when you enter, typo mode > gets turned off, and when you leave it gets turned back on. I use a similar > approach to put src-block specific key maps on src blocks. There are two > examples of functions that are "lightly tested". I can see why you would > want this disabled in src blocks, it never puts the right quote in! > > (defvar scimax-src-block-cursor-sensor-functions '() > "List of functions to run in cursor-sensor mode. .") > > > (defun scimax-add-cursor-sensor-functions-to-src-blocks (limit) > "Function used in font-lock to add cursor-sensor functions." > (let ((case-fold-search t)) > (while (re-search-forward org-babel-src-block-regexp limit t) > (let* ((beg (match-beginning 0)) > (end (match-end 0)) > (cursor-functions (or > (get-text-property beg 'cursor-sensor-functions) > `( > (cl-loop for func in scimax-src-block-cursor-sensor-functions do > (when (not (memq func cursor-functions)) > (pushnew func cursor-functions))) > (add-text-properties > beg end `(cursor-sensor-functions ,cursor-functions)) > > > (define-minor-mode scimax-cursor-sensor-mode > "Minor mode to turn on cursor-sensor-mode for org src-blocks." > :init-value nil > (if scimax-cursor-sensor-mode > (progn > (add-hook 'org-font-lock-hook > #'scimax-add-cursor-sensor-functions-to-src-blocks t) > (add-to-list 'font-lock-extra-managed-props 'cursor-sensor-functions) > (cursor-sensor-mode +1)) > (remove-hook 'org-font-lock-hook > #'scimax-add-cursor-sensor-functions-to-src-blocks) > > (cursor-sensor-mode -1)) > (font-lock-fontify-buffer)) > > (defun scimax-cs-message-1 (win prev-pos sym) > (message "%s %s %s" > win > prev-pos > sym)) > > (defun scimax-src-toggle-typo-mode (win prev-pos sym) > (if (eq sym 'entered) > (typo-mode -1) > (typo-mode +1))) > > > (add-to-list 'scimax-src-block-cursor-sensor-functions > 'scimax-cs-message-1) > > (add-to-list 'scimax-src-block-cursor-sensor-functions > 'scimax-src-toggle-typo-mode) > > > > > 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 > > > > On Mon, Sep 2, 2019 at 8:21 AM wrote: > >> On Mon 02-Sep-2019 at 10:35:02 +02, Tim Cross >> wrote: >> > I think Eric is correct. There is also another reason. If you edit the >> > source blocks with C-', then any escaping needed (such as putting a ',' >> > before '*') will also be automatically handled, plus of course you get >> > all the programing mode goodness. >> > >> > Fraga, Eric writes: >> > >> >> On Monday, 2 Sep 2019 at 09:01, garj...@garjola.net wrote: >> >>> I am using typo-mode (https://github.com/jorgenschaefer/typoel) in my >> >>> org buffers (actually with a hook for text-mode), but I would like to >> >>> disable it in source code blocks. >> >>> >> >>> I have been unable to find a hook to do so (I understand that >> >>> org-src-mode-hook is used when editing with ‘C-c '’ but not in the org >> >>> buffer). >> >> >> >> I am not entirely sure what you want here. If it is that you want to >> >> turn off typo-mode when point moves into a src block but while still in >> >> the whole org buffer, then you cannot do this AFAIK. The best approach >> >> is to always edit src blocks using C-c ' (org-edit-special) and then you >> >> can use org-src-mode-hook to do what you want. >> >> Thanks to both of you. I usually edit in the separate buffer, but I >> don’t for one liners. It’s a pity that this is not possible, but I can >> live with that! >> >> Thanks again! >> -- >> >> -- Tim Cross
[O] git-annex-related org-attach tests failing on master
Hello, The following tests fail as of ae9cd4370 (org-attach*, org, org-manual, org-news, ox-html, testing/*, 2018-11-25): test-org-attach-git/get-maybe test-org-attach-git/use-annex test-org-attach/dired-attach-to-next-best-subtree/1 test-org-attach/dired-attach-to-next-best-subtree/2 Gustav, could you please take a look? I suspect you didn't see these failures when you made those changes because you don't have git-annex installed. Here are the backtraces: --8<---cut here---start->8--- selected tests: org-attach Running 5 tests (2019-09-02 18:22:55-0400) (Shell command succeeded with no output) (Shell command succeeded with no output) Test test-org-attach-git/get-maybe backtrace: (org-attach-annex-get-maybe (expand-file-name "test-file")) (let ((org-attach-annex-auto-get t)) (org-attach-annex-get-maybe (ex (let ((path (expand-file-name "test-file")) (annex-dup (make-temp-fi (let ((default-directory tmpdir) (org-attach-id-dir tmpdir)) (shell- (unwind-protect (let ((default-directory tmpdir) (org-attach-id-dir (let ((tmpdir (make-temp-file "org-annex-test" t "/"))) (unwind-prot (lambda nil (let ((tmpdir (make-temp-file "org-annex-test" t "/"))) ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test ert-run-test(#s(ert-test :name test-org-attach-git/get-maybe :docume ert-run-or-rerun-test(#s(ert--stats :selector "org-attach" :tests [# ert-run-tests("org-attach" #f(compiled-function (event-type ev ert-run-tests-batch("org-attach") ert-run-tests-batch-and-exit("org-attach") (let ((org-id-track-globally t) (org-test-selector (if org-test-sele org-test-run-batch-tests("org-attach") eval((org-test-run-batch-tests org-test-select-re)) command-line-1(("--eval" "(setq vc-handled-backends nil org-startup- command-line() normal-top-level() Test test-org-attach-git/get-maybe condition: (void-function org-attach-annex-get-maybe) FAILED 1/5 test-org-attach-git/get-maybe Test test-org-attach-git/use-annex backtrace: org-attach-use-annex() apply(org-attach-use-annex nil) (setq value-3425 (apply fn-3423 args-3424)) (unwind-protect (setq value-3425 (apply fn-3423 args-3424)) (setq fo (if (unwind-protect (setq value-3425 (apply fn-3423 args-3424)) (set (let (form-description-3427) (if (unwind-protect (setq value-3425 (a (let ((value-3425 (quote ert-form-evaluation-aborted-3426))) (let (f (let* ((fn-3423 (function org-attach-use-annex)) (args-3424 (conditi (let ((org-attach-git-annex-cutoff 1)) (let* ((fn-3423 (function org (let ((default-directory tmpdir) (org-attach-id-dir tmpdir)) (shell- (unwind-protect (let ((default-directory tmpdir) (org-attach-id-dir (let ((tmpdir (make-temp-file "org-annex-test" t "/"))) (unwind-prot (lambda nil (let ((tmpdir (make-temp-file "org-annex-test" t "/"))) ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test ert-run-test(#s(ert-test :name test-org-attach-git/use-annex :docume ert-run-or-rerun-test(#s(ert--stats :selector "org-attach" :tests [# ert-run-tests("org-attach" #f(compiled-function (event-type ev ert-run-tests-batch("org-attach") ert-run-tests-batch-and-exit("org-attach") (let ((org-id-track-globally t) (org-test-selector (if org-test-sele org-test-run-batch-tests("org-attach") eval((org-test-run-batch-tests org-test-select-re)) command-line-1(("--eval" "(setq vc-handled-backends nil org-startup- command-line() normal-top-level() Test test-org-attach-git/use-annex condition: (void-function org-attach-use-annex) FAILED 2/5 test-org-attach-git/use-annex passed 3/5 test-org-attach/dir Test test-org-attach/dired-attach-to-next-best-subtree/1 backtrace: org-attach-git-commit("/tmp/tmp-orgtest/data/73/65ffd7-1e1f-40e3-a9a run-hook-with-args(org-attach-git-commit "/tmp/tmp-orgtest/data/73/6 (let* ((attach-dir (org-attach-dir (quote get-create))) (fname (expa (let ((basename (file-name-nondirectory file))) (let* ((attach-dir ( org-attach-attach("/tmp/tmp-orgtest/acrffdU") (let ((file (car --dolist-tail--))) (org-attach-attach file) (setq - (while --dolist-tail-- (let ((file (car --dolist-tail--))) (org-atta (let ((--dolist-tail-- files)) (while --dolist-tail-- (let ((file (c (let ((start-win (selected-window)) (other-win (get-window-with-pred org-attach-dired-to-subtree(("/tmp/tmp-orgtest/acrffdU")) funcall-interactively(org-attach-dired-to-subtree ("/tmp/tmp-orgtest call-interactively(org-attach-dired-to-subtree) (progn (split-window) (dired temporary-file-directory) (progn (or (e (progn (setq buffer (find-file file)) (if (re-search-forward "8---
Re: [O] Minor fix for org-attach-dir
Hi Gustav, Gustav Wikström writes: > See commit 4b7eda1a2 for the fix. This commit, as well as several other recent commits by you, do not follow the project's convention regarding changelog-like entries in the commit message. Regardless of your opinion on this convention (I personally don't prefer it either), please try to follow it. -- Kyle
[O] Minor fix for org-attach-dir
For full transparency: An issue was found in org-brain [1] due to a change in functionality of org-attach-dir in commit ae9cd4370. I've given it some thought and figured that particular change in functionality wasn't really needed and not obviously correct either. So org-attach-dir will now check the filesystem (again) to see if the attachment folder from DIR or ID property exist or not. The check can be skipped with a new optional flag. See commit 4b7eda1a2 for the fix. [1] https://github.com/Kungsgeten/org-brain/pull/203 Regards Gustav
Re: [O] Bug: org-edit-src keeps splitting the window [9.2.5 (release_9.2.5-504-g3c24be @ /home/immanuel/.emacs.d/straight/build/org/)]
You want me to do that and send a new patch or are you going to do it after you apply the patch? Regards, Immanuel On Mon, Sep 2, 2019 at 9:41 PM Nicolas Goaziou wrote: > > Hello, > > immanuel writes: > > > When org-edit-src-code is called with org-window-setup equal to > > 'split-window-below or 'split-window-right it will keep splitting the > > window if the mouse is clicked on the src block in the org buffer. > > This patch tries to address that > > [...] > > > +(defun org-src-select-window-for-buffer (buffer split-fun) > > You should make it an internal function: `org-src--select-window-for-buffer'. > > > + "Tries to select an existing window for buffer or splits the > > window." > > You need to expound the docstring a bit, e.g.: > > "Re-use an existing window or split the current window. > If BUFFER is current in a window, use it. Otherwise, split the current > window, according to SPLIT-FUN, in order to display it. > > Also, I think this should be notified in ORG-NEWS file. > > Thank you! > > Regards, > > -- > Nicolas Goaziou
Re: [O] Bug: org-edit-src keeps splitting the window [9.2.5 (release_9.2.5-504-g3c24be @ /home/immanuel/.emacs.d/straight/build/org/)]
Hello, immanuel writes: > When org-edit-src-code is called with org-window-setup equal to > 'split-window-below or 'split-window-right it will keep splitting the > window if the mouse is clicked on the src block in the org buffer. > This patch tries to address that [...] > +(defun org-src-select-window-for-buffer (buffer split-fun) You should make it an internal function: `org-src--select-window-for-buffer'. > + "Tries to select an existing window for buffer or splits the > window." You need to expound the docstring a bit, e.g.: "Re-use an existing window or split the current window. If BUFFER is current in a window, use it. Otherwise, split the current window, according to SPLIT-FUN, in order to display it. Also, I think this should be notified in ORG-NEWS file. Thank you! Regards, -- Nicolas Goaziou
Re: [O] Disable typo-mode in org source code blocks
You can use cursor-sensor mode for this if you have emacs 26ish. The idea is you set cursor-sensor functions on a region that do something depending on whether you enter or leave the region. Below, I tie into the org font lock mechanisms to add these properties so that when you enter, typo mode gets turned off, and when you leave it gets turned back on. I use a similar approach to put src-block specific key maps on src blocks. There are two examples of functions that are "lightly tested". I can see why you would want this disabled in src blocks, it never puts the right quote in! (defvar scimax-src-block-cursor-sensor-functions '() "List of functions to run in cursor-sensor mode. .") (defun scimax-add-cursor-sensor-functions-to-src-blocks (limit) "Function used in font-lock to add cursor-sensor functions." (let ((case-fold-search t)) (while (re-search-forward org-babel-src-block-regexp limit t) (let* ((beg (match-beginning 0)) (end (match-end 0)) (cursor-functions (or (get-text-property beg 'cursor-sensor-functions) `( (cl-loop for func in scimax-src-block-cursor-sensor-functions do (when (not (memq func cursor-functions)) (pushnew func cursor-functions))) (add-text-properties beg end `(cursor-sensor-functions ,cursor-functions)) (define-minor-mode scimax-cursor-sensor-mode "Minor mode to turn on cursor-sensor-mode for org src-blocks." :init-value nil (if scimax-cursor-sensor-mode (progn (add-hook 'org-font-lock-hook #'scimax-add-cursor-sensor-functions-to-src-blocks t) (add-to-list 'font-lock-extra-managed-props 'cursor-sensor-functions) (cursor-sensor-mode +1)) (remove-hook 'org-font-lock-hook #'scimax-add-cursor-sensor-functions-to-src-blocks) (cursor-sensor-mode -1)) (font-lock-fontify-buffer)) (defun scimax-cs-message-1 (win prev-pos sym) (message "%s %s %s" win prev-pos sym)) (defun scimax-src-toggle-typo-mode (win prev-pos sym) (if (eq sym 'entered) (typo-mode -1) (typo-mode +1))) (add-to-list 'scimax-src-block-cursor-sensor-functions 'scimax-cs-message-1) (add-to-list 'scimax-src-block-cursor-sensor-functions 'scimax-src-toggle-typo-mode) 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 On Mon, Sep 2, 2019 at 8:21 AM wrote: > On Mon 02-Sep-2019 at 10:35:02 +02, Tim Cross > wrote: > > I think Eric is correct. There is also another reason. If you edit the > > source blocks with C-', then any escaping needed (such as putting a ',' > > before '*') will also be automatically handled, plus of course you get > > all the programing mode goodness. > > > > Fraga, Eric writes: > > > >> On Monday, 2 Sep 2019 at 09:01, garj...@garjola.net wrote: > >>> I am using typo-mode (https://github.com/jorgenschaefer/typoel) in my > >>> org buffers (actually with a hook for text-mode), but I would like to > >>> disable it in source code blocks. > >>> > >>> I have been unable to find a hook to do so (I understand that > >>> org-src-mode-hook is used when editing with ‘C-c '’ but not in the org > >>> buffer). > >> > >> I am not entirely sure what you want here. If it is that you want to > >> turn off typo-mode when point moves into a src block but while still in > >> the whole org buffer, then you cannot do this AFAIK. The best approach > >> is to always edit src blocks using C-c ' (org-edit-special) and then you > >> can use org-src-mode-hook to do what you want. > > Thanks to both of you. I usually edit in the separate buffer, but I > don’t for one liners. It’s a pity that this is not possible, but I can > live with that! > > Thanks again! > -- > >
[O] Disallow empty tags
Creating an empty tag renders TAB-completion useless. Example: * Title :a::b: Pressing TAB in org-set-tags-command will now insert a colon `:`, which is quite puzzling to see. I thought something was wrong w/ my bindings till I noticed this was happening only in one of my files. Can such tags be ignored/disallowed as they hold no evident purpose? Regards, Dmitrii
Re: [O] Strange interaction between ID block property, org-schedule and ical/ics export backend
On Monday, 2 Sep 2019 at 10:34, rey-coyrehourcq wrote: > Hi, > Sorry, i make a typo in the previous mail, i use the "org-icalendar-export-to- > ics" method and not the org-caldav method... Ah, okay. I should say that I only export appointments (i.e. active time stamps) to ics so it could be that the export doesn't understand scheduled/deadline items. Have you looked at the info manual for org icalendar export? It does mention a couple of variables that may affect what you are getting: ,[ C-h v org-icalendar-use-deadline RET ] | org-icalendar-use-deadline is a variable defined in ‘ox-icalendar.el’. | Its value is (event-if-not-todo todo-due) | | Documentation: | Contexts where iCalendar export should use a deadline time stamp. | | This is a list with possibly several symbols in it. Valid symbols are: | | ‘event-if-todo’ Deadlines in TODO entries become calendar events. | ‘event-if-not-todo’ Deadlines in non-TODO entries become calendar events. | ‘todo-due’Use deadlines in TODO entries as due-dates. | | You can customize this variable. ` ,[ C-h v org-icalendar-use-scheduled RET ] | org-icalendar-use-scheduled is a variable defined in ‘ox-icalendar.el’. | Its value is (todo-start) | | Documentation: | Contexts where iCalendar export should use a scheduling time stamp. | | This is a list with possibly several symbols in it. Valid symbols are: | | ‘event-if-todo’ Scheduling time stamps in TODO entries become an event. | ‘event-if-not-todo’ Scheduling time stamps in non-TODO entries become an event. | ‘todo-start’ Scheduling time stamps in TODO entries become start date. | Some calendar applications show TODO entries only after | that date. | | You can customize this variable. ` -- : Professor Eric S Fraga, http://www.homepages.ucl.ac.uk/~ucecesf : PGP/GPG key: 8F5C 279D 3907 E14A 5C29 570D C891 93D8 FFFC F67D : Use plain text email when possible: https://useplaintext.email/
Re: [O] Disable typo-mode in org source code blocks
On Mon 02-Sep-2019 at 10:35:02 +02, Tim Cross wrote: > I think Eric is correct. There is also another reason. If you edit the > source blocks with C-', then any escaping needed (such as putting a ',' > before '*') will also be automatically handled, plus of course you get > all the programing mode goodness. > > Fraga, Eric writes: > >> On Monday, 2 Sep 2019 at 09:01, garj...@garjola.net wrote: >>> I am using typo-mode (https://github.com/jorgenschaefer/typoel) in my >>> org buffers (actually with a hook for text-mode), but I would like to >>> disable it in source code blocks. >>> >>> I have been unable to find a hook to do so (I understand that >>> org-src-mode-hook is used when editing with ‘C-c '’ but not in the org >>> buffer). >> >> I am not entirely sure what you want here. If it is that you want to >> turn off typo-mode when point moves into a src block but while still in >> the whole org buffer, then you cannot do this AFAIK. The best approach >> is to always edit src blocks using C-c ' (org-edit-special) and then you >> can use org-src-mode-hook to do what you want. Thanks to both of you. I usually edit in the separate buffer, but I don’t for one liners. It’s a pity that this is not possible, but I can live with that! Thanks again! --
Re: [O] Disable typo-mode in org source code blocks
I think Eric is correct. There is also another reason. If you edit the source blocks with C-', then any escaping needed (such as putting a ',' before '*') will also be automatically handled, plus of course you get all the programing mode goodness. Fraga, Eric writes: > On Monday, 2 Sep 2019 at 09:01, garj...@garjola.net wrote: >> I am using typo-mode (https://github.com/jorgenschaefer/typoel) in my >> org buffers (actually with a hook for text-mode), but I would like to >> disable it in source code blocks. >> >> I have been unable to find a hook to do so (I understand that >> org-src-mode-hook is used when editing with ‘C-c '’ but not in the org >> buffer). > > I am not entirely sure what you want here. If it is that you want to > turn off typo-mode when point moves into a src block but while still in > the whole org buffer, then you cannot do this AFAIK. The best approach > is to always edit src blocks using C-c ' (org-edit-special) and then you > can use org-src-mode-hook to do what you want. -- Tim Cross
Re: [O] Strange interaction between ID block property, org-schedule and ical/ics export backend
Hi, Sorry, i make a typo in the previous mail, i use the "org-icalendar-export-to- ics" method and not the org-caldav method... * Heading 1 SCHEDULED <...--...> :PROPERTIES: :ID: xxx :END: foo Le dimanche 01 septembre 2019 à 09:29 +, Fraga, Eric a écrit : > On Saturday, 31 Aug 2019 at 20:42, rey-coyrehourcq wrote: > > I'm trying to create a day-to-day workflow with org-mode, org-agenda > > Scheduleand iCalendat-export backend. > > [...] > > Normally org-caldav-generate-ics export command reuse the ID fromproperty > > block to generate the *.ics, but it only works if theSCHEDULED block is > > after the property block. > > I don't know about org-caldav-generate-ics butorg-icalendar-export-to-ics > works fine with the standard org format(deadline & scheduled entries ahead of > properties drawer). Thatfunction is in ox-icalendar.el. Maybe try that > instead of theorg-caldav-... method? In my case, this Schedule event don't export with "org-icalendar-export-to-ics" ... I'm using emacs 26.2 Sébastien Rey-Coyrehourcq Research Engineer UMR IDEES 02.35.14.69.30 {Stronger security for your email, follow EFF tutorial : https://ssd.eff.org/} signature.asc Description: This is a digitally signed message part
Re: [O] Disable typo-mode in org source code blocks
On Monday, 2 Sep 2019 at 09:01, garj...@garjola.net wrote: > I am using typo-mode (https://github.com/jorgenschaefer/typoel) in my > org buffers (actually with a hook for text-mode), but I would like to > disable it in source code blocks. > > I have been unable to find a hook to do so (I understand that > org-src-mode-hook is used when editing with ‘C-c '’ but not in the org > buffer). I am not entirely sure what you want here. If it is that you want to turn off typo-mode when point moves into a src block but while still in the whole org buffer, then you cannot do this AFAIK. The best approach is to always edit src blocks using C-c ' (org-edit-special) and then you can use org-src-mode-hook to do what you want. -- Eric S Fraga via Emacs 27.0.50, Org release_9.2.4-401-gfabd6d
[O] Disable typo-mode in org source code blocks
Hi, I am using typo-mode (https://github.com/jorgenschaefer/typoel) in my org buffers (actually with a hook for text-mode), but I would like to disable it in source code blocks. I have been unable to find a hook to do so (I understand that org-src-mode-hook is used when editing with ‘C-c '’ but not in the org buffer). Can you help me with this? Thanks. G. --