Re: [O] How to get rid of first line indent?
On Monday, 12 Jun 2017 at 16:14, Birnle wrote: > But I’ve read that it is possible to directly export to Markdown – > that is the format I usually work with. By exporting an Org mode file > these unnecessary spaces should be erased. I just have to figure out > how to export to Markdown from Org mode … Do you know a good online > How-to? Check out the markdown section in the exporting part of the info manual for org. If you have the system installed properly, this should work: C-h i org RET m exporting RET m markdown RET but it is a rather short section of the manual... -- : Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.7-531-g530113 signature.asc Description: PGP signature
Re: [O] Best book to get from novice to guru?
On Tuesday, 13 Jun 2017 at 02:00, Birnle wrote: > Which book (or books) do I have to read / work through to get from > Emacs/Org novice to (almost) guru? Which is/are the best in your > opinion? Much of emacs, including the various subsystems (gnus, org, calc, ...) is documented via the info system (C-h i) inside emacs. [...] > And is it necessary to learn Lisp in order to master Emacs? Yes. -- : Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.7-531-g530113 signature.asc Description: PGP signature
Re: [O] How to get rid of first line indent?
Thank you, Marcin, In fact, rectangle deletion doesn’t work since the text has over 700 header lines that are not indented. But replace-regexp works. Best, Birnle On 13 Jun 2017, at 5:21, Marcin Borkowski wrote: On 2017-06-12, at 23:42, Birnle wrote: Thank you, John, for your answer. And no, it’s much too early for me to be sure … But C-c n does actually indent each (first) line with whitespace according to the number of asterisks in the heading. The easiest and fastest solution is in fact deleting the leading whitespace in every line by replace-regexp (replace ^ + by nothing). The easiest and fastest solution is probably to use delete-rectangle (or rectangle-mark-mode and then DEL). Hth, -- Marcin Borkowski
Re: [O] Moving and resetting attachments
Am 10.06.2017 um 09:36 schrieb Nicolas Goaziou: > Hello, > > Florian Lindner writes: > >> Ok, my new version is here. It should be able to replace >> org-attach-set-directory > > Thank you. Comments follow. > >> Some questions about the code >> >> * Is that the correct way to deal with a boolean prefix arg? I'm not >> interested in the value of the prefix arg, only if >> it's given or not. > > No, it should be (interactive "P") so PREFIX, or more commonly, ARG, is > nil when not provided. Thanks!. >> * The code changes the semantics of org-attach-set-directory, because it >> creates the newly set attach dir. IMHO this >> makes more sense. > > OK. > >> * It deletes only the first part of the dir, e.g. data/83/1234567, it only >> deletes the 1234567 dir, even if 83 is empty >> afterwards. But I think that's ok. > > OK. > > Here is an update of your function, with comments and FIXME. The > docstring could certainly be improved, but you get the idea. Yeah, docstring is usually the last I add, since I should at least know what the function is supposed to do ;-) > (defun flo/org-attach-move (&optional arg) > "Move current attachements to another directory. > When ARG is non-nil, reset attach directory. Create directory if > needed." > (interactive "P") > (let ((old (org-attach-dir)) > (new >(progn > (if arg (org-entry-delete nil "ATTACH_DIR") >(let ((dir (read-directory-name >"Attachment directory: " >(org-entry-get nil > "ATTACH_DIR" > (and org-attach-allow-inheritance > t) What is the use of (and org-attach-allow-inheritance t)? Doesn't it always returns org-attach-allow-inheritance? Anyways, I'm not really sure if I understand the doc of org-entry-get correctly. Does org-entry-get not automatically take inheritance into account, based on the the per-entry or global setting? > (org-entry-put nil "ATTACH_DIR" dir))) > (org-attach-dir t > (message "old-attach-dir = %S" old) ;FIXME: remove? > (message "new-attach-dir = %S" new) ;FIXME: remove? Yes, of course. > (unless (or (string= old new) > (not old)) > ;; FIXME: Need a special case for directory reset (non-nil ARG). Why that? Aren't old and new holding the appropriate dirs in that case and copy over / delete as they should? > ;; FIXME: Maybe `yes-or-no-p' is safer when moving data around? Ok. I wasn't aware of the difference, since I have (fset 'yes-or-no-p 'y-or-n-p) in my .emacs. > (when (y-or-n-p "Copy over attachments from old directory? ") > (copy-directory old-attach-dir new t nil t)) > (when (y-or-n-p (concat "Delete " old)) > ;; FIXME: Why not `delete-directory'? > (shell-command (format "rm -fr %s" old)) I took it from org-attach-delete-all. But you're delete-directory is probably better than a shell-command. Latest version: (defun flo/org-attach-move (&optional arg) "Move current attachements to another directory. When ARG is non-nil, reset attach directory. Create directory if needed." (interactive "P") (let ((old (org-attach-dir)) (new (progn (if arg (org-entry-delete nil "ATTACH_DIR") (let ((dir (read-directory-name "Attachment directory: " (org-entry-get nil "ATTACH_DIR" (and org-attach-allow-inheritance t) (org-entry-put nil "ATTACH_DIR" dir))) (org-attach-dir t (unless (or (string= old new) (not old)) ;; FIXME: Need a special case for directory reset (non-nil ARG). (when (yes-or-no-p "Copy over attachments from old directory? ") (copy-directory old new t nil t)) (when (yes-or-no-p (concat "Delete " old)) (delete-directory old t) Best, Florian
Re: [O] Moving and resetting attachments
Am 10.06.2017 um 09:36 schrieb Nicolas Goaziou: > Hello, > > Florian Lindner writes: > >> Ok, my new version is here. It should be able to replace >> org-attach-set-directory > > Thank you. Comments follow. > >> Some questions about the code >> >> * Is that the correct way to deal with a boolean prefix arg? I'm not >> interested in the value of the prefix arg, only if >> it's given or not. > > No, it should be (interactive "P") so PREFIX, or more commonly, ARG, is > nil when not provided. Thanks!. >> * The code changes the semantics of org-attach-set-directory, because it >> creates the newly set attach dir. IMHO this >> makes more sense. > > OK. > >> * It deletes only the first part of the dir, e.g. data/83/1234567, it only >> deletes the 1234567 dir, even if 83 is empty >> afterwards. But I think that's ok. > > OK. > > Here is an update of your function, with comments and FIXME. The > docstring could certainly be improved, but you get the idea. Yeah, docstring is usually the last I add, since I should at least know what the function is supposed to do ;-) > (defun flo/org-attach-move (&optional arg) > "Move current attachements to another directory. > When ARG is non-nil, reset attach directory. Create directory if > needed." > (interactive "P") > (let ((old (org-attach-dir)) > (new >(progn > (if arg (org-entry-delete nil "ATTACH_DIR") >(let ((dir (read-directory-name >"Attachment directory: " >(org-entry-get nil > "ATTACH_DIR" > (and org-attach-allow-inheritance > t) What is the use of (and org-attach-allow-inheritance t)? Doesn't it always returns org-attach-allow-inheritance? Anyways, I'm not really sure if I understand the doc of org-entry-get correctly. Does org-entry-get not automatically take inheritance into account, based on the the per-entry or global setting? > (org-entry-put nil "ATTACH_DIR" dir))) > (org-attach-dir t > (message "old-attach-dir = %S" old) ;FIXME: remove? > (message "new-attach-dir = %S" new) ;FIXME: remove? Yes, of course. > (unless (or (string= old new) > (not old)) > ;; FIXME: Need a special case for directory reset (non-nil ARG). Why that? Aren't old and new holding the appropriate dirs in that case and copy over / delete as they should? > ;; FIXME: Maybe `yes-or-no-p' is safer when moving data around? Ok. I wasn't aware of the difference, since I have (fset 'yes-or-no-p 'y-or-n-p) in my .emacs. > (when (y-or-n-p "Copy over attachments from old directory? ") > (copy-directory old-attach-dir new t nil t)) > (when (y-or-n-p (concat "Delete " old)) > ;; FIXME: Why not `delete-directory'? > (shell-command (format "rm -fr %s" old)) I took it from org-attach-delete-all. But you're delete-directory is probably better than a shell-command. Latest version: (defun flo/org-attach-move (&optional arg) "Move current attachements to another directory. When ARG is non-nil, reset attach directory. Create directory if needed." (interactive "P") (let ((old (org-attach-dir)) (new (progn (if arg (org-entry-delete nil "ATTACH_DIR") (let ((dir (read-directory-name "Attachment directory: " (org-entry-get nil "ATTACH_DIR" (and org-attach-allow-inheritance t) (org-entry-put nil "ATTACH_DIR" dir))) (org-attach-dir t (unless (or (string= old new) (not old)) ;; FIXME: Need a special case for directory reset (non-nil ARG). (when (yes-or-no-p "Copy over attachments from old directory? ") (copy-directory old new t nil t)) (when (yes-or-no-p (concat "Delete " old)) (delete-directory old t) Best, Florian
Re: [O] Best book to get from novice to guru?
The answer - all of them are good. Emacs and Org manuals are available from inside of Emacs with every installation. They describe out-of-box capabilities of Emacs and Org respectively. Ideally you want to skimp through them, so you'd understand what's available. Then you can reference them as needed. Mastering Emacs is a tips and tricks book. It's good, but no replacement for the manuals. -- Best Regards, Nikolay Kudryavtsev
Re: [O] Small error in documentation in org-element
Hello, "Somelauw ." writes: > I found a small error in the documentary in org-element.el > On line 32, it says "An element always starts and ends at the > beginning of a line." > This is not completely accurate. > > Take the following example > > - foe > > Here we have an item list containing an item containing a paragraph. A > paragraph is an org element, but in this case it does not start at the > beginning of a line. You're right. I removed the whole comment about Org syntax, which was outdated anyway. Regards, -- Nicolas Goaziou
Re: [O] Allow #+SETUPFILE to point to an URL for the org file
Hello, Kaushal Modi writes: > I have attached the same patch with one more test; rebased to master. Great. Thank you. > * lisp/org.el (org--file-cache): New internal variable to store > downloaded files' cache. > > * lisp/org.el (org-reset-file-cache): New function to clear the above > file cache. > > * lisp/org.el (org-mode-restart): Use org-reset-file-cache to clear > the file cache. > > * lisp/org.el (org-file-url-p): New function to test if the input > argument is a URL. It should be something like * lisp/org.el (org--file-cache): New variable (org-reset-file-cache): (org-file-url-p): New function. (org-mode-restart): Use new function. The purpose is to know in what commit the function was introduced, not what it does. > +Org opens the main file. If URL is specified, the contents are downloaded > +and stored in a temporary cache. @kbd{C-c C-c} on the settings line will > +also parse and load. @kbd{C-c C-c} on the @code{#+SETUPFILE:} line will also > +reset the temporary file cache. The last sentence is not correct. C-c C-c on any settings line resets the cache, not specifically on "#+SETUPFILE". > +(ert-deftest test-org/org-file-contents-url () > + "Test `org-file-contents' with a URL as input." > + (should > + (string= "#+BIND: variable value > +#+DESCRIPTION: l2 > +#+LANGUAGE: en > +#+SELECT_TAGS: b > +#+TITLE: b > +#+PROPERTY: a 1 > +" (org-file-contents > "http://orgmode.org/cgit.cgi/org-mode.git/plain/testing/examples/setupfile3.org";))) I'm worried about this test, and some other below. They require a proper internet access. Couldn't we fake `url-retrieve-synchronously' using `cl-letf' so as to produce a buffer with appropriate contents and return it? Something (untested) like (should (string= "foo" (let ((buffer (generate-new-buffer "test-ox"))) (unwind-protect (cl-letf (((symbol-function 'url-retrieve-synchronously) (lambda (&rest _) (with-current-buffer buffer (insert "HTTP 200 OK\n\nfoo")) buffer))) (org-file-contents "http://whatever";)) (kill-buffer buffer) Regards, -- Nicolas Goaziou
Re: [O] Allow #+SETUPFILE to point to an URL for the org file
Hi Nicolas, Thanks for one more round of detailed feedback. I have attached the revised patch. On Tue, Jun 13, 2017 at 8:43 AM Nicolas Goaziou wrote: > It should be something like > > * lisp/org.el (org--file-cache): New variable > (org-reset-file-cache): > (org-file-url-p): New function. > (org-mode-restart): Use new function. > > The purpose is to know in what commit the function was introduced, not > what it does. > OK. Done. > The last sentence is not correct. C-c C-c on any settings line resets > the cache, not specifically on "#+SETUPFILE". > I have rephrased it. > I'm worried about this test, and some other below. They require a proper > internet access. Makes sense.. While this feature does need internet access, running 'make test' shouldn't. > Couldn't we fake `url-retrieve-synchronously' using > `cl-letf' so as to produce a buffer with appropriate contents and return > it? Something (untested) like > > (should >(string= > "foo" > (let ((buffer (generate-new-buffer "test-ox"))) > (unwind-protect > (cl-letf (((symbol-function 'url-retrieve-synchronously) > (lambda (&rest _) >(with-current-buffer buffer (insert "HTTP 200 > OK\n\nfoo")) >buffer))) > (org-file-contents "http://whatever";)) > (kill-buffer buffer) > Thanks. I have used that snippet at applicable places. -- Kaushal Modi 0001-Allow-org-file-contents-to-fetch-file-contents-from-.patch Description: Binary data
[O] test-org-colview.el: Fix an expected result in test-org-colview/columns-summary
Hi, some tests in test-org-colviews.el fail. If this patch is acceptable, I will send more to fix the other failed test cases. Let me know if I understand the test intent of this failed test case correctly. Below is a summary from my patch: * lisp/test-org-colview.el (test-org-colview/columns-summary): Fix 23rd test case This test sets 2014-03-04 to be current-time and then computes the number of days between current-time and 2012-03-29. 705 days should be expected. However, 705d 1h is given in the test case. Thanks. 0001-test-org-colview.el-Fix-an-expected-result-in-test-o.patch Description: Binary data
[O] agenda tags-todo (was Re: [PATCH] Make `org-tags-view' stop setting globally `org--matcher-tags-todo-only')
I assume the change is this one: commit 942b6267a09e167ad3a546e83205601aa5c0704e Author: Nicolas Goaziou Date: Tue Apr 18 11:55:27 2017 +0200 org-agenda: `tags-todo' command type includes DONE keywords I was rather fond of the old behaviour, which I used in the following simple custom agenda: ("p" "Agenda and prioritized tasks" ((agenda "") (tags-todo "p"))) and which I include as part of my emacs start up. Is there a way in the new system to make a custom agenda that will only include todos in not-done states, without having to add those states explicitly to the tags-todo search command? -- Christian --- On Tir, Maj 30 2017, Nicolas Goaziou wrote: Hello, Samuel Loury writes: > I would like to propose a patch for `org-tags-view' to make it stop > setting globally `org--matcher-tags-todo-only' > > Setting `org--matcher-tags-todo-only' has side effects on other > commands. For instance, the following clock table changes its behavior > whether `org--matcher-tags-todo-only' is nil or '(4) > > #+BEGIN: clocktable :tags "-perso" :fileskip0 :stepskip0 :link t > :maxlevel 5 :emphasize t :link t :block today-1 :scope agenda > :inherit-props t > > I did not have time to investigate why the behavior of the clock table > is impacted by `org--matcher-tags-todo-only'. I quickly feel lost in > this code. > > From c5c763a9aca8cfd8a707b0d7e814bc37f5eeafa1 Mon Sep 17 00:00:00 2001 > From: Samuel Loury > Date: Thu, 19 Jan 2017 08:39:50 +0100 > Subject: [PATCH] Make `org-tags-view' stop setting globally > `org--matcher-tags-todo-only' Thank you. I eventually fixed it slightly differently. Regards, -- Nicolas Goaziou +- Christian Lynbech | christian #\@ defun #\. dk +- Hit the philistines three times over the head with the Elisp reference manual. - peto...@hal.com (Michael A. Petonic)
Re: [O] agenda tags-todo (was Re: [PATCH] Make `org-tags-view' stop setting globally `org--matcher-tags-todo-only')
Hello, Christian Lynbech writes: > Is there a way in the new system to make a custom agenda that will only > include todos in not-done states, without having to add those states > explicitly to the tags-todo search command? See (info "(org) Matching tags and properties"), last paragraph. Regards, -- Nicolas Goaziou
Re: [O] Allow #+SETUPFILE to point to an URL for the org file
> I have attached the revised patch. LGTM. Thank you for the work! Regards,
Re: [O] Moving and resetting attachments
Hello, Florian Lindner writes: > What is the use of (and org-attach-allow-inheritance t)? Doesn't it always > returns org-attach-allow-inheritance? It return nil if `org-attach-allow-inheritance' is nil, t otherwise. In particular, if `org-attach-allow-inheritance' is set to `selective', the S-exp returns t. > Anyways, I'm not really sure if I understand the doc of org-entry-get > correctly. Does org-entry-get not automatically > take inheritance into account, based on the the per-entry or global > setting? No it doesn't. The caller choose if it should ignore inheritance (the default), use it unconditionally (a non-nil INHERIT argument), or let the user decide (`selective' INHERIT argument). >> ;; FIXME: Need a special case for directory reset (non-nil ARG). > > Why that? Aren't old and new holding the appropriate dirs in that case > and copy over / delete as they should? Probably. I was thinking to some special case that may not exist, after all. Never mind then. > Latest version: > > (defun flo/org-attach-move (&optional arg) > "Move current attachements to another directory. > When ARG is non-nil, reset attach directory. Create directory if > needed." > (interactive "P") > (let ((old (org-attach-dir)) > (new > (progn >(if arg (org-entry-delete nil "ATTACH_DIR") > (let ((dir (read-directory-name > "Attachment directory: " > (org-entry-get nil > "ATTACH_DIR" > (and org-attach-allow-inheritance > t) >(org-entry-put nil "ATTACH_DIR" dir))) >(org-attach-dir t > (unless (or (string= old new) > (not old)) > ;; FIXME: Need a special case for directory reset (non-nil ARG). > (when (yes-or-no-p "Copy over attachments from old directory? ") > (copy-directory old new t nil t)) > (when (yes-or-no-p (concat "Delete " old)) > (delete-directory old t) It looks good. Could you provide a patch for that, and an entry in ORG-NEWS? Also, it would be nice to provide test for the feature. Thank you ! Regards, -- Nicolas Goaziou
Re: [O] Allow #+SETUPFILE to point to an URL for the org file
On Tue, Jun 13, 2017 at 5:32 PM Nicolas Goaziou wrote: > > I have attached the revised patch. > > LGTM. Thank you for the work! > Yay! Pushed to master. Thanks for the super reviews. It was a great learning experience. -- Kaushal Modi