Re: [O] New feature? Remove duplicate subheadings, preserving order
AFAIK, this is the first time this need is expressed on this ML. There is no equivalent in "org-list.el" either. A way to handle duplicates would be useful, indeed. But a basic function should only remove duplicates that are truly identical (same properties, same tags, same/no content). Still, removing true duplicates from subtrees (AND lists) would be useful. More useful would be a slightly more general approach. I have three kinds of duplicates: - duplicate IDs (which are handled rather poorly), - duplicate content (which often is only almost identical) and - duplicate headings (which usually I want to rectify when they are on the same level of the same subtree) As you can see, a fixed concept of duplication is probably not going to work. What I'd like is a function finds duplicates according to scope, match (as in `org-map-entries') and a user defined function. This function should then display the problem cases (via agenda view?). Then we need a couple of convenience functions like - delete all duplicates but the one at point, - mark duplicates I want to keep, - uniquify entries (tricky; for headlines maybe prompt the user; for IDs, we should check if the ID is referenced from somewhere) - merge entries. But then, I also have duplicates (in content) I want to keep, e.g. one in my notes and in a writing project. So, we'd need a property like "DUPLICATE_OF".
[O] Merging Faces
Hello everyone, how do you add custom face properties to an org buffer? I want to generate org buffers automatically (displaying verious entries and properties). Specifically, I want the resulting buffer in org mode to handle links, equations, and export. But I want also to add custom background or fonts to parts of the buffer. The easiest way to see the problem is this: (let ((entry (concat "any " (propertize "link" 'font-lock-face '(:family "DejaVu Sans Mono")) " like [[file:some-file]] or equations like \\(\\sqrt{\\frac{1}{(x+y)^2\\), but also /italics/ and *bold text* should be displayed correctly;"))) (switch-to-buffer-other-window "*fb-merging-example") (erase-buffer) (insert (propertize (concat "1. " entry) 'font-lock-face '(:background "yellow") 'underline t)) (insert "\n2. other font:") (insert (propertize entry 'font-lock-face '(:family "Symbola"))) (org-mode)) Two problems: 1. "link" has not the right font. I guess `propertize' doesn't merge face. Is there a way to accomplish this? 2. Links and equations don't have the desired background. Any help appreciated.
Re: [O] Is it possible for a TODO item not to be an outline item?
On 08.10.2017 13:40, Angel de Vicente wrote: So basically I would like to have that TODO item but somehow without creating a new section. Is it possible? Use --- bla bla bla # TODO: fix installation bla bla bla --- and M-x org-occur-in-agenda-files (which is bound to C-a /). Florian
Re: [O] Valid use cases for lists?
Can anyone give me an example of when it's a good idea to use lists rather than headlines? Headlines often are too heavy for my taste. My reading notes as well as my notes for writing usually do not have a title. (You might think it good practice to come up with a title, but my experiments tell me otherwise.) Headlines are too noisy, both on screen and when exporting. when you use them, and then try to use pretty much any other Org feature on them (marking them as a TODO item, tagging, etc.) it doesn't work because lists aren't meant to be used that way. True, but there are ways around that: - Instead of tagging, write the keywords after the item (use custom links or hooks to supress exporting) - Use visual-line-mode and search with multi occur. - use =#+TODO:= instead of todo keywords (and use multi occur). - To uniquely id items, add timestamps (and use multi occur). - Write a function to refile items (my hack is a bit idiosyncratic so I don't share it here, but it should be pretty straighforward using =(org-refile t)= to get the location). -- Florian Beck
Re: [O] [PATCH] Fix massive slowdown in org-id-find
Hello, [sorry for the delay, I had some git SNAFUs] Could you also send and updated patch containing the VALUE optional argument to `org-re-property' and changing modifying only the (re ...) line in `org-find-property', with a new profiling? Seems like this does trick. I don't really understand why, though. The previous profiling seemed to indicate that most of the time was spent in `org-entry-get' (that's why I removed it). Anyway, many thanks for helping me out. Much appreciated. I attached the new patch. (let ((time (current-time))) (org-id-find zangwill.nick_2014:aesthetic.judgment) (format %ss (time-to-seconds (time-subtract (current-time) time -- 0.032598146s Here is the profiler report: - command-execute 215 89% - call-interactively 215 89% - funcall-interactively 140 58% + execute-extended-command 92 38% - eval-last-sexp35 14% - elisp--eval-last-sexp35 14% - eval35 14% - let35 14% - org-id-find 35 14% - org-id-find-id-in-file 35 14% - org-find-entry-with-id 35 14% - org-find-property 35 14% - save-excursion35 14% - let 35 14% - catch 35 14% while 35 14% + next-line 13 5% + byte-code 75 31% + redisplay_internal (C function) 15 6% + timer-event-handler 11 4% + ... 0 0% -- Florian Beck From 389d8cec4406c394f3bf955726823951b014f6aa Mon Sep 17 00:00:00 2001 From: Florian Beck f...@miszellen.de Date: Mon, 30 Mar 2015 22:27:36 +0200 Subject: [PATCH] org.el: Allow searching for specific property value * lisp/org.el (org-re-property): New optional argument. (org-find-property): Use it. --- lisp/org.el | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index cf37950..4f61123 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -6254,7 +6254,7 @@ takes into consideration inlinetasks. (defvar org-font-lock-keywords nil) -(defsubst org-re-property (property optional literal allow-null) +(defsubst org-re-property (property optional literal allow-null value) Return a regexp matching a PROPERTY line. When optional argument LITERAL is non-nil, do not quote PROPERTY. @@ -6262,14 +6262,22 @@ This is useful when PROPERTY is a regexp. When ALLOW-NULL is non-nil, match properties even without a value. Match group 3 is set to the value when it exists. If there is no -value and ALLOW-NULL is non-nil, it is set to the empty string. +value and ALLOW-NULL is non-nil, it is set to the empty string. + +With optional argument VALUE, match only property lines with +that value; in this case, ALLOW-NULL is ignored. VALUE is quoted +unless LITERAL is non-nil. (concat ^\\(?4:[ \t]*\\) (format \\(?1::\\(?2:%s\\):\\) (if literal property (regexp-quote property))) - (if allow-null - \\(?:\\(?3:$\\)\\|[ \t]+\\(?3:.*?\\)\\)\\(?5:[ \t]*\\)$ - [ \t]+\\(?3:[^ \r\t\n]+.*?\\)\\(?5:[ \t]*\\)$))) + (cond (value + (format [ \t]+\\(?3:%s\\)\\(?5:[ \t]*\\)$ + (if literal value (regexp-quote value + (allow-null + \\(?:\\(?3:$\\)\\|[ \t]+\\(?3:.*?\\)\\)\\(?5:[ \t]*\\)$) + (t + [ \t]+\\(?3:[^ \r\t\n]+.*?\\)\\(?5:[ \t]*\\)$ (defconst org-property-re (org-re-property \\S-+ 'literal t) @@ -16323,7 +16331,7 @@ part of the buffer. (save-excursion (goto-char (point-min)) (let ((case-fold-search t) - (re (org-re-property property nil (not value + (re (org-re-property property nil (not value) value))) (catch 'exit (while (re-search-forward re nil t) (when (if value (equal value (org-entry-get (point) property nil t)) -- 2.1.0
Re: [O] [PATCH] Fix massive slowdown in org-id-find
Would you mind elaborating a bit? Slow down doing what? In which cases? A fraction of a second vs 10 seconds when executing a function that calls org-id-find. The slowdowwn is not quite as massive since I cleaned up org-id-files a bit, however. Could you profile it? I'll look into it. Here, it catches false positives, e.g., lines looking like properties in example blocks. It also overlooks accumulated values. This is true. However that is not really relevant for id searches, is it? In the worst case, you'll find ids in example, etc blocks when you SEARCH for them. I guess, you want to use org-find-property in other places as well. In that case org-id-find could maybe use a faster, simplified version? Let me see, if I can do some profiling tonight. It should fail with make test. Doesn't work for me (it hangs). -- Florian Beck
Re: [O] [PATCH] Fix massive slowdown in org-id-find
Could you profile it? Here are the results: With my setup and the patch I get, using (let ((time (current-time))) (org-id-find zangwill.nick_2014:aesthetic.judgment) (format %ss (time-to-seconds (time-subtract (current-time) time -- 0.027756516s Without my patch, the result is -- 16.104403749s profile-report returns: - command-execute 16095 99% - call-interactively 16095 99% - funcall-interactively 15905 98% - eval-last-sexp 15879 98% - elisp--eval-last-sexp 15879 98% - eval 15879 98% - let 15879 98% - org-id-find15879 98% - org-id-find-id-in-file15879 98% - org-find-entry-with-id 15879 98% - org-find-property 15879 98% - save-excursion 15879 98% - let 15879 98% - catch15879 98% - while 15879 98% - if 13311 82% - if13311 82% - equal13311 82% - org-entry-get 11955 74% - org-get-property-block 8876 55% - org-inlinetask-in-task-p 3329 20% org-inlinetask-outline-regexp 12 0% - org-back-to-heading3009 18% - outline-back-to-heading 2000 12% outline-on-heading-p4 0% org-before-first-heading-p 880 5% org-get-limited-outline-regexp 24 0% - #compiled 0x3e8f1b9939 5% match-string-no-properties 44 0% - execute-extended-command 20 0% - sit-for 16 0% redisplay 16 0% + command-execute 4 0% + previous-line 6 0% + byte-code 190 1% + timer-event-handler 15 0% + ... 0 0% -- Florian Beck
[O] [PATCH] Fix massive slowdown in org-id-find
Hi, the recent changes in org-id (presumably 8cdb2eef0f9f98f9e00a5e689decfe341fe0c6ec) lead to a massive slowdown. org-id-find is slow as it is, now I find it almost unusable. Attached patch provides a fix. -- Florian Beck From 9867f0f45befc26854920d759a2505adba5d486b Mon Sep 17 00:00:00 2001 From: Florian Beck f...@miszellen.de Date: Mon, 23 Mar 2015 11:35:09 +0100 Subject: [PATCH 362/362] org.el: Improve speed of org-find-property * lisp/org.el (org-re-property): New optional argument. (org-find-property): Simplify value search. --- lisp/org.el | 28 +--- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 85a8048..71c5e6e 100755 --- a/lisp/org.el +++ b/lisp/org.el @@ -6268,7 +6268,7 @@ takes into consideration inlinetasks. (defvar org-font-lock-keywords nil) -(defsubst org-re-property (property optional literal allow-null) +(defsubst org-re-property (property optional literal allow-null value) Return a regexp matching a PROPERTY line. When optional argument LITERAL is non-nil, do not quote PROPERTY. @@ -6276,14 +6276,22 @@ This is useful when PROPERTY is a regexp. When ALLOW-NULL is non-nil, match properties even without a value. Match group 3 is set to the value when it exists. If there is no -value and ALLOW-NULL is non-nil, it is set to the empty string. +value and ALLOW-NULL is non-nil, it is set to the empty string. + +With optional argument VALUE, match only property lines with +that value; in this case, ALLOW-NULL is ignored. VALUE is quoted +unless LITERAL is non-nil. (concat ^\\(?4:[ \t]*\\) (format \\(?1::\\(?2:%s\\):\\) (if literal property (regexp-quote property))) - (if allow-null - \\(?:\\(?3:$\\)\\|[ \t]+\\(?3:.*?\\)\\)\\(?5:[ \t]*\\)$ - [ \t]+\\(?3:[^ \r\t\n]+.*?\\)\\(?5:[ \t]*\\)$))) + (cond (value + (format [ \t]+\\(?3:%s\\)\\(?5:[ \t]*\\)$ + (if literal value (regexp-quote value + (allow-null + \\(?:\\(?3:$\\)\\|[ \t]+\\(?3:.*?\\)\\)\\(?5:[ \t]*\\)$) + (t + [ \t]+\\(?3:[^ \r\t\n]+.*?\\)\\(?5:[ \t]*\\)$ (defconst org-property-re (org-re-property \\S-+ 'literal t) @@ -16331,12 +16339,10 @@ part of the buffer. (save-excursion (goto-char (point-min)) (let ((case-fold-search t) - (re (org-re-property property nil (not value - (catch 'exit - (while (re-search-forward re nil t) - (when (if value (equal value (org-entry-get (point) property nil t)) - (org-entry-get (point) property nil t)) - (throw 'exit (progn (org-back-to-heading t) (point) + (re (org-re-property property nil (not value) value))) + (when (re-search-forward re nil t) + (org-back-to-heading t) + (point) (defun org-delete-property (property) In the current entry, delete PROPERTY. -- 2.1.0
[O] [PATCH] Fix error when inserting into diary from agenda
Hi, emacs trunk dropped some old aliases. This patch fixes it. -- Florian Beck From e2188e0fb3fe322146a9950bfff74773dd54018a Mon Sep 17 00:00:00 2001 From: Florian Beck f...@miszellen.de Date: Sat, 15 Nov 2014 19:14:27 +0100 Subject: [PATCH 9/9] Replace obsolete aliases of calendar functions. * lisp/org-agenda.el (org-agenda-diary-entry): Replace obsolete functions. --- lisp/org-agenda.el | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 97970a6..2b5a8ec 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -9526,13 +9526,13 @@ entries in that Org-mode file. (message Diary entry: [d]ay [w]eekly [m]onthly [y]early [a]nniversary [b]lock [c]yclic) (read-char-exclusive))) (cmd (cdr (assoc char - '((?d . insert-diary-entry) - (?w . insert-weekly-diary-entry) - (?m . insert-monthly-diary-entry) - (?y . insert-yearly-diary-entry) - (?a . insert-anniversary-diary-entry) - (?b . insert-block-diary-entry) - (?c . insert-cyclic-diary-entry) + '((?d . diary-insert-entry) + (?w . diary-insert-weekly-entry) + (?m . diary-insert-monthly-entry) + (?y . diary-insert-yearly-entry) + (?a . diary-insert-anniversary-entry) + (?b . diary-insert-block-entry) + (?c . diary-insert-cyclic-entry) (oldf (symbol-function 'calendar-cursor-to-date)) ;; (buf (get-file-buffer (substitute-in-file-name diary-file))) (point (point)) -- 1.9.1
Re: [O] Embedded LaTeX does not work with Unicode quotes
Nick Dokos ndo...@gmail.com writes: punctuation in the syntax tables. Look for org-latex-regexps in org.el The line in question is #+BEGIN_SRC emacs-lisp ($ \\([^$]\\|^\\)\\(\\(\\$\\([^ \r\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \r\n,.$]\\)\\$\\)\\)\\([- .,?;:'\)\000]\\|$\\) 2 nil) #+END_SRC It's probably not too hard to see that the culprit is the bunch of punctuation characters towards the end. Indeed if you change .,?;:'\ to .,?;:'\” -- that solves the OPs problem. However, it might be even better to use a more general syntax, [:punct:], which matches all punctuation (as we want). So: #+BEGIN_SRC emacs-lisp ($ \\([^$]\\|^\\)\\(\\(\\$\\([^ \r\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \r\n,.$]\\)\\$\\)\\)\\([- [:punct:]\000]\\|$\\) 2 nil) #+END_SRC -- Florian Beck
Re: [O] [PATCH] org-table-beginning/end-of-field
Nicolas Goaziou m...@nicolasgoaziou.fr writes: the next (or maybe previous) cell. You may want to try `org-element-context' in the following places, where X denotes cursor: | a | b | X c | d | X a | b | | c | d | This I did. X | a | b | | c | d | | a | b | X | c | d | | a | b | X | c | d | This is arguably outside the scope of org-table-beginning/end, isn't it? Come to think of it, these functions should only move to the beginning or end of the field, period. Then handle the special case in org-forward/backward-sentence or create two new functions. I don't think `org-element-get' should go into org-element.el in its current implementation. It is tied to a position, which implies to take care of boring stuff like buffer narrowing. It doesn't allow to re-use an already computed element or object either, which is sub-optimal. Yes, it should be split into two functions. However, the feature is useful enough that some function could provide something similar. Maybe the following one: (defun org-element-parent (blob optional types genealogy) Return BLOB's parent, or nil. BLOB is an object or element. When optional argument TYPES is a list of symbols, return the first element or object between BLOB and its ancestors whose type belongs to that list. When optional argument GENEALOGY is non-nil, return a list of all ancestors, from closest to farthest. When BLOB is obtained through `org-element-context' or `org-element-at-point', only ancestors from its section can be found. There is no such limitation when BLOB belongs to a full parse tree. (if (not (or types genealogy)) (org-element-property :parent blob) (let ((up blob) ancestors) (while (and up (not (memq (org-element-type up) types))) (when genealogy (push up ancestors)) (setq up (org-element-property :parent up))) (if genealogy (nreverse ancestors) up Its name is a bit confusing since it can return BLOB under some optional argument combination (i.e., if BLOB's type belongs to TYPES). However, it covers most, if not all, needs about ancestors. WDYT? Yes this works. Making TYPES into a list is a nice touch. However: - the advertised functionality (returning the parent) is only marginally useful and handled in half a line of code; whereas most of the functionality is hidden as optional; - this leads to confusing behaviour, as you have noted, because the type of object I'm looking for, is not necessarily the parent; - BLOB on the other hand should be optional, because defaulting it to org-element-context would be highly useful. - not sure what GENEALOGY is useful for; if the user also specified TYPES, this returns the ancestors up to but NOT including those of TYPE. Also, I modified `org-element-table-cell-parser', because otherwise :contents-begin and :contents-end point to the end of the cell. Not sure if this breaks anything. Usually, when an object has no contents (e.g., a link without description), both :contents-begin and :contents-end are nil. It is less confusing than providing an arbitrary buffer position. That's another possibility. Unlike a link without description, one might argue that an empty cell has a natural contents position. Minor note: you can insert point in the string to avoid finding the correct position later. E.g., | Cell:point1 | Cell2 |Cell3|\n| Cell4 | | Cell5| Great, thanks! -- Florian Beck
Re: [O] [PATCH] org-table-beginning/end-of-field
Hi Nicolas, thanks for the review. I hope the new version is an improvement. Nicolas Goaziou m...@nicolasgoaziou.fr writes: Also, note that you can avoid requiring MOVE-FN, ELEMENT and CMP-FN if you decide that ( n 0) = (#'org-table-next-field :contents-end #'=) ( n 0) = (#'org-table-previous-fierd :contents-begin #'=) Up to you. I wanted to use the n=0 case to supress the conditional movement to the next field. It's probably not worth it and I removed it. Now everything simplifies to one function. IOW, you need to let-bind (org-element-context) and find the first `table', `table-row' or `table-cell' object/element among it and its parents. Then - if no such ancestor is found: return an error (not at a table) - if `table' is found but point is not within [:contents-begin :contents-end[ interval, return an error (not inside the table) - if `table' or `table-row' is found, you need to apply org-table/previous/next/-field once (and diminish N by one) to make sure point will be left on a regular cell, if possible. But as long as I have a table cell ancestor, I should be fine. Am I missing something? I added a function `org-element-get' to help with that. What do you think? (If `cl-labels' is a no-go, we could split out a helper function.) Thank you for taking care of this. There are bonus points if you can write tests along with this change. I added a couple of tests. Not really succinct, though. Also, I modified `org-element-table-cell-parser', because otherwise :contents-begin and :contents-end point to the end of the cell. Not sure if this breaks anything. -- Florian Beck From 2b1a63e70830e7604c7f59dd0110aedf3a9c1e53 Mon Sep 17 00:00:00 2001 From: Florian Beck f...@miszellen.de Date: Tue, 9 Sep 2014 12:29:53 +0200 Subject: [PATCH 1/4] org-element: Adjust content boundaries in empty cells * lisp/org-element.el (org-element-table-cell-parser): Let :contents-begin and :contents-end point to the beginning of an empty table cell. --- lisp/org-element.el | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index f175fbc..47fa3f1 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -,12 +,15 @@ and `:post-blank' keywords. (let* ((begin (match-beginning 0)) (end (match-end 0)) (contents-begin (match-beginning 1)) - (contents-end (match-end 1))) + (contents-end (match-end 1)) + ;; Avoid having the contents at the end of an empty cell. + (empty-pos (when (= contents-begin contents-end) + (min (1+ begin) end (list 'table-cell (list :begin begin :end end - :contents-begin contents-begin - :contents-end contents-end + :contents-begin (or empty-pos contents-begin) + :contents-end (or empty-pos contents-end) :post-blank 0 (defun org-element-table-cell-interpreter (table-cell contents) -- 1.9.1 From 10f68bf26f82f4cbc0e097bac9a4d3b997c10bc4 Mon Sep 17 00:00:00 2001 From: Florian Beck f...@miszellen.de Date: Tue, 9 Sep 2014 12:31:35 +0200 Subject: [PATCH 2/4] org-element: Implement `org-element-get' * lisp/org-element.el (org-element-get): New function. --- lisp/org-element.el | 20 1 file changed, 20 insertions(+) diff --git a/lisp/org-element.el b/lisp/org-element.el index 47fa3f1..f55dd37 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -5873,6 +5873,26 @@ Providing it allows for quicker computation. ;; Store results in cache, if applicable. (org-element--cache-put element cache))) +(defun org-element-get (optional type pom) + Return the nearest object or element of TYPE at POM. + (let* ((pom (or pom (point))) + (context (with-current-buffer (if (markerp pom) + (marker-buffer pom) + (current-buffer)) + (save-excursion + (goto-char pom) + (org-element-context) +(cl-labels ((get-type (type context) + (cond ((not context) nil) +((not type) context) +((eql type (car context)) + context) +(t (get-type type + (plist-get + (cadr context) + :parent)) + (get-type type context + (defun org-element-nested-p (elem-A elem-B) Non-nil when elements ELEM-A and ELEM-B are nested. (let ((beg-A (org-element-property :begin elem-A)) -- 1.9.1 From 64f937fe289e7aca41471ec731aec1590bebe947 Mon Sep 17 00:00:00 2001 From: Florian Beck f...@miszellen.de Date: Tue, 9 Sep 2014 12:35:09 +0200 Subject: [PATCH 3/4] org-table: Handle optional arguments and cleanup * lisp/org-table.el (org-table-beginning-of-field): Fix docstring. Call `org-table-end-of-field'. (org-table-end-of-field): Fix docstring. Handle missing and negative args. --- lisp/org-table.el | 60 +++ 1 file changed, 34 insertions(+), 26 deletions(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index 547f933..290cdce 100644 --- a/lisp/org-table.el +++ b/lisp/org
Re: [O] [PATCH] org-table-beginning/end-of-field
Nicolas Goaziou m...@nicolasgoaziou.fr writes: Thanks for the patch. Though, wouldn't it make more sense to properly handle a missing argument instead? How about this? -- Florian Beck From 4fb2bbff2238d15ae7c896e0eb268b74ea4e56dc Mon Sep 17 00:00:00 2001 From: Florian Beck f...@miszellen.de Date: Mon, 8 Sep 2014 14:08:56 +0200 Subject: [PATCH] org-table: fix arguments of `org-table-beginning-of-field' and `org-table-end-of-field'. Also fix docstring and cleanup code. * lisp/org-table.el (org-table--border-of-field): new function (org-table-beginning-of-field): call it (org-table-end-of-field): call it --- lisp/org-table.el | 45 + 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index 547f933..31fda57 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -1061,37 +1061,34 @@ Before doing so, re-align the table if necessary. (if (looking-at | ?) (goto-char (match-end 0 -(defun org-table-beginning-of-field (optional n) - Move to the end of the current table field. -If already at or after the end, move to the end of the next table field. -With numeric argument N, move N-1 fields forward first. - (interactive p) +(defun org-table--border-of-field (n move-fn element cmp-fn) (let ((pos (point))) (while ( n 1) (setq n (1- n)) - (org-table-previous-field)) -(if (not (re-search-backward | (point-at-bol 0) t)) - (user-error No more table fields before the current) - (goto-char (match-end 0)) - (and (looking-at ) (forward-char 1))) -(if (= (point) pos) (org-table-beginning-of-field 2 + (funcall move-fn)) +(goto-char (org-element-property element (org-element-context))) +(if (and ( n 0) (funcall cmp-fn (point) pos)) + (org-table--border-of-field 2 move-fn element cmp-fn -(defun org-table-end-of-field (optional n) +(defun org-table-beginning-of-field (optional n) Move to the beginning of the current table field. -If already at or before the beginning, move to the beginning of the -previous field. +If already at or before the beginning and N is not 0, move to the +beginning of the previous table field. With numeric argument N, move N-1 fields backward first. (interactive p) - (let ((pos (point))) -(while ( n 1) - (setq n (1- n)) - (org-table-next-field)) -(when (re-search-forward | (point-at-eol 1) t) - (backward-char 1) - (skip-chars-backward ) - (if (and (equal (char-before (point)) ?|) (looking-at )) - (forward-char 1))) -(if (= (point) pos) (org-table-end-of-field 2 + (org-table--border-of-field (or n 1) + 'org-table-previous-field + :contents-begin '=)) + +(defun org-table-end-of-field (optional n) + Move to the end of the current table field. +If already at or after the end and N is not 0, move to the end of the +next field. +With numeric argument N, move N-1 fields forward first. + (interactive p) + (org-table--border-of-field (or n 1) + 'org-table-next-field + :contents-end '=)) ;;;###autoload (defun org-table-next-row () -- 1.9.1
[O] [BUG] org-table-beginning/end-of-field
Hi, The argument of `org-table-beginning-of-field' and `org-table-end-of-field' is in fact not optional. -- Florian Beck From d1d12380a1c260bef7a2137831434614f7d9ec1f Mon Sep 17 00:00:00 2001 From: Florian Beck f...@miszellen.de Date: Mon, 8 Sep 2014 07:34:56 +0200 Subject: [PATCH] Remove optional argument spec * lisp/org-table.el (org-table-beginning-of-field): fix argument (org-table-end-of-field): fix argument --- lisp/org-table.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org-table.el b/lisp/org-table.el index 547f933..a17e95a 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -1061,7 +1061,7 @@ Before doing so, re-align the table if necessary. (if (looking-at | ?) (goto-char (match-end 0 -(defun org-table-beginning-of-field (optional n) +(defun org-table-beginning-of-field (n) Move to the end of the current table field. If already at or after the end, move to the end of the next table field. With numeric argument N, move N-1 fields forward first. @@ -1076,7 +1076,7 @@ With numeric argument N, move N-1 fields forward first. (and (looking-at ) (forward-char 1))) (if (= (point) pos) (org-table-beginning-of-field 2 -(defun org-table-end-of-field (optional n) +(defun org-table-end-of-field (n) Move to the beginning of the current table field. If already at or before the beginning, move to the beginning of the previous field. -- 1.9.1
Re: [O] new to exporting: how to export to a specific location (aromatically?)
Hi, 1.how does one specify a location where exported files go? can one set this per file or perhaps per export type etc? This can be done with defining an export backend and a little bit of hacking (hint: `org-export-output-file-name' accepts a directory argument) or by using projects. 2. can one auto export files when saved/changed etc? Try `after-save-hook' and export asynchronously, e.g. (org-html-export-to-html t). 3. i cant understand the difference so much between export and publishing, apart that publishing is only for html (and not txt etc..)? Projects can include several files and allow you to set project specific variables. See `org-publish-project-alist'. Thanks alot Z -- Florian Beck
[O] [PATCH] better parsing of latex fragments
Hi, this patch allows, once again, latex fragments inside parentheses and also fragments like $\left(\frac12\right.$ -- Florian Beck From 3ef8041c8dd8acbdf810f72feb8e9e104545badb Mon Sep 17 00:00:00 2001 From: Florian Beck f...@miszellen.de Date: Sun, 13 Jul 2014 14:59:24 +0200 Subject: [PATCH] Allow latex fragments inside parentheses and those ending with punctuation. * lisp/org-element.el: (org-element-latex-fragment-parser): more lenient regexps * testing/lisp/test-org-element.el (test-org-element/latex-fragment-parser): add tests --- lisp/org-element.el | 4 ++-- testing/lisp/test-org-element.el | 8 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 7aa8208..7d10d61 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -2918,8 +2918,8 @@ Assume point is at the beginning of the LaTeX fragment. (and (not (eq (char-before) ?$)) (search-forward $ nil t 2) (not (memq (char-before (match-beginning 0)) -'(?\s ?\t ?\n ?, ?.))) - (looking-at \\([- \t.,?;:'\]\\|$\\)) +'(?\s ?\t ?\n))) + (looking-at \\([[:space:][:punct:]]\\|$\\)) (point))) (case (char-after (1+ (point))) (?\( (search-forward \\) nil t)) diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index b2b0c52..788f13b 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -1337,6 +1337,14 @@ e^{i\\pi}+1=0 (org-test-with-temp-text \\[a\\] (org-element-map (org-element-parse-buffer) 'latex-fragment 'identity))) + (should + (org-test-with-temp-text ($a$) + (org-element-map + (org-element-parse-buffer) 'latex-fragment 'identity))) + (should + (org-test-with-temp-text $\\left(a\right.$ + (org-element-map + (org-element-parse-buffer) 'latex-fragment 'identity))) ;; Test fragment at the beginning of an item. (should (eq 'latex-fragment -- 1.9.1
[O] org strips math delimiters from inline footnotes
Hi, the latex export of inline footnotes doesn't work correctly. This happens since commit ca6ecf9e498e6c4750f279e9f0ea0185bc8b1d10. text[fn:1: a footnote with $\sqrt{4}$.] exports as text\footnote{a footnote with \sqrt{4}.} -- Florian Beck
Re: [O] Creating changelog with magit
Thorsten Jolitz tjol...@gmail.com writes: I get a meager ,--- | | * org.el: | | # comment text | `--- You get this when you are on the file that has changed. Press TAB (magit-toggle-section) and you see a diff. Move to the chunk you want to comment on and press C: this should insert the defun/defvar/etc in the commit buffer. To automate this I have (defun fb/magit-commit-add-log () (interactive) (let* ((ol (car (overlays-at (point (beg (overlay-start ol)) (end (overlay-end ol)) commit-buffer) (save-excursion (goto-char beg) (while (re-search-forward ^[+-] end t) (save-window-excursion (magit-commit-add-log) (setq commit-buffer (current-buffer) (display-buffer commit-buffer))) ... but I don't really use this, because it is very slow and, usually, you want to arrange things differently. -- Florian Beck
Re: [O] [Patch] don't add indent for empty line when exiting, a code edit
On 13.03.2014 20:46, Bastien wrote: Ok, let me take some fresh air and come back to this later on. How about this: (while (re-search-forward \\(^\\).+ nil t) (replace-match indent nil nil nil 1))) -- Florian Beck
[O] Error when editing src block
When `org-edit-src-code' fails to load the language mode, it leaves the buffer(s) in an unusable state. For example, evaluate M-: (add-hook 'emacs-lisp-mode-hook 'paredit-mode) Then C-c ' in this block #+begin_src emacs-lisp (save-excursion #+end_src - byte-code: Language mode `emacs-lisp-mode' fails with: Unmatched bracket or quote That's fine. But now C-c ' doesn't work and M-x org-edit-src-exit claims: org-edit-src-exit: This is not a sub-editing buffer, something is wrong Indeed. I guess, the source buffer and the overlay should be cleaned up. But since the worst that can happen is the language mode not loading correctly, maybe just downgrade the error to a warning? -- Florian Beck
Re: [O] Latex Export Difficulties
On 06.02.2014 10:20, Samuel Schaumburg wrote: \section{Some Headline\footnote{S. 45}} This is what the footmisc package is for. So use #+LaTeX_HEADER: \usepackage[stable]{footmisc} or add it to your default packages. \section{Some Headline \protect\footnote{S. 45}} If you really want this, have a look at `org-export-filter-footnote-reference-functions'. -- Florian Beck
[O] org-map-entries moves point
When I call org-map-entries with scope set to 'tree, the current heading gets realigned to the top. Behold: (org-map-entries (lambda () ;; do something or even nothing ) nil 'tree) I think the culprit is the call to `org-agenda-prepare-buffers', or rather commit fe3379bda6ca23474639b114592958bf14431c88, which replaces save-excursion with save-window-excursion. What's interesting: This does NOT restore the window configuration. When I replace save-window-excursion with save-excursion the window configuration is restored again. I'm not sure *why* this happens. -- Florian Beck
Re: [O] org-map-entries moves point
On 05.02.2014 21:59, Nick Dokos wrote: John Kitchin reported this last week and Bastien reverted that commit: http://thread.gmane.org/gmane.emacs.orgmode/81587 Missed that. But this reverts commit 3ec38f5c064c3270f54876ba33c5ca1097b46853 [1] (in org-map-entries) I was talking about fe3379bda6ca23474639b114592958bf14431c88 [2] (which did the same to org-agenda-prepare-buffer) In fact, the revert *caused* my bug. Again, the recipe: The bug doesn't really move the point, rather it recenters the current line. To see it, move into the middle of a document, unfold a second level headline and in the middle of the window execute (org-map-entries (lambda () ;; do something or even nothing ) nil 'tree) This works correctly if either commit [1] is restored or [2] is reverted. But it's not clear *why* that commit was done in the first place so if you get some enlightenment from your experiments, please share. Will do. Nick -- Florian Beck
Re: [O] Stop clock on closing emacs
On 01.02.2014 11:45, Igor Sosa Mayor wrote: I would like emacs/orgmode to insert the time I'm closing emacs as end time of the running clock. Use `kill-emacs-hook': (defun org-clock-out-maybe () Stop a currently running clock. (org-clock-out nil t)) (add-hook 'kill-emacs-hook 'org-clock-out-maybe) -- Florian Beck
Re: [O] Stop clock on closing emacs
On 01.02.2014 14:07, Igor Sosa Mayor wrote: Thanks a lot. This is much better. But: are you really using this idea? The problem is that the kill-emacs-hook does not ask for save the modified buffer. That means: I see that the end time is being put into the org buffer, but the buffer/file is not being saved... You are right. I didn't think of this because... I solved the problem (but maybe there is a more elegant way...) adding the following: (defun org-clock-out-maybe () Stop a currently running clock. (org-clock-out nil t) (org-save-all-org-buffers)) ... I call `save-all-buffer' in the exit hook. Sorry for the confusion. -- Florian Beck
Re: [O] [RFC] Emphasis regexp
On 01.02.2014 09:27, Michael Brand wrote: Additionally and at the cost of giving up (why would they be needed?) '=foo bar=' and =foo bar=, which possibly should anyway be either just 'foo bar' and foo bar or =foo bar=, `org-emphasis-regexp-components' also controls, well, regular emphasis. And *this* kind of quote is something I need from time to time. -- Florian Beck
[O] [PATCH] Font-lock: allow hiding of brackets surrounding macros
Hi, I gave it a try. Well, I spend most of my time on formatting this patch. Hope it works. -- Florian Beck From 7980ee3ab9e048c1bdeddfaa6f7dbe984c469171 Mon Sep 17 00:00:00 2001 From: Florian Beck f...@miszellen.de Date: Fri, 31 Jan 2014 22:42:04 +0100 Subject: [PATCH] Font-lock: allow hiding of brackets surrounding macros * lisp/org.el (org-hide-macro-markers): new option (org-fontify-macros): new function (org-set-font-lock-defaults): call `org-fontify-macros' * doc/org.texi: Document user option `org-hide-macro-markers' TINYCHANGE --- doc/org.texi | 3 +++ lisp/org.el | 21 - 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/doc/org.texi b/doc/org.texi index 9c7a6a7..792315c 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -10019,6 +10019,9 @@ and to the modification time of the file being exported, respectively. @var{FORMAT} should be a format string understood by @code{format-time-string}. +The surrounding brackets can be made invisible by setting +@code{org-hide-macro-markers} to @code{t}. + Macro expansion takes place during export. diff --git a/lisp/org.el b/lisp/org.el index 20dcb92..5844daf 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4145,6 +4145,11 @@ following symbols: :group 'org-appearance :type 'boolean) +(defcustom org-hide-macro-markers nil + Non-nil mean font-lock should hide the brackets marking macro calls. + :group 'org-appearance + :type 'boolean) + (defcustom org-pretty-entities nil Non-nil means show entities as UTF8 characters. When nil, the \\name form remains in the buffer. @@ -5949,6 +5954,20 @@ by a #. (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) t)) + (defun org-fontify-macros (limit) +Fontify macros. +(when (re-search-forward \\({{{\\).+?\\(}}}\\) limit t) + (add-text-properties + (match-beginning 0) (match-end 0) + '(font-lock-fontified t face org-macro)) + (when org-hide-macro-markers +(add-text-properties (match-end 2) (match-beginning 2) + '(invisible t)) +(add-text-properties (match-beginning 1) (match-end 1) + '(invisible t))) + (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0)) + t)) + (defun org-activate-angle-links (limit) Run through the buffer and add overlays to links. (if (and (re-search-forward org-angle-link-re limit t) @@ -6260,7 +6279,7 @@ needs to be inserted at a specific position in the font-lock sequence.) ;; Diary sexps. '(^?%%(.*\\|%%([^\n]*? (0 'org-sexp-date t)) ;; Macro - '({{{.+?}}} (0 'org-macro t)) + '(org-fontify-macros) '(org-hide-wide-columns (0 nil append)) ;; TODO keyword (list (format org-heading-keyword-regexp-format -- 1.8.3.2
Re: [O] [RFC] Syntax for macros
On 30.01.2014 17:59, Nick Dokos wrote: Are you advocating that the macro syntax should be changed without worrying about backwards compatibility? That might work if almost nobody uses macros currently[fn:1], but my impression is that they are used fairly widely. The main problem is that this will affect org files in weeks, months or years in the future, which then mysteriously fail to work as expected. I agree, however, with Sebastien that the current syntax is a bit heavy. Two brackets would be better, but still ugly. A couple of alternative ideas: 1. How about using unicode characters? This would solve the problem of false positives and allow for light markup. E.g.: (looking-at \\(?:「\\|{{{\\)\\([a-zA-Z][-a-zA-Z0-9_]*\\)\\(([ \t\n]* \\([^\000]*?\\))\\)?\\(?:」\\|}}}\\)) 2. On the other hand a function to insert a macro might be all we need, e.g.: (defun org-macro-insert () (interactive) (let* ((macros (org-macro--collect-macros)) (macro (completing-read Insert macro: (mapcar 'car macros))) (args (string-match $[[:digit:]] (cdr (assoc macro macros pos) (insert (format {{{%s macro)) (when args (insert () (setq pos (point)) (insert ))) (insert }}}) (when pos (goto-char pos Maybe even hide the brackets during fontification? 3. Of course, since macros are only relevant when exporting, it should be easy to write an export filter that translates arbitrary chars to brackets. -- Florian Beck
Re: [O] org-mode + icicles, avoid key binding redefinitions?
On 28.01.2014 10:08, Bastien wrote: I think most of these keybindings could migrate to a C-c C- version. There is no need for migrating them IMO. The recommendation is: Sequences consisting of `C-c' followed by any other punctuation character are allocated for minor modes. Using them in a major mode is not absolutely prohibited, but if you do that, the major mode binding may be shadowed from time to time by minor modes. This means important commands should have a binding reserved for major modes. But there is absolutely no need to remove bindings which (for many org users) have worked just fine for a long time. -- Florian Beck
Re: [O] org-mode + icicles, avoid key binding redefinitions?
On 29.01.2014 14:16, Nick Dokos wrote: But it's not just a matter of satisfying rules: it's a matter of making it easy on users. That is why I don't recommend satisfying them here. Having a bad binding as well as a good binding for something would mean that if I load a minor mode that takes over the bad binding, I would then lose it in the major mode and have to remember the good binding. That's more confusing IMO than having a single good binding: if we need to retrain fingers, we need to retrain them once, not every time we load a minor mode that steps on some binding. On the other hand, it doesn't happen every time. The bindings had been working for years before one user reported a problem with some of them. The conflict is rare and doesn't require resolution. But it is polite to provide alternatives for bindings that might be shadowed. -- Florian Beck
Re: [O] emacs calc and src block editing
On 25.01.2014 13:49, Eric S Fraga wrote: There is a niggling aspect of editing source code blocks. If, while in the src block buffer (reached by C-c '), if you start up calc and request calc-copy-to-buffer to place a result in the source code being edited, the copy is actually placed in the original org buffer and subsequently lost when exiting the src buffer. In my opinion, the copy should be place in the src buffer at point. It is a feature of calc, not to copy to internal (starred) buffers. I have no idea whether or how this could be fixed. It's not a major problem but I thought I would mention it in case it's easy to fix. I'm afraid the only way to fix this is inside calc. You can do it yourself with advice, e.g.: (advice-add 'calc-find-writable-buffer :before-until (lambda (buf mode) (if (and (string-match \\`\\*Org Src (buffer-name (car buf))) (get-buffer-window (car buf))) (car buf))) '((name . calc-copy-to-org-src))) Remove it with: (advice-remove 'calc-find-writable-buffer 'calc-copy-to-org-src) HTH.
Re: [O] [RFC] About `org-export-with-\(fixed-width\|tables\)'
On 07.01.2014 19:17, Eric S Fraga wrote: Eric Abrahamsen e...@ericabrahamsen.net writes: Hey, are you actually exporting to an epub? How are you doing that? I'd be curious to know as well. I export to epub in two ways, both by first exporting to HTML. Then either use calibre to convert the HTML document or load the HTML document in firefox and use the dotepub addon. I haven't done this enough to say which is better. If you are copying your file to a device, conversion with calibre is the simplest option. I would guess that defining an epub exporter, derived from the HTML exporter, may not be that difficult. If only I had the time :-( (org-export-define-derived-backend 'fb/org-export-epub 'html :menu-entry '(?h 99 ((?p As epub file fb/org-export-epub (defun fb/convert-html-to-epub (infile) (let ((outfile (concat (file-name-sans-extension infile) .epub)) (max-toc-links 0) (level1 //h:h2) (level2 //h:h3) (chapter \//*[name()='h1' or name()='h2']\) (chapter-mark pagebreak)) (shell-command (format ebook-convert %s %s --max-toc-links=%s --use-auto-toc --level1-toc=%s --level2-toc=%s --chapter=%s --chapter-mark=%s --input-encoding=utf8 -v -v -v --authors=\%s\ --title=\%s\ infile outfile max-toc-links level1 level2 chapter chapter-mark (user-full-name) (file-name-base outfile))) outfile)) (defun fb/org-export-epub (optional async subtreep visible-only body-only ext-plist) (interactive) (let* ((extension (concat . org-html-extension)) (file (org-export-output-file-name extension subtreep)) (org-export-coding-system org-html-coding-system)) (org-export-to-file 'fb/org-export-epub file async subtreep visible-only body-only ext-plist (lambda (file) (fb/convert-html-to-epub file)
Re: [O] [RFC] About `org-export-with-\(fixed-width\|tables\)'
Patch attached. WDYT? Works nicely. Thanks. Regards,
Re: [O] [RFC] About `org-export-with-\(fixed-width\|tables\)'
Nicolas Goaziou n.goaz...@gmail.com writes: I don't think option 2 is really useful, but I don't mind either way. Actually, I would find it useful (because I sometimes export my notes as an ebook and tables get garbled on the way). Tables are kind of tricky to get exported correctly and it seems quite reasonble to optimise them for a certain export backend and ignore them otherwise. One might also have lots of tables that don't export correctly (typically, because they are too wide). -- Florian Beck
Re: [O] [RFC] Change some defcustoms into defcont
Torsten Wagner torsten.wag...@gmail.com writes: Anyhow, I just had this idea that org-mode could rely on a fixed (as written in stone) set of keywords and that an a new exporter backend will be introduced which simply creates a standard-conform org-mode file. Well, I like the idea of an importer. Not so much because of keywords, but because org should work on text files and text files often work with different conventions (I still have muse files around and old org files where I used *this* for emphasis.) By time, one could think of a org-mode import, which again takes a standard conform org-mode file and translates it back into the individual settings of a specific user. This I would call export. Having an legacy org-mode exporter and importer, could even allow to customize org-mode for different languages, e.g. one could set (setq org-mode-language german) to get a set of keywords in German. Exporting it into legacy org-mode would translate it back into e.g. English, which then again could be read-in by a user who set (setq org-mode-language japanese) and who would be able to read the file with a set of Japanese keywords. The problem is, the exporter can only be used if org-element can parse the syntax, which is exactly what Nicolas wants to get rid of. Org-element clearly isn't intend to be a general parser. So an importer/preprocessor/old-new converter would have to be either a simple search and replace mechanism or do all the heavy lifting itself. Hm, if I'd have, say, an xml of lisp representation of the buffer (i.g. (ELEMENT (OPTIONS) ((ELEMENT (OPTIONS) ..., is there a way to hand that of to org-element or the exporter? -- Florian Beck
Re: [O] Unescape :help-echo in links
Bastien b...@altern.org writes: Can you resend it as a proper patch with a changelog? Like this? From ca9c612208a2528a27b648973cfbf6e8d0801f94 Mon Sep 17 00:00:00 2001 From: Florian Beck f...@miszellen.de Date: Thu, 21 Mar 2013 21:15:50 +0100 Subject: [PATCH] Unescape :help-echo for links * lisp/org.el (org-activate-bracket-links): remove escapes from help string TINYCHANGE --- lisp/org.el |5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 7aac63b..3fbd549 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5806,10 +5806,7 @@ by a #. (if (and (re-search-forward org-bracket-link-regexp limit t) (not (org-in-src-block-p))) (let* ((hl (org-match-string-no-properties 1)) - (help (concat LINK: hl)) - ;; FIXME: Above we should remove the escapes. But that - ;; requires another match, protecting match data, a lot - ;; of overhead for font-lock. + (help (concat LINK: (save-match-data (org-link-unescape hl (ip (org-maybe-intangible (list 'invisible 'org-link 'keymap org-mouse-map 'mouse-face 'highlight -- 1.7.10.4 -- Florian Beck
[O] `org-export-define-backend' and its friends are now defuns (was: Build fail with emacs 24.3.1)
Bastien b...@altern.org writes: Anyway, `org-export-define-backend' and its friends are now defuns, since there is no good reason for them to be macros. This broke my setup and I had to dig (git log -p) to figure out what to do (basically quote everything) Instead of (org-export-define-derived-backend my-latex latex :translate-alist ((template . my-latex-template-fun))) write (org-export-define-derived-backend 'my-latex 'latex :translate-alist '((template . my-latex-template-fun))) [There are now double quotes in the ascii backend, which I guess are not needed.] Obvious, when you think about it, but I'm a bit dense when the byte-compiler tells me that my-latex-template-fun is a malformed function. A little more prominent warning would have been much appreciated. -- Florian Beck
[O] Unescape :help-echo in links
Hi, I use a lot of custom links (for citations) and cannot stand the escaped mess in the help-echo. So I've been using the patch below for quite some time without any noticable slowdown. diff --git a/lisp/org.el b/lisp/org.el index bf74afd..470f93d 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5806,10 +5806,7 @@ by a #. (if (and (re-search-forward org-bracket-link-regexp limit t) (not (org-in-src-block-p))) (let* ((hl (org-match-string-no-properties 1)) -(help (concat LINK: hl)) -;; FIXME: Above we should remove the escapes. But that -;; requires another match, protecting match data, a lot -;; of overhead for font-lock. + (help (concat LINK: (save-match-data (org-link-unescape hl (ip (org-maybe-intangible (list 'invisible 'org-link 'keymap org-mouse-map 'mouse-face 'highlight -- Florian Beck
[O] Copying subtrees with footnotes
Hi, I need to copy subtrees between org-buffers, but `org-copy-subtree' ignores footnotes (which is technically correct, I guess). Is there any way to automate this? -- Florian Beck
Re: [O] Copying subtrees with footnotes
Samuel Wales samolog...@gmail.com writes: I find that inline footnotes solve a lot of problems: Absolutly. The main reason I don't generally inline footnotes is that I don't want to *see* them. Basically, footnotes are for readers that are not my primary audience; sometimes footnotes are only for me and I keep them only for drafting. Either way, they are noise in the paragraph. Same thing, when I take notes and want to see the main points at a glance while keeping reflections out of the way. I thought about using custom links for footnotes (which would allow me to hide the definition), but I'm not sure that would work the same way. Can I have other (custom) links inside the link path (or inside an inline footnote defintion)? Thanks for the idea, I have to investigate. Still, the original questions stands. Maybe `org-copy-subtree' and `org-paste-subtree' could be adapted? Problem is, these functions use kill-region internally, and I see no easy way to add the footnote information. -- Florian Beck
Re: [O] org-create-formula-image-with-imagemagick conflicts with org-latex-pdf-process
Hello Nicolas, What about re-using the existing tool from ox-latex.el? What do you think of the following patch? Very highly, this works perfectly. Thank you. Unfortunatly, html export doesn't support imagemagick yet. `org-html-latex-fragment' and `org-html-latex-environment' only handle mathjax and dvipng. (I've added imagemagick to the dvipng case, and this seems to work without any problems.) -- Florian Beck
[O] org-create-formula-image-with-imagemagick conflicts with org-latex-pdf-process
`org-create-formula-image-with-imagemagick' doesn't handle the case that `org-latex-pdf-process' is set to a function. To reproduce: - set `org-latex-pdf-process' to a function - (setq org-latex-create-formula-image-program 'imagemagick) this makes preview fail - set #+OPTIONS: latex:imagemagick = html export broken However, just calling this function from `org-create-formula-image-with-imagemagick' would not be a good idea. How about adding a new variable `org-latex-formula-pdf-process'? -- Florian Beck
Re: [O] seeing ??? in Ccaa rather than file name
Bastien b...@altern.org writes: ???:12:00.. Scheduled: TODO [#B] Change oil I cannot reproduce this problem. Can you share a minimal example (as an .org file) that I can run with emacs -q to see the problem? I see the same thing. Categories that would normally set to the file name are displayed as ???. Presumably because `org-refresh-category-properties' is called inside `with-silent-modifications', which let-binds `buffer-file-name'. -- Florian Beck
Re: [O] format of the ID property in the new HTML exporter
Jambunathan K kjambunat...@gmail.com writes: There is ID and then there is CUSTOM_ID. IIUC/IIRC, ID is a uuid and CUSTOM_ID can be whatever. Any reason why you cannot use CUSTOM_IDs here? Yes. Why do you need the assert? It only seems to be there to make my life more difficult. -- Florian Beck
[O] Modifying the exporter (was: org-latex-classes with functions, incomplete doc)
Nicolas Goaziou n.goaz...@gmail.com writes: Anyway, we're back to step one: if you want to handle headlines differently (i.e. by adding your own properties), you need to fork `latex' back-end, as explained before. If you encounter problems, you can post back here. Ok, I took some time to extract a minimal example. It works fine, but on a very low level (see below). Again, the goal is to add an optional argument to sectioning command. The best way I could come up with is this (I omit the `fb/org-export-pdf' function): #+BEGIN_SRC emacs-lisp (defun fb/org-export-modify-headline (headline string) (if (string-match (rx string-start \\ (group-n 1 (0+ sub)) (group-n 2 (or part chapter section paragraph)) (group-n 3 (zero-or-one \*)) { (group-n 4 (minimal-match (0+ (not (any }) }) string) (let* ((level (match-string 1 string)) (type (match-string 2 string)) (stars (match-string 3 string)) (title (match-string 4 string)) (toc-title (org-element-property :toc-title headline)) (new-hl (format \\%s%s%s%s{%s} (or level ) type (or stars ) (if toc-title (format [%s] toc-title) ) title))) (replace-match new-hl t t string 0)) string)) (defun fb/org-latex-headline (headline contents info) (fb/org-export-modify-headline headline (org-export-with-backend 'latex headline contents info))) (org-export-define-derived-backend fb/org-export-pdf latex :translate-alist ((headline . fb/org-latex-headline)) :options-alist ((:toc-title TOC_TITLE nil nil t)) :menu-entry (?l 99 ((?d Export PDF file fb/org-export-pdf #+END_SRC As you can see, I pull apart the string and then put it back together. (Relatively straightforward in this case, much more involved for, say, links.) In a perfect world, I would have access to these elements and the format string, so I could either modify them before calling `org-export-with-backend' or assemble the string myself. -- Florian Beck
[O] org-latex-classes with functions, incomplete doc
Hi, the docstring for `org-latex-classes' says: Instead of a list of sectioning commands, you can also specify a function name. That function will be called with two parameters, the (reduced) level of the headline, and a predicate non-nil when the headline should be numbered. It must return a format string in which the section title will be added. This is wrong. The way this function is called in `org-latex-headline' requires it to return a string with TWO format specifiers, e.g. \section{%%s}%%s\n, the second where the CONTENT of the section is being added. Maybe `org-latex-headline' should add %%s\n itself – as it does for other cases? Also, I'm using this to add an optional argument to my sections. Can I expect this to work? (i.e. being called in a context where the variables `info' and `headline' are defined?) #+BEGIN_SRC emacs-lisp (defun fb/latex-sections (level numbered) (let* ((level (1- level)) (sec-name (nth level fb/latex-section-names)) (sec (when sec-name (format \\%s%s%s{%%s}\n%%s sec-name (if numbered *) ;; (or (when (plist-get info :toc-title) (let ((toc-title (org-element-property :toc-title headline))) (when toc-title (format [%s] toc-title ) sec)) #+END_SRC Org-mode version 7.9.3e (7.9.3e-961-g521d47 @ /home/flo/.emacs.d/org-mode/lisp/) -- Florian Beck
Re: [O] org-latex-classes with functions, incomplete doc
Thanks for your explanations, very much appreciated. Nicolas Goaziou n.goaz...@gmail.com writes: the proper way to do this is to define a derived back-end with a custom headline translation function. Ok, I tried this. There is a problem, however. This is what I came up with: #+BEGIN_SRC emacs-lisp (defun fb/org-latex-headline (headline contents info) (let* ((full-section (org-latex-headline headline contents info)) (toc-title (if (plist-get info :toc-title) (org-element-property :toc-title headline))) (section-regex \\`\\(sub\\)*\\(section\\|paragraph\\){) (new-section (when (and toc-title (string-match section-regex full-section)) (let ((subs (match-string 1 full-section)) (section (match-string 2 full-section)) (rest (substring full-section (match-end 0 (concat \\ subs section [ ;; replace brackets (from `org-latex-headline') (replace-regexp-in-string \\[ ( (replace-regexp-in-string \\] ) toc-title)) ]{ rest) (or new-section full-section))) #+END_SRC As you can see, the solution is much more convoluted. The reason is that I have to parse the string returned by `org-latex-headline' or am I missing something? I ran into a similar problem while adding padding (\n - [0.4em]\n) to table rows. IMO, the probem is this: the translation is (mostly) application of content to a template (a format string), but these templates are build (mostly, sectioning is actually an exception) inside the default translation functions. It would be much easier, when this template would be accessible from outside, like this: #+BEGIN_SRC emacs-lisp (defun my-org-latex-headline (headline contents info) (let ((sec-format (plist-get info :sec-format))) ;; or something like that [modify sec-format] (plist-put info :sec-format sec-format) (org-latex-headline))) #+END_SRC The same goes for other functions. -- Florian Beck
Re: [O] org-latex-classes with functions, incomplete doc
Nicolas Goaziou n.goaz...@gmail.com writes: (toc-title (if (plist-get info :toc-title) (org-element-property :toc-title headline))) There's no :toc-title property in the communication channel. The exhaustive list of its properties is written in ox.el, at The Communication Channel section. Obviouly, I defined it, otherwise it wouldn't work. :options-alist ((:toc-title TOC_TITLE nil nil t) ... ) As you can see, the solution is much more convoluted. Because you're not using the proper tool. If you just want to modify the string returned by the `latex' back-end, use a filter. You will have access to the transcoded headline (in LaTeX format, as a string) and the communication channel. But not to the element properties, which is what I need. There are already many ways to alter output from a back-end. It's just a matter of using the right tool. So, which is it? I'm a bit confused right now. -- Florian Beck
Re: [O] no pdf-output in lilypond code blocks
Achim Gratz strom...@nexgo.de writes: Achim Gratz writes: Florian Beck writes: I don't think so. The string evaluates to itself or am I missing something? If it would fall under SELFQUOTING then yes (but I really don't understand what the doc string is trying to tell me there and what would be used for comparison). I've looked at this again and I still don't understand the docstring. I've confirmed that the bytecompiler produces not only a warning during compilation, but the compiled code won't work, I cannot reproduce this. The code works for me and byte compiling doesn't generate any warning. GNU Emacs 24.3.50.7 (x86_64-unknown-linux-gnu, GTK+ Version 3.6.0) of 2013-01-28 on flo-laptop so despite indications to the contrary the backquotes are indeed necessary. This means that either the docstring fails to clearly indicate the necessity of using the backquotes on string constants or the bytecompiler fails to compile legal code: I'd suggest you take this example to emacs-bugs and see what the devs have to say. Regards, Achim. -- Florian Beck
[O] Bug: org-id-get-with-outline-path-completion docstring [7.9.3d (release_7.9.3d-929-ga2febd @ /home/flo/.emacs.d/org-mode/lisp/)]
The docstring claims when the optional argument is omitted all headlines in all agenda files are eligible. In fact, only the headlines in the current file are used (which is reasonable). Emacs : GNU Emacs 24.3.50.8 (x86_64-unknown-linux-gnu, GTK+ Version 3.6.0) of 2013-01-31 on flo-laptop Package: Org-mode version 7.9.3d (release_7.9.3d-929-ga2febd @ /home/flo/.emacs.d/org-mode/lisp/) -- Florian Beck
Re: [O] How to improve Org startup time?
Sebastien Vauban wxhgmqzgwmuf-genee64ty+gs+fvcfc7...@public.gmane.org writes: I have to admit working most of the time without the laptop being powered, which I know (from observation) is 2 to 3 times slower. So maybe your disk is powered down or in a sleep mode in order to save power? Could you check whether you get the same result with your laptop powered?
Re: [O] no pdf-output in lilypond code blocks
Achim Gratz strom...@nexgo.de writes: This would be a bug, I believe you should use backquotes on the string constants I don't think so. The string evaluates to itself or am I missing something? The real (but harmless) bug is (t --png )) should be (_ --png )) -- Florian Beck
Re: [O] no pdf-output in lilypond code blocks
Bastien b...@altern.org writes: Hi Florian, Florian Beck f...@miszellen.de writes: If so, I'll fix ly-process-basic so that it depends on ly-gen-png/pdf/html/svg. Thanks for confirming, Thanks for fixing. Done -- please have a try and let me know. Minor hitch: the variable is called `ly-use-eps' not `ly-gen-eps'. However, as far as I understand these variables are intended for tangled files. The original bug was that exporting or evaluating a code block doesn't respect the extension of the :file directive. I can live with setting `ly-gen-pdf', but maybe something like (pcase (file-name-extension out-file) (pdf --pdf ) (ps --ps ) (png --png ) (t --png )) would be even better? -- Florian Beck
Re: [O] no pdf-output in lilypond code blocks
Hi Bastien, Line 155 in ob-lilypond.el use --png. Is it okay to use --pdf --html and --svg here too? The only choices are --pdf, --png, and --ps. See: http://www.lilypond.org/doc/v2.16/Documentation/usage/command_002dline-usage#invoking-lilypond If so, I'll fix ly-process-basic so that it depends on ly-gen-png/pdf/html/svg. Thanks for confirming, Thanks for fixing. -- Florian Beck
Re: [O] New exporter documentation?
James Harkins jamshar...@gmail.com writes: Specific question: Is there an easy way to use a given LaTeX template (.cls and .bib)? (I also found [2] but easy is not how I would describe that.) The easiest way is probably #+BEGIN_SRC emacs-lisp (require 'org-export) (require 'org-e-latex) (setq org-e-latex-default-class new-article) (add-to-list 'org-e-latex-classes '(new-article \\documentclass[10pt]{my-style} \n\\bibliography{/path/to/bibfile.bib} (\\section{%s} . \\section*{%s}) (\\subsection{%s} . \\subsection*{%s}) (\\subsubsection{%s} . \\subsubsection*{%s}) (\\paragraph{%s} . \\paragraph*{%s}) (\\subparagraph{%s} . \\subparagraph*{%s}))) #+END_SRC This works just like `org-export-latex-classes' but see the docstring. Now you are ready to go: M-x org-export-dispatch -- Florian Beck
[O] no pdf-output in lilypond code blocks
Hi, execute the following code block: #+begin_src lilypond :exports results :file 93bff287-036e-4129-8f17-fd6374f4ccdc.pdf \header { tagline = ##f } \score{ \relative c' { \key d \minor d2 a'2 f2 d2 }} #+END_src This will create a results block: #+RESULTS: [[file:93bff287-036e-4129-8f17-fd6374f4ccdc.pdf]] but actually create the file 93bff287-036e-4129-8f17-fd6374f4ccdc.eps (note the extension). [I need pdf, because I cannot get xelatex handle eps files.] It seems `ly-process-basic' hardcodes a --png option. If I change it to --pdf everything works fine (though it won't produce pngs any more, I guess). Of course, it should really be set as appropriate for the extension. -- Florian Beck
Re: [O] Ignoring empty subtrees/new exporter
On 01/06/2013 10:54 PM, Florian Beck wrote: On 01/06/2013 11:24 AM, Nicolas Goaziou wrote: The global idea is correct, but I find that the implementation is too low level. It also taints original e-latex back-end. I suggest the following instead: Thanks a lot! A derived backend seems like a good idea. Unfortunatly, the function org-export-with-backend isn't in the latest org-plus-contrib package (20121231). I'll try it then. Well, I've switched to the git version. The version in org-plus-contrib is a very one from the maint-branch, which kind of defeats the purpose of the package, doesn't it? Anyway, your suggestion now works perfectly, thanks again.
Re: [O] Logical not in org-entities.el
On 01/06/2013 07:14 AM, Bastien wrote: Hi Florian, Florian Beck f...@miszellen.de writes: The confusion arises with org-pretty-entities because what you see is definitely not what you get. Mhh... not sure what you mean: what do you see that you don't get? With org-pretty-entities: On display, org-entities handles all entities and displays them as unicode characters, even inside math blocks. On export, org-entities only handles entities outside math. Most of the time it doesn't matter because the entity name is the same as the latex command. But in case of $\not a$ latex export and fontification differ: the fontified buffer shows the angled dash (¬), the exported document shows a slash through the next charaxter.
Re: [O] Ignoring empty subtrees/new exporter
On 01/06/2013 11:24 AM, Nicolas Goaziou wrote: The global idea is correct, but I find that the implementation is too low level. It also taints original e-latex back-end. I suggest the following instead: Thanks a lot! A derived backend seems like a good idea. Unfortunatly, the function org-export-with-backend isn't in the latest org-plus-contrib package (20121231). I'll try it then.
Re: [O] Logical not in org-entities.el
On 01/06/2013 12:39 PM, Bastien wrote: In master, I added (neg \\neg{} nil not; [angled dash] ¬ ¬) in (defconst org-entities ...) so that you can now use it to produce \\neg{} where relevant. Thanks, but: \neg has to be put in math mode.
[O] Ignoring empty subtrees/new exporter
Hi, I have a document with many sections not yet written (i.e. heading without content) and I would like them to be ignored in the exported file. I know, I could manually tag these headings with :noexport:, but what about a more automated approach? Now, I tried this: (defun ignore-empty-section (headline contents info) (when contents (org-e-latex-headline headline contents info))) (add-to-list 'org-e-latex-translate-alist '(headline . ignore-empty-section)) This does ALMOST what I want: it ignores sections that are completely empty. But I also want to ignore sections that have only empty subsections (and so on, recursively). For example: * Chapter ** this subtree should be ignored *** no content *** no content ** this subtree should not be ignored *** subsection finally, content something weird *** subsection Any ideas? I tried parsing the HEADLINE stuff (the first argument), but it looks a bit intimidating. It's not super important, because it's a draft obviously, but it would be nice. Thanks, Florian
[O] Logical not in org-entities.el
Hi! org-entities contains the line: (not \\textlnot{} nil not; [angled dash] ¬ ¬) This should be (neg \\neg t not; [angled dash] ¬ ¬) The first line fails in math mode (i.e. \not is not replaced at all and negates/slashes the next symbol); the second works in either case.
Re: [O] Logical not in org-entities.el
org-entities contains the line: (not \\textlnot{} nil not; [angled dash] ¬ ¬) This should be (neg \\neg t not; [angled dash] ¬ ¬) The first line fails in math mode (i.e. \not is not replaced at all and negates/slashes the next symbol); the second works in either case. OK, so org doesn't touch anything inside a math environment at all. Which makes sense in a way. The confusion arises with org-pretty-entities because what you see is definitely not what you get.
Re: [O] Howto convert a complete bibtex file into an orgmode file?
On 11/24/2012 06:05 PM, michael.zom...@googlemail.com wrote: As far as I was able to find out, this is only possible for a single entry via 'org-bibtex-read'. I think I did something like M-: (while (re-search-forward ^@.*{ nil t) (org-bibtex-read)) Refine the regular expression, if you have any macros.
Re: [O] Some Experiences with org-babel-load-file
On 12/11/2012 03:52 PM, Eric Schulte wrote: Please go ahead and update the information on worg. Note that Emacs24 users need only do (require 'org) (org-babel-load-file /path/to/your/org-init-file.org) while users of lesser Emacs will have to load a new version of Org-mode before calling org-babel-load-file. Sorry, I have no idea how to update worg. compiled and un-compiled code. If this does pose a problem for you, perhaps an optional extra argument to be added to org-babel-load-file to enable compilation. Yes, this would do nicely. The `org-babel-load-file' function calls `org-tangle-file' so they are definitely working in concert. When a target file is passed to `org-tangle-file' then that is used as the value of the :tangle header argument, so the default behavior is to tangle. Ok, that makes sense. Great idea. I don't have time to work on this right now, but it is definitely on my stack. I suppose this should be the default behavior for all tangled files (not just those written by org-babel-load-file). Yes. Perhaps also include a comment that the file was tangled from an org-file plus the path to that file.
[O] Some Experiences with org-babel-load-file
Hello! As an experiment, I moved my .emacs and all my personal packages into an org-file and now load it with 'org-babel-load-file. This works fine enough: the source code blocks can handle several thousand lines of code (for later splitting) without any quirks, tough editing in the org-file sure gets slow. A couple of observations: 1. `org-babel-load-file' doesn't seem to be in the org docu. The instructions on worg are obsolete (mentions `org-install') and needlessly complicated. Just putting (package-initialize) ;; only if you use the newest org (require 'ob-tangle) (org-babel-load-file /path/to/your/org-init-file.org) into your .emacs (no need for .emacs.d/init.el) seems to suffice. 2. Unless you are only setting variables, you want your functions to be byte-compiled. I modified `org-babel-load-file' to do that. Any reason not to? 3. While it saves some keystrokes not to have to write tangle: yes, it seems to be at odds with `org-tangle-file (though it does respect tangle: no). 4. When I babel-load my-package.org, all emacs sees is the tangled my-package.el, which of course is right. The problem, however, is that I often search for one of my functions, change it … and loose the changes the next time I start emacs (I already got zapped a couple of times). Integrating org-tangle with the emacs documentation would be tough I guess. But how about setting a read-only file locale variable to block the most stupid mistakes? Overall, very nice. Thank you. -- Florian Beck
[O] Invisible Blocked Tasks and Tag Searches
Hello! I just spent nearly two hours figuring out why (setq org-stuck-projects '(/PROJECT nil nil (SCHEDULED\\|DEADLINE\\): )) wouldn't work for me. It would only display some projects. In fact, it would only show projects without any subentries. Turns out, that is because I have `org-agenda-dim-blocked-tasks' set to 'invisible. Doesn't seem right to me. Manual and docstring give the impression, the variable would only affect the agenda (as in »C-c a a«). Admittedly, it makes also sense for the todo list. But not for tag searches or stuck projects. By the way, I solved the problem by advising `org-agenda-list-stuck-projects' and `org-tags-view'. Is there an easier way to override variables for a specific agenda command? -- Florian Beck
Re: [O] Refiling list items
Jeff Horn jrhorn...@gmail.com writes: Would someone throw me a bone? I couldn't find anything on gmane, but I my gmane-fu isn't the strongest. :D On Sat, Aug 6, 2011 at 14:54, Jeff Horn jrhorn...@gmail.com wrote: Should org-refile be able to refile list items? I suspect it would be non-trivial to add this functionality if it isn't already there, but I feel a bit overwhelmed keeping notes as headlines, particularly because I like to leave soft wrapping off and have a hard wrap at 80 columns. Here is a hack I use. It doesn't do any bookkeeping, doesn't check for errors, (temporarily) moves the point during refiling and you might want to set `org-refile-targets' to your liking. On the other hand, it might just do the trick: (defun org-copy-item (optional kill) Copy item at point to another location. With prefix argument, move the item. (interactive P) (org-get-item kill) (let ((org-refile-targets '((org-default-notes-file :maxlevel . 4 (save-window-excursion (org-refile t) (outline-next-visible-heading 1) (skip-chars-backward \t\n) (insert \n) (yank (defun org-get-item (optional kill) Copy the item at point to the kill ring. Optionally, kill it. (save-excursion (let ((beg (org-in-item-p))) (org-end-of-item) (funcall (if kill 'kill-region 'copy-region-as-kill) beg (point) -- Florian Beck
Re: [O] Refiling list items
Jeff Horn jrhorn...@gmail.com writes: What would be the specifications of that function? Would it only send the item at point to the end of the headline specified through the refile interface? I hope its clear that this is all above my head. I know enough to make suggestions, but not contribute to implementing them. That makes me a free-rider, but a free-rider that recognizes he's at the mercy of others' talents. The thing is, the code I sent you is just that: a shortcut for killing an item and pasting it at a refile location. Orgs refiling interface goes to a lot of trouble to do the right thing. Nicolas already mentioned reparing the list and updating checkboxes, both of which never was an issue for me. FWIW, refiling items seems like a natural extension to me. In any case, it is not about you being able to specify or implement a function. But I found it very helpful to pick up just enough elisp to automate tasks. -- Florian Beck
Re: [O] Unicode and Latex export
suvayu ali fatkasuvayu+li...@gmail.com writes: Hello Christopher, On Sun, Aug 7, 2011 at 12:01 PM, Christopher Witte ch...@witte.net.au wrote: You could try using XeLaTeX, which supports unicode. Instructions for setting it up with org-mode are here http://orgmode.org/worg/org-faq.html#using-xelatex-for-pdf-export My lisp is not very good, but what is the need for such an extensive setup? Isn't setting org-latex-to-pdf-process to xelatex enough to switch packends? It is, more or less. XeLaTeX needs a different header, that is what the instructions set up. However, I would recommend keeping it simple and put your packages etc in your own style file. In `org-export-latex-classes', replace \\documentclass[11pt]{article} with [NO-DEFAULT-PACKAGES] \\documentclass[11pt]{article}\n\\usepackage{myxe} and put everything you need in myxe.sty. BTW, this only works if you use a font that provides all the characters you need (and looks nice enough for your taste). Alternatively, you could use `org-export-latex-final-hook' and write a function that translates unicode characters to latex code. -- Florian Beck
Re: [O] Unicode and Latex export
suvayu ali fatkasuvayu+li...@gmail.com writes: On Sun, Aug 7, 2011 at 6:50 PM, suvayu ali fatkasuvayu+li...@gmail.com wrote: BTW, this only works if you use a font that provides all the characters you need (and looks nice enough for your taste). I don't usually customise my fonts and go with the default latex fonts. Do you have any suggestions what fonts that would be appropriate here? I tried using XITS, but that didn't help. I should clarify, when I say didn't work I mean xelatex couldn't find the fonts although I have them installed. Not sure. XeTeX uses the fonts you have installed on your system, not those for TeX. Everything in M-: (font-family-list) should work. Maybe one of the DejaVu fonts? Generally, though, universal fonts aren't the best choice. Here is what I do. Create a custom link style for export with XeLaTeX: (org-add-link-type uc 'ignore 'org-unicode-export) (defun org-unicode-export (path desc format) Export unicode characters. (cond ((eql format 'html) (format %s desc)) ((eql format 'latex) (format {\\fontspec[Scale=MatchLowercase]{%s}%s} path desc)) (t desc))) And write [[uc:Code2000][⫳]] to use Code2000 as a font. I use it mostly for greek words, e.g. [[uc:Alexander][φύσις κρύπτεσθαι φιλεῖ]] But if you mostly have single characters it might be too much of a hassle. -- Florian Beck
Re: [O] Unicode and Latex export
suvayu ali fatkasuvayu+li...@gmail.com writes: On Sun, Aug 7, 2011 at 8:07 PM, Florian Beck abstrakt...@t-online.de wrote: But if you mostly have single characters it might be too much of a hassle. It does indeed sound like too much hassle for my use case. I only use it for scientific note taking. For example I would write something like this: CP channel: Bs⁰ - Ds⁻ K⁺ / Ds⁺ K⁻ (interference b/w decay modes of Bs⁰ or anti-Bs⁰) In this case, XeLaTeX with \setmainfont{DejaVu Serif} in the preamble seems to give reasonable results. I think I'll try to find an alternate solution. Maybe I'll end up writing that unicode to latex translation function in elisp. I did something like that for muse-mode. IIRC the main problem was that the translation has to be context sensitive (ie math mode vs. text mode). Let me know if you are interested, maybe I can dig something out. Thanks a lot for the pointers though. -- Florian Beck
Re: [O] Performance of org-mode with BIDI
Reiner Steib reinersteib+gm...@imap.cc writes: On Mon, Aug 01 2011, Florian Beck wrote: If you are using the current bzr version of emacs, make sure to set `bidi-display-reordering' to nil. Please don't. Instead, report problems caused by `bidi-display-reordering' with M-x report-emacs-bug RET so the Emacs developers can fix the problem. And, as of now, the problem is already fixed. -- Florian Beck
Re: [O] Largest org file you have + performance
Marcelo de Moraes Serpa celose...@gmail.com writes: Hey list, What's the largest orgmode file you have, and what's the performance you get while manipulating/navigating it? Mine is a 5k lines file called reference.org, and I basically keep all kind of notes and attachments there. It's a bit slow to navigate on my Emacs 240.50.1, orgmode 7.4, although still usable. I'm just afraid that it will keep getting slower with time at the point of being unusable inside emacs+orgmode. I'm curious if there are users with larger orgmode files and what their experience is, and open to suggestions on how to improve performance. emacs-bzr, org-7.7 The largest file I have is 7.2M. Some 6300 entries, 137k lines. Agenda commands are slow, of course, but otherwise the performance is acceptable. Anything that involves completion is quite slow. Opening ID links is also slower than I would like. Anything that works on the whole buffer can take a long time (cycling from OVERVIEW to CONTENTS takes more than a minute), so try to avoid that. (I keep old notes in that file, so mostly I search or link to entries.) If you are using the current bzr version of emacs, make sure to set `bidi-display-reordering' to nil. Cheers, Marcelo. -- Florian Beck
Re: [O] Copy/Search Outline
Christian Moe m...@christianmoe.com writes: Firstly, I want to copy the *visible* text (minus the …, but never mind that); In other words: Begin exporting only the visible part with `C-c C-e v', then press space at the prompt for output formats. This leaves you in a second buffer with a copy of the visible part (and yes, you do get rid of the ellipses). Then select all with `C-c h' (alternately, select the region of your choice) and copy. Kill the copy buffer when you're done with it. Thanks. Seems like `org-export-visible' does exactly what I want. I also wrote a function to copy the visible part of the region. For those curious: (defun copy-visible (beg end) (interactive r) (let ((text ) s) (save-excursion (save-restriction (narrow-to-region beg end) (setq s (goto-char (point-min))) (while (not (= (point) (point-max))) (goto-char (org-find-invisible)) (setq text (concat text (buffer-substring s (point (setq s (goto-char (org-find-visible)) (kill-new text))) secondly, I want to be able to search only the visible text. You can do that, albeit only in a copy of your document in a separate buffer, with the approach above. But why would you want to? Perhaps if you state a use case, someone can point out a different approach. Actually (as I just found out) you can do it very easily by setting the variable `search-invisible' no nil (found in isearch.el). More generally (and less org specific), how do I restrict commands to the visible parts of the buffer? I don't know. I guess it's not possible because commands work on the buffer and usually do not know about viviblity. Maybe something like `with-visible-buffer' could be proposed – but now with searching and copying working, I do not really have a use case. Thanks again. -- Florian Beck
Re: [O] Using org-mode for Research and Notetaking
(add-to-list 'org-link-types type t) (org-make-link-regexps) (if (assoc type org-link-protocols) ! (setcdr (assoc type org-link-protocols) (list follow export)) ! (push (list type follow export) org-link-protocols))) (defvar org-agenda-buffer-name) --- 8454,8461 (add-to-list 'org-link-types type t) (org-make-link-regexps) (if (assoc type org-link-protocols) ! (setcdr (assoc type org-link-protocols) (list follow export face)) ! (push (list type follow export face) org-link-protocols))) (defvar org-agenda-buffer-name) Diff finished. Tue Jul 26 16:16:12 2011 -- Florian Beck
[O] Copy/Search Outline
Hi all, when working with outlines (tabbing until CONTENTS), there are two things I cannot figure out: Firstly, I want to copy the *visible* text (minus the …, but never mind that); secondly, I want to be able to search only the visible text. More generally (and less org specific), how do I restrict commands to the visible parts of the buffer? TIA -- Florian Beck
Re: [O] Using org-mode for Research and Notetaking
t...@tsdye.com (Thomas S. Dye) writes: Bastien b...@altern.org writes: Hi Florian, Florian Beck abstrakt...@t-online.de writes: Actually, I meant »tags« in the HTML sense. For boxedexample/boxed would call a function during export, which returns, say, its LaTeX interpretation, another function would be called by font lock (or whatever you use) to determine its on screen display. Well, I'm not in favor of introducing tag -- they can be convenient, but they degrade readability IMO. Aloha all, Perhaps they are [[tag:boxed][already]] here with org-add-link-type? It seems to me that all that's missing is a way to specify a function to determine on screen display. Exactly. I don't care about the specific implementation (and org makes a lot of my previous uses superflous). TAGs in the above sense – however implemented – would allow for fine grain control of the output. For example different classes of footnotes with latex/bogfoot or specific handling of citations. Readability is not the issue, imo, because currently my workaround would be to put the whole paragraph in a latex source block – which certainly doesn't improve readability. Tagged text, on the other hand, should and could definity allow for its own on screen display. What is an issue is that (apart from property/source blocks and emphasis) org text is pretty much plain. TAGs could impair that. Currently migrating from muse to org I can certainly attest that any »special handling« certainly impairs portability. -- Florian Beck
Re: [O] Using org-mode for Research and Notetaking
John Hendy jw.he...@gmail.com writes: I posted something similar a bit back. I do use org for todos, but also write papers/reports, and take notes on things I'm reading. You might want to check out that thread. [1] In particular, there were some great comments about using inline tasks with custom export options (one of them being the todonotes pacakge). [2] [3] Hope that offers at least some input. I think inline tasks can do what you want -- can be exported or not, they stay out of the way, and don't break the flow. Good luck! Thanks for the suggestion, I have to look into the export options. --- All from the same thread, but I skimmed it and picked these out in particular: [1] Top level thread: http://www.mail-archive.com/emacs-orgmode@gnu.org/msg40356.html [2] Inline tasks suggestion: http://www.mail-archive.com/emacs-orgmode@gnu.org/msg40359.html [3] Todonotes variant: http://www.mail-archive.com/emacs-orgmode@gnu.org/msg40589.html John -- Florian Beck -- Florian Beck
Re: [O] Using org-mode for Research and Notetaking
Bastien b...@altern.org writes: 2. Tags are SLOW (no doubt due to my 8.5M file). Completion takes minutes. I fixed that by adding all my (hundreds of) tags to `org-tag-alist' and restricting capture to »%g«, checking only the current file. `org-id-find' is slow as well and so will be property completions, I guess. How about caching the data and update on saving an org-agenda file? We might consider this. I doubt updating on saving is the right thing to do -- people tend to save very often, and for solving problems like yours, it will be as slow as the current interface. We need to be more clever in defining the update cycle for caches, and this depends on _what_ the cache is containing. I agree, updating on saving would not work for large files. Maybe you could use a cache on a per file basis, creating it when org first happens to collect the data and updating it on demand. Of course, it might be out of date, which in my case would be no problem. You will need to live with it for now. 4. muse-mode has this nice feature that it easily allows you to define your own tags like i-am-learning-kanji-so-better-display-this-big…/… or a-citation-the-way-i-like-it…/…; not only for export but also for fontification. Can I do something similar in org-mode? What do you mean? What I can think of are tag aliases: for example, the tag :code: would be an alias for :code python lisp:. The buffer would display the alias. Tag search would match the expanded version. This adds a semantic layer for tags, so maybe there are complexities I cannot think of right now, but I think it might be interesting. What do you think? Actually, I meant »tags« in the HTML sense. For boxedexample/boxed would call a function during export, which returns, say, its LaTeX interpretation, another function would be called by font lock (or whatever you use) to determine its on screen display. That is, the user has to provide two functions and org mode has to call them at the appropriate place. 5. According to the manual »TODO items are an integral part of the notes file«. I like that, but I do not find it so. TODO items are headings which I find somewhat confusing: My files are either articles to be (with the appropriate headlines) or notes where headlines usually formulate the topic the note is about. Todo items, on the other hand, would be »clarify the paragraph«, »check what X says about Y«, »add more sources«, etc. As it is TODOs are not integrated but stand out, breaking the structure of the file. How about allowing TODO items in comments? This would seem much more natural to me: a TODO item should not be part of your text but disappear when it is done. As suggested, you want to check inline tasks. I'll look into it. Thanks for your comments! I really don't like the current syntax for inline tasks, I would much prefer something like special TODO keywords: * !TODO This would be an inline task, not a headline But perhaps I'm missing something about why the current inline task syntax is useful. I'd be interested in hearing more by people who are actually using them... Thanks for your input! -- Florian Beck
[O] Using org-mode for Research and Notetaking
[My main goal is to take research notes and write texts. I have little interest in the todo/agenda part of org-mode, which I understand is its main focus, so bear this in mind.] Previously I have been using muse-mode for publishing and a home brew system for organising my notes. Now I thought, I would give org-mode a try. I had some 3500 short notes which I converted into a 8.5M org-file with said 3500 heavily tagged entries. Also created a 500k org file from my bibtex file. These two plus a couple of shorter files are my org-agenda-files. Speed is quite ok, surprisingly. `org-columns' in the big file is a no-go, of course (overlays!). The agenda commands work fine (I have few entries with todo-keywords, but they are in every file.) So far so good. Tables, integration of latex fragments: great stuff. I like the outlining capabilities but used most of them via `org-struct-mode' already. Especially impressed with babel. Wow! A couple of questions and observations, first impressions really: 1. Publishing (I have only tested pdf) works pretty well. Obviously, or so I would have thought, I don't want to see todo-keywords and TAGs in the output. How do I get rid of them? 2. Tags are SLOW (no doubt due to my 8.5M file). Completion takes minutes. I fixed that by adding all my (hundreds of) tags to `org-tag-alist' and restricting capture to »%g«, checking only the current file. `org-id-find' is slow as well and so will be property completions, I guess. How about caching the data and update on saving an org-agenda file? 3. By default, tags cannot contain spaces or commas. I rectified that with an ugly hack in `org-set-tags-to', which replaces spaces with ?\x2008 (punctuation space), and setting it to word syntax. Also, many long tags display ugly. How about showing only the first twenty characters and show the rest via help echo? 4. muse-mode has this nice feature that it easily allows you to define your own tags like i-am-learning-kanji-so-better-display-this-big…/… or a-citation-the-way-i-like-it…/…; not only for export but also for fontification. Can I do something similar in org-mode? 5. According to the manual »TODO items are an integral part of the notes file«. I like that, but I do not find it so. TODO items are headings which I find somewhat confusing: My files are either articles to be (with the appropriate headlines) or notes where headlines usually formulate the topic the note is about. Todo items, on the other hand, would be »clarify the paragraph«, »check what X says about Y«, »add more sources«, etc. As it is TODOs are not integrated but stand out, breaking the structure of the file. How about allowing TODO items in comments? This would seem much more natural to me: a TODO item should not be part of your text but disappear when it is done. -- Florian Beck
[Orgmode] Deadlines with Time
Hi, sometimes I want to specify a deadline with a certain time. Without a time, there is no problem. The deadline shows up a couple of times earlier, which is fine. However, when I specify a time like DEADLINE: 2008-08-04 Mon 16:00 this shows up in the daily agenda of Saturday like this: 8:00.. 10:00.. 12:00.. 14:00.. 16:00.. Plan: 16:00.. In 2 d.: TODO Some Task This is not helpful, it does not belong in the timetable for today. I want the task to show up in the agenda view, just not in the timetable. How can I accomplish that? Also, there is a bug when I add a timestamp to the task: * TODO Some Task 2008-08-02 Sat 14:00 DEADLINE: 2008-08-04 Mon 16:00 This is displayed thusly in the agenda view (note the wrong time on the second occurance): 8:00.. 10:00.. 12:00.. 14:00.. Plan: 14:00.. TODO Some Task 16:00.. Plan: 14:00.. In 2 d.: TODO Some Task Maybe it does not make much sense to specify a deadline after the timestamp. Anyway, I noticed it when playing around. -- Florian Beck ___ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] Re: Deadlines with Time
Jose Robins [EMAIL PROTECTED] writes: There is a customize variable called org deadline warning days - Maybe this setting has something to do with what you are seeing? Yes sure, I can set org-deadline-warning-days to 0 and never see an upcoming deadline. However, that is not what I want. The agenda view has two parts: (a) the time table and (b) a list of tasks that are scheduled for today, due today or due within org-set-deadline-warning-days. Tasks that are due tomorrow at 14:00 should show up in (b), not in (a). What I see is this: 8:00.. 10:00.. 12:00.. 14:00.. Plan: 14:00.. TODO Some Task 16:00.. Plan: 14:00.. In 2 d.: TODO Some Task (*) Plan: Deadline: TODO Other task without time Plan: In 2 d.: TODO Yet another Task (**) I *do* want the task (*) show up in the agenda view, but *not* in the timetable, because I do not have to do (*) today at 14:00. What I want is to show (*) the same way as (**), i.e. like a task with no time specified, *below* the time table. Jose Florian Beck wrote: Hi, sometimes I want to specify a deadline with a certain time. Without a time, there is no problem. The deadline shows up a couple of times earlier, which is fine. However, when I specify a time like DEADLINE: 2008-08-04 Mon 16:00 this shows up in the daily agenda of Saturday like this: 8:00.. 10:00.. 12:00.. 14:00.. 16:00.. Plan: 16:00.. In 2 d.: TODO Some Task This is not helpful, it does not belong in the timetable for today. I want the task to show up in the agenda view, just not in the timetable. How can I accomplish that? Also, there is a bug when I add a timestamp to the task: * TODO Some Task 2008-08-02 Sat 14:00 DEADLINE: 2008-08-04 Mon 16:00 This is displayed thusly in the agenda view (note the wrong time on the second occurance): 8:00.. 10:00.. 12:00.. 14:00.. Plan: 14:00.. TODO Some Task 16:00.. Plan: 14:00.. In 2 d.: TODO Some Task Maybe it does not make much sense to specify a deadline after the timestamp. Anyway, I noticed it when playing around. ___ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode -- Florian Beck ___ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode