Re: [O] Add an optional HOLD argument to "n" Org macro
Hello, Kaushal Modi writes: > Thanks. I pushed the patch, but I missed making the when -> and change. Do > you want me to fix that in another commit? Though, functionally they are > the same, and 'make test' is passing. As I said, I was only nitpicking. Feel free to fix it, or not. Regards, -- Nicolas Goaziou
Re: [O] Asks user what to do with each tangle-file before overriding?
Hello, Chunyang Xu writes: > Currently 'C-c C-v C-t' ('org-babel-tangle') simply overrides existing > tangle-file, I would like org to ask me what to do? such as > > a) yes (override) > b) no (don't override) > c) show the diff then ask again > > In addition, if there is no diff (i.e., having the same contents), user > can choose (e.g., via a user option) to simply pass this tangle-file > without overriding. I don't think it is a good idea to have file that can be both edited manually, and auto-generated (i.e., tangled). Or, to put it differently, the idea behind tangling is that you only handle the code block, not the file itself. > I am asking for this feature because I am storing my dotfiles in a > single Org file [1], and when I change my Bash configuration then > tangle, I don't need to worry if Org is tangling other configuration > correctly, especially ~/.ssh/id_rsa and ~/.authinfo.gpg. I would rather > leave these unchanged files than override (even only file modification > timestamps are updated). You could add :tangle no on top of the sensitive blocks and remove the flag only when you want to generate them. Regards, -- Nicolas Goaziou
Re: [O] Add an optional HOLD argument to "n" Org macro
Hello Nicolas, On Sun, Jun 18, 2017, 3:16 AM Nicolas Goaziou wrote: > > As I said, I was only nitpicking. Feel free to fix it, or not. > OK, thanks for confirming. I'll leave out this edit then. > -- Kaushal Modi
[O] Automatically Concluding a Habit.
I have a habit that I'd like to perform every day or so in the lead up to an event, but after the event date I would like to be marked permanently done and never again appear in the agenda. Is there a way to do this automatically? I've tried with a combination of scheduled and deadlines, but the habit reappears after the deadline: * Prepare for Event DEADLINE: <2017-07-09 Sun> SCHEDULED: <2017-07-04 Tue .+1d> :PROPERTIES: :STYLE:habit :END: Editing the habit to remove the '.+1d' results in the desired behaviour, however I was hoping to avoid the manual edit. Thanks, Malcolm -- Malcolm Purvis
Re: [O] Add ob-sclang.el for sclang Org-mode babel support in contrib/
Hi Nicolas, Nicolas Goaziou writes: > I'm not sure to understand commit > a023d670eceb9121ef6a511b108fd82265e6d6a8. In particular, why did > you remove lexical binding? It really should be active in every > library, and is the default when you create a new one. I didn't know lexical binding was now the default when creating a library. Still: when it is not used, why adding it? -- Bastien
Re: [O] How to export LaTeX amsmath align bmatrix to ODT?
On Saturday, 17 Jun 2017 at 23:13, ed...@openmail.cc wrote: > What is an ECM and how do I produce it? (this is a honest question). Sorry: French for minimal but complete example so that others can try to reproduce the problem. See the FAQ: http://orgmode.org/worg/org-faq.html -- : Eric S Fraga via Emacs 26.0.50, Org release_9.0.8-563-g27c2ae signature.asc Description: PGP signature
Re: [O] Add ob-sclang.el for sclang Org-mode babel support in contrib/
Hello, Bastien Guerry writes: > Still: when it is not used, why adding it? We are not adding it since it is in the file by default; you removed it :) This is an odd question, however. The thing is: how is Emacs-lisp scoping, dynamic or lexical? We ought not consider it to be both throughout the code base (even though one file still uses dynamic scoping) as it is just confusing for developers. Since lexical scoping prevents a whole class of (vicious) bugs, it is the most common type of scoping among modern languages, by large. As of Emacs 24.1, let's just consider Elisp to be lexically scoped. In a nutshell, "-*- lexical-binding:t ; -*-" ought to be a mandatory cookie in every Elisp file. Regards, -- Nicolas Goaziou0x80A93738
[O] Org-mode table/links -> mediawiki
I'm at the stage of building an org-mode table to be exported to mediawiki and its going to be the front page of my DrugFacts site. So far I'm here - --8<---cut here---start->8--- | *Illegal* | *Category's* |*Legal* | *Prescription only* | *Substitute*| *Others* | |---+--+---+-+-+--| | * Amphetamines| * :Category:Anaesthetics | * Alcohol | * Alprazolam| * Buprenorphine | * Flumazenil | | * AMT | * Analgesics | * [[Betel nut][Betel nut]] | * Citalopram| * [[Methadone][Methadone]] | * [[Naxolone][Naxolone]] | | * Anabolic Steroids | * Anticonvulsants| * [[Caffeine][Caffeine]]| * Codeine | * [[Naltrexone][Naltrexone]] | | | * Benzodiazepines | * Antidepressants| * [[Paracetamol][Paracetamol]] | * Dextroamphetamine | * [[Suboxone][Suboxone]] | | | * BZP | * Anxiolytics| * [[Tobacco][Tobacco]] | * Diazepam | | | | * Cannabis| * Appetite suppressants | | * Fentanyl | | | --8<---cut here---end--->8--- But I'm running up against problems, like these - - If I make it an org-mode link, like in 'Betel nut' then when I try to export it I get a message like this "(user-error "Unable to resolve link: \"Betel nut\"") in user-error". - in mediawiki the link would be [[Betel nut]]. - In mediawiki 'Cannabis' is shown as [[Marijuana|Cannabis]], but org-mode thinks that its another column in the table. Using an org-mode table means that its very easy to generate/export the table into mediawiki format, so I really do want to use one, but I do need to have an org-mode link be able to be changed into an mediawiki link. How can I resolve both these problems please? Thanks Sharon. -- A taste of linux = http://www.sharons.org.uk TGmeds = http://www.tgmeds.org.uk DrugFacts = https://www.drugfacts.org.uk Debian 9.0, fluxbox 1.3.5-2, emacs 25.1.1, org-mode 9.0.7 signature.asc Description: PGP signature
Re: [O] Asks user what to do with each tangle-file before overriding?
Nicolas Goaziou writes: [...] > I don't think it is a good idea to have file that can be both edited > manually, and auto-generated (i.e., tangled). Or, to put it differently, > the idea behind tangling is that you only handle the code block, not the > file itself. I still think overriding exist files is dangerous, user can lost data because of it, so it should be safer if org-babel-tangle can let user decide how to deal with it. Besides, if a code block is not changed and I have already tangled it before, I don't want org-babel-tangle to update the last modified timestamp of the tangle-file every time I tangle, as along as there is no actual changes. It is simply unnecessary to me and makes the last modified timestamp more or less useless. So I would like org-babel-tangle let me choose what I want. [...]
Re: [O] Asks user what to do with each tangle-file before overriding?
On Sun, 18 Jun 2017, Chunyang Xu wrote: Nicolas Goaziou writes: [...] I don't think it is a good idea to have file that can be both edited manually, and auto-generated (i.e., tangled). Or, to put it differently, the idea behind tangling is that you only handle the code block, not the file itself. I still think overriding exist files is dangerous, user can lost data because of it, so it should be safer if org-babel-tangle can let user decide how to deal with it. Besides, if a code block is not changed and I have already tangled it before, I don't want org-babel-tangle to update the last modified timestamp of the tangle-file every time I tangle, as along as there is no actual changes. It is simply unnecessary to me and makes the last modified timestamp more or less useless. So I would like org-babel-tangle let me choose what I want. [...] It sounds like you are re-inventing version control and wanting it to be implemented in org-babel-tangle. `org-babel-tangle' can do a lot of work to assemble the files that result from tangling. Modifying `org-babel-tangle' to do what you ask would be far from trivial and make a complicated function even more tortuous. IMHO, it is better to solve your problem as follows: Set up a separate directory into which files are tangled. Use version control on that directory. Inspect changes after each tangle using the version control system's diff tools, commit good changes, and revert unwanted ones. Then run a script that uses the VC's data to identify changed files and copy those files to the location on your system where they will be used. HTH, Chuck
Re: [O] Add ob-sclang.el for sclang Org-mode babel support in contrib/
Hi Nicolas, Nicolas Goaziou writes: > Bastien Guerry writes: > >> Still: when it is not used, why adding it? > > We are not adding it since it is in the file by default; you removed > it :) I guess it is in the file by default because the odds are good that lexical scoping will be actually used. > This is an odd question, however. The thing is: how is Emacs-lisp > scoping, dynamic or lexical? We ought not consider it to be both > throughout the code base (even though one file still uses dynamic > scoping) as it is just confusing for developers. Since lexical scoping > prevents a whole class of (vicious) bugs, it is the most common type of > scoping among modern languages, by large. As of Emacs 24.1, let's just > consider Elisp to be lexically scoped. I agree it's good to have lexical scoping, but I don't consider Elisp to be lexical scopped -- I consider Elisp to let the user pick up the constraints he wants, with dynamic binding still being the default. > In a nutshell, "-*- lexical-binding:t ; -*-" ought to be a mandatory > cookie in every Elisp file. Maybe lexical binding will be the default behavior one day, but in the meantime, I would suggest to use "-*- lexical-binding:t ; -*-" only if lexical binding is actually used in the file. Best, -- Bastien
Re: [O] Add ob-sclang.el for sclang Org-mode babel support in contrib/
Bastien Guerry writes: > I agree it's good to have lexical scoping, but I don't consider Elisp > to be lexical scopped -- I consider Elisp to let the user pick up the > constraints he wants, with dynamic binding still being the default. Not at all. Lexical binding is still the way to go. If you need dynamic binding, use a global variable, e.g., a defvar, so at least this is explicit. > Maybe lexical binding will be the default behavior one day, but in the > meantime, I would suggest to use "-*- lexical-binding:t ; -*-" only if > lexical binding is actually used in the file. This is really not a good idea. Firstly, if lexical-binding is nil, no code can use it (obviously). You will not get a warning saying "Hey, your code would really benefit from lexical binding", either. You really don't want to ponder about it at every non-trivial change you make in the file. Secondly, when active, the compiler can reason (a bit) about the code and report more informative errors. The code is more readable, and therefore easier to debug, too. There is absolutely no drawback in using lexical binding. Since Emacs 24.1, it _is_ the default for Elisp: every Elisp file created activates it, the other binding being for compatibility with older libraries. Please, pretty please, don't suggest it is different. Regards,
Re: [O] Bibliograph:ref.bib vs. \printbibliograpy (WAS: Re: > Citations with org-ref in apa style)
Try this to get the heading you want. It seems to work for me. # https://tex.stackexchange.com/questions/17445/how-can-i-change-the-references-to-reference-in-the-thebibliography-environm # This makes the bibliography section title empty and un-numbered #+latex: \renewcommand{\bibsection}{\subsection*{}} * References bibliographystyle:unsrt bibliography:References.bib > > * I want this to say "References" >I don't need this to say References again: >bibliographystyle:unsrt >bibliography:References.bib > = > > References.bib > = > @article{SmartGuy17, >author = {A. Smart and Handsome Guy}, >title ={Enjoying Emacs and Org-mode}, >journal = {Hacking Accounts of Freedom}, >volume = {2}, >number = {4}, >pages ={1858-1894}, >year = {2017}, > } > = > > I hope that this helps :) . Good hacking! > > Org mode version 9.0.7 > GNU Emacs 24.4.1 > org-ref: Version 0.9.0 > > - > > ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the > NSA's hands! > $24.95 ONETIME Lifetime accounts with Privacy Features! > 15GB disk! No bandwidth quotas! > Commercial and Bulk Mail Options! -- 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] How do you organize a project and its related sub-tasks
Hi, I am curious about how people organize a project and its sub-tasks. For example, say building a website. Do you make the task a TODO task and then have TODO tasks under it? I don't like that the project appears in my org-agenda as a separate thing along with its sub-tasks. How do you handle this? Best, -- Narendra Joshi
Re: [O] Add ob-sclang.el for sclang Org-mode babel support in contrib/
Hi Nicolas, Nicolas Goaziou writes: > There is absolutely no drawback in using lexical binding. Since Emacs > 24.1, it _is_ the default for Elisp: every Elisp file created activates > it, the other binding being for compatibility with older libraries. Maybe I miss something: when I create a file with C-x C-f whatever.el RET it does not use a template or does not get created with lexical binding on. What are you referring to when you say "every Elisp file created activates it"? > Please, pretty please, don't suggest it is different. Quoting the Emacs Lisp manual: This is the ‘GNU Emacs Lisp Reference Manual’ corresponding to Emacs version 26.0.50. ... Scoping Rules for Variable Bindings * Dynamic Binding:: The default for binding local variables in Emacs. * Dynamic Binding Tips::Avoiding problems with dynamic binding. * Lexical Binding:: A different type of local variable binding. ... 12.10.1 Dynamic Binding --- By default, the local variable bindings made by Emacs are dynamic bindings. When a variable is dynamically bound, its current binding at any point in the execution of the Lisp program is simply the most recently-created dynamic local binding for that symbol, or the global binding if there is no such local binding. To me the manual clearly says dynamic binding is the default, and that's why using lexical binding requires additional info in the file. Whether lexical binding is a good default or not is another question, and whether lexical-binding:t makes sense in a file with no binding yet another, third one. -- Bastien
Re: [O] Just sharing another orgmode use: usability tests
Hi Eric. The standard clocking task mechanism will do it fine. Great. However, since there are many multiple small observations along one task, maybe a capture template is a bit overdo... I find that capturing is a lightweight activity. It all depends on what you expect to have to do. For instance, I log some activities by simply typing "C-c c l COUPLE OF KEYWORDS C-c C-c" and I'm done! The entry is time stamped automatically and it simply allows me to note something without really intruding into a workflow. It could be... maybe I feel it like too much it's because some obs are really quite short (like 1 name/place) and I took them as lines, so headings or list items are more than enough. I'll have to try it. :) OTOH, I just found the perfect timestamping method: org-timer. :))) Best... -- eduardo mercovich Donde se cruzan tus talentos con las necesidades del mundo, ahí está tu vocación. (Anónimo)
[O] org-indent-mode shows "noise" in the left-hand margin when using some themes
Hello, 1. Open the attached org file using emacs -Q org-indent-text.org I have emacs version "GNU Emacs 25.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.22.10) of 2017-04-22" and thus org version 8.2.10 2. Change to a built-in dark theme: (load-theme 'tsdh-dark) 3. SHIFT-TAB a bit, everything looks fine. 4. Open another emacs using: emacs -Q -l minimal-org.el org-indent-text.org 5. Now it is org-version 9.0.8. 6. Change to built-in dark theme: (load-theme 'tsdh-dark) 7. SHIFT-TAB a bit, notice that there is subtle "noise" on the left side in the line-prefix. I've attached a screenshot to show what I'm talking about. I haven't tried different versions of org to see where this behavior begins. This also happens on some other themes with dark backgrounds, but so far it doesn't happen with light backgrounds. Or if it does it's completely invisible. Thanks for the help, -Forrest ;;; Minimal setup to load latest 'org-mode' ;; activate debugging (setq debug-on-error t debug-on-signal nil debug-on-quit nil) ;; add latest org-mode to load path (add-to-list 'load-path (expand-file-name "/home/sedgwick/.emacs.d/elpa/org-20170606")) org-indent-text.org Description: Lotus Organizer
Re: [O] Asks user what to do with each tangle-file before overriding?
"Charles C. Berry" writes: [...] > It sounds like you are re-inventing version control and wanting it to be > implemented in org-babel-tangle. > > `org-babel-tangle' can do a lot of work to assemble the files that result > from tangling. Modifying `org-babel-tangle' to do what you ask would be > far from trivial and make a complicated function even more tortuous. Yes, I agree it is not an easy task. > IMHO, it is better to solve your problem as follows: Set up a separate > directory into which files are tangled. Use version control on that > directory. Inspect changes after each tangle using the version control > system's diff tools, commit good changes, and revert unwanted ones. Then > run a script that uses the VC's data to identify changed files and copy > those files to the location on your system where they will be used. I found 'C-x s' ('save-some-buffers') can be used as the "version control", so I made a wrapper command for 'org-babel-tangle' using it. The wrapper command is not perfect (I guess it doesn't support remote-file and doesn't always respect tangle-mode, for example), but I am OK with it and it already does what I want. #+BEGIN_SRC emacs-lisp :results silent :lexical yes (defun chunyang-org-babel-tangle (&optional arg target-file lang) "Like `org-babel-tangle' but don't override without permission." (declare (interactive-only org-babel-tangle)) (interactive "P") (require 'ob-tangle) (require 'seq) (require 'cl-lib) (save-some-buffers) (let* ((tmpdir (let ((dir "/tmp/org-babel-tangle/")) (or (file-exists-p dir) (make-directory dir)) dir)) (mkbak (lambda (filename) (expand-file-name (replace-regexp-in-string "/" "!" (expand-file-name filename)) tmpdir))) (diffp (lambda (file-a file-b) (/= 0 (call-process diff-command nil nil nil (expand-file-name file-a) file-b (swap (lambda (file-a file-b) (let ((tmp (make-temp-name tmpdir))) (copy-file file-a tmp t t t t) (copy-file file-b file-a t t t t) (copy-file tmp file-b t t t t deleted-files tangled-files (advice (define-advice delete-file (:around (old-fun filename &rest args) dont-delete) (push filename deleted-files) (copy-file filename (funcall mkbak filename) t t t t) (apply old-fun filename args (unwind-protect (progn (setq tangled-files (org-babel-tangle arg target-file lang) deleted-files (nreverse deleted-files)) (cl-loop for f in (seq-intersection deleted-files tangled-files) for bak = (funcall mkbak f) do (funcall swap f bak) (if (funcall diffp f bak) (with-current-buffer (find-file-noselect f) (message "Diff %s..." f) (delete-region (point-min) (point-max)) (insert-file-contents bak)) (message "Skip %s..." f)) finally (save-some-buffers))) (advice-remove 'delete-file advice #+END_SRC [...]
[O] How to use noweb reference with argument in other languages?
I found noweb reference with argument `<>` issue. This can work: ```org #+NAME: f1 #+BEGIN_SRC emacs-lisp :var x=7 :results value (+ x x) #+END_SRC #+RESULTS: f1 : 14 #+NAME: f2 #+BEGIN_SRC emacs-lisp :var x=7 :results value (+ x 2) #+END_SRC #+RESULTS: f2 : 9 #+name: intermediate #+call: f1(x=5) #+RESULTS: intermediate : 10 #+call: f2(x=intermediate) #+RESULTS: : 12 #+name: intermediate #+BEGIN_SRC emacs-lisp :noweb yes :results value <> #+END_SRC #+BEGIN_SRC emacs-lisp :noweb yes :results value <> #+END_SRC #+RESULTS: : 12 ``` And this does not work: ```org #+NAME: sh-print-something #+BEGIN_SRC sh :var str="" echo "$str" #+END_SRC #+BEGIN_SRC sh :results output :noweb yes echo "hello, " <> #+END_SRC #+RESULTS: ``` Why the first language `emacs-lisp` works, but second `sh` does not work? [stardiviner] GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 Blog: http://stardiviner.github.io/
Re: [O] Asks user what to do with each tangle-file before overriding?
I also think Org-mode table src block content to override file is dangerous. I have another idea. Append src block content to end of file. I have a sceniro: File `dotfile-1.org`: ``` * SSH config 1 #+BEGIN_SRC conf :tangle "~/.ssh/config" fragment 1 #+END_SRC ``` File `dotfile-2.org`: ``` * SSH config 2 #+BEGIN_SRC conf :tangle "~/.ssh/config" fragment 2 #+END_SRC ``` When the tangle src blocks are in separate files, this override file way is not suitable. Of course I can put those src blcoks together, but when I have to organize literate programming files in separately, the override way is not suitable anymore. So hope Org-mode can provide `append` way with an `defcustom` option. [stardiviner] GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 Blog: http://stardiviner.github.io/ On Fri, Jun 16, 2017 at 1:09 PM, Chunyang Xu wrote: > Hi, > > Currently 'C-c C-v C-t' ('org-babel-tangle') simply overrides existing > tangle-file, I would like org to ask me what to do? such as > > a) yes (override) > b) no (don't override) > c) show the diff then ask again > > In addition, if there is no diff (i.e., having the same contents), user > can choose (e.g., via a user option) to simply pass this tangle-file > without overriding. > > I am asking for this feature because I am storing my dotfiles in a > single Org file [1], and when I change my Bash configuration then > tangle, I don't need to worry if Org is tangling other configuration > correctly, especially ~/.ssh/id_rsa and ~/.authinfo.gpg. I would rather > leave these unchanged files than override (even only file modification > timestamps are updated). > > [1] https://raw.githubusercontent.com/xuchunyang/dotfiles/ > master/README.org > > > >
Re: [O] How do you organize a project and its related sub-tasks
On Sunday, 18 Jun 2017 at 20:45, Narendra Joshi wrote: > Hi, > > I am curious about how people organize a project and its sub-tasks. For > example, say building a website. Do you make the task a TODO task and > then have TODO tasks under it? I don't like that the project appears in > my org-agenda as a separate thing along with its sub-tasks. How do you > handle this? Depends. For some projects, I have a single TODO entry but with [/] on the headline and then with checklist items. For other projects, especially long ones, I have individual TODO items in a project file but that file is not one of the agenda files so they do not clutter up my agenda. -- : Eric S Fraga via Emacs 26.0.50, Org release_9.0.7-531-g530113 signature.asc Description: PGP signature