[O] org-mode in teaching
Hi all, I wrote a blog post (http://kitchingroup.cheme.cmu.edu/blog/2014/12/18/org-mode-+-Python-+-git-in-a-graduate-engineering-course/) on how I used org-mode in teaching this past fall. Short summary: All the notes, assignments, quizzes, exams, etc... were in org-mode, students did all their work in org-mode, and we did all our grading in org-mode. It was pretty awesome! Thanks everyone for an awesome community, and fantastic package in org-mode. Best wishes in the new year! -- --- John Kitchin @johnkitchin http://kitchingroup.cheme.cmu.edu
Re: [O] Naming of (indirect?) buffers opened by C-'
(defun gcr/org-edit-src-code-plus-name () "Edit the well-described source code block. Attribution: URL `https://lists.gnu.org/archive/html/emacs-orgmode/2014-09/msg00778.html'" (interactive) (let* ((eop (org-element-at-point)) (name (or (org-element-property :name (org-element-context eop)) "ॐ")) (lang (org-element-property :language eop)) (buff-name (concat "*Org Src " name "[" lang "]*"))) (org-edit-src-code nil nil buff-name))) On Thu, Dec 18, 2014 at 5:00 AM, Rainer M Krug wrote: > Hi > > I remember there was a discussion recently about the naming of the > indirect buffers of source code block opened with C-' but I can't find > it at the moment. Was there a solution on giving these buffers a > useful name, i.e. the name of the code block? > > If this is included in org, it does not seem to be working for me? > > Thanks, > > Rainer > > -- > Rainer M. Krug > email: Rainerkrugsde > PGP: 0x0F52F982 -- Grant Rettke g...@wisdomandwonder.com | http://www.wisdomandwonder.com/ “Wisdom begins in wonder.” --Socrates ((λ (x) (x x)) (λ (x) (x x))) “Life has become immeasurably better since I have been forced to stop taking it seriously.” --Thompson
[O] Word under cursor to internal link
You can use the function below to make it. But in order to replace it rightly, you need to put you cursor inside the word or at the beginning of the word. (defun word-to-link () (interactive) (let ((word (thing-at-point 'word))) (forward-word) (kill-word -1) (insert (format "[[%s]]" word Hope it helps. And any improvement will be welcome.
[O] new org-ref repo
Hi all, I have finally put my org-ref code into its own git repo: https://github.com/jkitchin/org-ref The repo includes some handy utility functions on a doi and bibtex entries. I "improved" the cite link menu so it has a lot of new options to open a cite link bibtex key in web of science, pubmed, google scholar and cross-ref if the corresponding bibtex entry has a doi. It is pretty nice (biased opinion of course). Hopefully I got all the dependencies in this repo correct so it will just work for you. If not, post an issue on Github, and I will work on fixing it! Thanks, -- --- John Kitchin @johnkitchin http://kitchingroup.cheme.cmu.edu
Re: [O] Word under cursor to internal link
Something like this seems to do approximately what you want: #+BEGIN_SRC emacs-lisp (defun word-to-link () (interactive) (save-excursion (let (start end word) (backward-word) (setq start (point)) (forward-word) (setq end (point)) (setq word (buffer-substring start end)) (setf (buffer-substring start end) (format "[[%s]]" word) #+END_SRC Chaitanya Krishna writes: > Hello there, > > Is there a shortcut to change word under cursor to an internal link? > Basically it is a pain trying to surround with two braces all the > time! > > C-c C-l does not prompt me to create an internal link. > > Best regards, > Chai > -- --- John Kitchin Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu
[O] Word under cursor to internal link
Hello there, Is there a shortcut to change word under cursor to an internal link? Basically it is a pain trying to surround with two braces all the time! C-c C-l does not prompt me to create an internal link. Best regards, Chai
Re: [O] [bug, patch, ox] INCLUDE and footnotes
Hi, Thanks for the notes. Hopefully patch one if good now. Patch two needs tests, but I can write those if we agree to impose minlevel automatically. Nicolas Goaziou writes: > AFAICT, there's no reason to include a rule about whitespace separating > anything. Just make sure that any INCLUDE keyword that doesn't have > a :minlevel property gets one set to 1+N, where N is the current level > (or 0 if at top level). > > Another option is to delay insertion of included files: expand them > completely in different strings, then replace keywords with appropriate > strings. IOW, just make sure expansion doesn't happen sequentially. OK. Solution one sounds easier. A quick attempt, without tests, is given in the second patch. I'll add patches if you agree with the easy approach. It seems to work, though I'm not sure if the matching of headlines which should have :minlevel added is robust enough. >> Objects can be extracted via =#+INCLUDE= using file links. It is >> -possible to include only the contents of the object. See manual for >> +possible to include only the contents of the object. Further, >> +footnotes are now supported when using =#+INCLUDE=. See manual for > > This is not quite true. Footnotes are already supported with INCLUDE > keywords. This is the combination of :lines and footnotes that is new. > It is more a bugfix than a new feature. Right. Removed. >> + (goto-char (point-min)) >> + (while (and (search-forward-regexp org-footnote-re nil t)) >> + (let* ((reference (org-element-context)) >> +(type (org-element-type reference)) >> +(label (org-element-property :label reference))) >> + (when (and label (eq type 'footnote-reference)) >> + (unless (org-footnote-get-definition label) >> + (save-excursion >> + (org-footnote-create-definition label) >> + ;; We do not need an error here since ox >> + ;; will complain if a footnote is missing. >> + (insert (or (gethash label footnotes) ""))) > > Why is the above necessary? Shouldn't you only insert footnotes > definitions at the end of the master document (i.e. when INCLUDED is > nil)? Indeed. Thanks for the hint! > I think a `maphash' is enough. > > Also, looking for every footnote reference sounds tedious. You should > simply insert every footnote definition collected there, and filter out > unnecessary definitions at another level (e.g., before storing it in the > hash table). Thanks! >> + (when id >> +(unless (eq major-mode 'org-mode) >> + (let ((org-inhibit-startup t)) (org-mode))) > > Is it necessary? I think org-with-wide-buffer is sufficient. >> +(forward-char 4) >> +(insert (format "%d-" id)) >> +(and (not (eq footnote-type 'inline)) >> + (let ((new-label (org-element-property >> + :label (org-element-context > > Why do you need to parse the new label, since you know it already: > > (concat (format "%d-" id) label) Almost, but label contains fn: first, so the above would be e.g. 1-fn:1. I didn't see an elegant way of doing it at first, thus I used elements, but now I just use regexp-replace... I solved in another way. >> + (save-restriction >> + (save-excursion >> + (widen) > > `save-restriction' + `save-excursion' + `widen' = `org-with-wide-buffer' Cool. >> + (puthash new-label >> + (org-element-normalize-string >> +(buffer-substring >> + (org-element-property >> + :contents-begin definition) >> + (org-element-property >> + :contents-end definition))) >> + footnotes)) > > Here you could check if :contents-begin is within LINES, in which case > the definition needs not be inserted at the end of the master document. Good idea. I did it a bit more elaborated since footnotes can in principle also be before the definition. I don't check for the end. Thanks, Rasmus -- Slowly unravels in a ball of yarn and the devil collects it >From 5d79c76c6a93666a1521a5d5eefe3d79bda3d00d Mon Sep 17 00:00:00 2001 From: rasmus Date: Tue, 9 Dec 2014 12:40:52 +0100 Subject: [PATCH 1/2] ox.el: Fix footnote-bug in #+INCLUDE-keyword * ox.el (org-export--prepare-file-contents): Preserve footnotes when using the LINES argument. New optional argument FOOTNOTES. (org-export-expand-include-keyword): New optional argument FOOTNOTES. * test-ox.el: Add test for INCLUDE with :lines and footnotes. --- lisp/ox.el | 116
[O] Naming of (indirect?) buffers opened by C-'
Hi I remember there was a discussion recently about the naming of the indirect buffers of source code block opened with C-' but I can't find it at the moment. Was there a solution on giving these buffers a useful name, i.e. the name of the code block? If this is included in org, it does not seem to be working for me? Thanks, Rainer -- Rainer M. Krug email: Rainerkrugsde PGP: 0x0F52F982 signature.asc Description: PGP signature
Re: [O] [PATCH] getting calc-units working in table formulas
Eric Abrahamsen writes: > Michael Brand writes: > >> Hi Eric >> >> On Wed, Dec 17, 2014 at 2:09 AM, Eric Abrahamsen >> wrote: >>> Lastly, is there a way to both use output formatting, and retain the >>> unit name (if desired)? Right now I get this: >>> >>> | km| units | conversion | >>> |---+---+| >>> | 2.5km | ft|8202.10 | >>> #+TBLFM: $3=uconvert($1, $2); %.2f >>> >>> Ie, the "ft" falls off the results when I add the "%.2f". Is it possible >>> to retain that and have formatting? >> >> Yes, see >> "org-spreadsheet: formatting chops off units" >> http://thread.gmane.org/gmane.emacs.orgmode/59928 > > I'm certainly late to this party! My only excuse is that it's far from > obvious, given the current manual, that all this is available (even > after your documentation patch in the referenced thread). > > Just to note, the second of the two formatting solutions you mentioned > (manually adding the units as a string) seems to no longer work. The > first does, however. > > I'll work up a slightly longer documentation patch in the next couple of > days -- I really think people should be alerted to what's possible with > units. The "uconvert" defmath could even just be an example in the > manual, rather than code that ships with Org. Here's the doc patch, hope all is in order. Eric >From da8e9914d4f63cb3bfa6e7beacd8ee762044b2e6 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Thu, 18 Dec 2014 18:04:00 +0800 Subject: [PATCH] Mention calc-units in the spreadsheet documentation * doc/org.texi: Outline using units in tables, link to appropriate part of the Calc manual. --- doc/org.texi | 20 1 file changed, 20 insertions(+) diff --git a/doc/org.texi b/doc/org.texi index 7c464ca..aae0537 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -2756,6 +2756,26 @@ should be padded with 0 to the full size. You can add your own Calc functions defined in Emacs Lisp with @code{defmath} and use them in formula syntax for Calc. +Calc also comes with support for unit calculations, via the @code{calc-units} +package. For a complete list of recognized units, call +@code{calc-view-units-table}. Units can be specified with or without a space +between the number and the unit name, eg @samp{2 ft} is the same as +@samp{2ft}. Rates are handled automatically: multiplying @samp{3 m/s} by two +will give @samp{6 m / s}. By default, @code{calc-units} only defines one +units-related function for use in tables, @code{usimplify}, which can take an +expression such as @samp{42 km / 2.5 h} and return @samp{16.8 km / hr}. +Another useful function to define might be @code{math-convert-units}, eg: + +@example +(defmath uconv (expr target-units &optional pure) + (math-convert-units expr target-units pure)) +@end example + +Which would allow you to use @samp{uconv($1, ft)} to, for example, convert a +distance specified in the cell @samp{$1} into feet. The optional 'pure +argument strips the units designator from the number in the results. +@xref{Units, Operating on Units,,calc}. + @node Formula syntax for Lisp @subsection Emacs Lisp forms as formulas @cindex Lisp forms, as table formulas -- 2.2.0
[O] org-agenda-todo-ignore-timestamp vs org-agenda-todo-ignore-with-date
Hello, I vaguely remember asking about this some time ago, but could not find that thread. It is not at all clear from the docstrings what is the difference between org-agenda-todo-ignore-with-date and org-agenda-todo-ignore-timestamp. I did a simple experiment on my agenda and found out that org-agenda-todo-ignore-timestamp did not ignore entries with a repeater timestamp, while org-agenda-todo-ignore-with-date did. Is that correct? If yes, could it be said in the manual? TIA, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University