Bug: org-table-insert-column edits formulas wrongly [9.3 (release_9.3 @ /usr/local/Cellar/emacs-plus/HEAD-9d38564/share/emacs/28.0.50/lisp/org/)]
Calling org-table-insert-column in a table with formulas wrongly increments the column number left of the newly inserted column. Minimal example: | 1 | 2 | 3 | #+TBLFM: $3=$1+$2 With cursor in the `1` cell, call `M-x org-table-insert-column`. Expected output: | 1 | | 2 | 3 | #+TBLFM: $4=$1+$3 Actual output ($1 wrongly changed to $2): | 1 | | 2 | 3 | #+TBLFM: $4=$2+$3 The bug seems to be in the last 2 lines of the function org-table-insert-column: (org-table-fix-formulas "$" nil (1- col) 1) (org-table-fix-formulas "$LR" nil (1- col) 1) Changing `(1- col)` to `col` solves the issue. Emacs : GNU Emacs 28.0.50 (build 2, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G1012)) of 2020-01-05 Package: Org mode version 9.3 (release_9.3 @ /usr/local/Cellar/emacs-plus/HEAD-9d38564/share/emacs/28.0.50/lisp/org/) current state: == (setq org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-link-shell-confirm-function 'yes-or-no-p org-metadown-hook '(org-babel-pop-to-session-maybe) org-clock-out-hook '(org-clock-remove-empty-clock-drawer) org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes) org-archive-hook '(org-attach-archive-delete-maybe) org-confirm-elisp-link-function 'yes-or-no-p org-agenda-before-write-hook '(org-agenda-add-entry-text) org-metaup-hook '(org-babel-load-in-session-maybe) org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-babel-pre-tangle-hook '(save-buffer) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-occur-hook '(org-first-headline-recenter) org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines org-optimize-window-after-visibility-change) org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate) org-confirm-shell-link-function 'yes-or-no-p org-link-parameters '(("attachment" :follow org-attach-open-link :export org-attach-export-link :complete org-attach-complete-link) ("id" :follow org-id-open) ("eww" :follow eww :store org-eww-store-link) ("rmail" :follow org-rmail-open :store org-rmail-store-link) ("mhe" :follow org-mhe-open :store org-mhe-store-link) ("irc" :follow org-irc-visit :store org-irc-store-link :export org-irc-export) ("info" :follow org-info-open :export org-info-export :store org-info-store-link) ("gnus" :follow org-gnus-open :store org-gnus-store-link) ("docview" :follow org-docview-open :export org-docview-export :store org-docview-store-link) ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link) ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete org-bbdb-complete-link :store org-bbdb-store-link) ("w3m" :store org-w3m-store-link) ("file+sys") ("file+emacs") ("shell" :follow org-link--open-shell) ("news" :follow #[257 "\301\300\302 Q!\207" ["news" browse-url ":"] 5 "\n\n(fn URL)"] ) ("mailto" :follow #[257 "\301\300\302 Q!\207" ["mailto" browse-url ":"] 5 "\n\n(fn URL)"] ) ("https" :follow #[257 "\301\300\302 Q!\207" ["https" browse-url ":"] 5 "\n\n(fn URL)"] ) ("http" :follow #[257 "\301\300\302 Q!\207" ["http" browse-url ":"] 5 "\n\n(fn URL)"] ) ("ftp" :follow #[257 "\301\300\302 Q!\207" ["ftp" browse-url ":"] 5 "\n\n(fn URL)"] ) ("help" :follow org-link--open-help) ("file" :complete org-link-complete-file) ("elisp" :follow org-link--open-elisp) ("doi" :follow org-link--open-doi)) org-link-elisp-confirm-function 'yes-or-no-p )
[O] [BUG] Export of sub- and superscripts to LaTeX inconsistent in tables?
Hello! When I use superscripts/subscripts in tables, they are incorrectly exported to LaTeX -- the placement of math-mode marks ($), braces ({, }) seems mixed up. As an example an excerpt of my current laboratory book. | Calculation | Zn layers | E_tot [eV/atom] (new) | (interpolated) | \Delta{}E_tot [meV/atom] | |-+---+--++---| [...] The energy difference \Delta{}E_tot seems [...] This gets exported as: \begin{center} \begin{tabular}{l} Calculation & Zn layers & E_tot [eV/atom] (new) & (interpolated) & \D\ elta\{}E_tot [meV/atom] \\ \hline \end{tabular} \end{center} The energy difference $\Delta${}E$_{\mathrm{tot}}$ seems [\ldots{}] Outside the table it works as expected. You can see 3 errors in the export of "\Delta{}E_tot" to latex in the table: 1. There are no $ marks. During PDF-Conversion this causes "! Extra }, or forgotten $" messages. 2. The braces around the subscript are missing -- only the first character thus is recognized as a subscript by (pdf)latex. 3. For some reason, the opening brace after Delta is escaped. The problem doesn't depend on the specific case of a LaTeX entity before the subscript (i.e. \Delta{}). It occurs too throughout the document for combinations like "E_gb", though of course the escaped brace ( \{} ) doesn't occur there. When explicitly writing "E_{tot}" in the table, this was exported as "E_\{tot\}", which is just as unexpected. I tested this with a freshly pulled version from the git repository and with the org-mode sample above as the contents of a minimal file with the same result. king regards, Yu
Re: [O] babel, executing code in background process
Hello! The trick would be in setting up the post-execution code block handling > (namely results parsing and insertion) to run after external evaluation > has completed. I don't think this is a high priority necessarily. When executing e.g. gnuplot or octave source code blocks for the sake of plotting, I'm usually interested in runtime feedback more than collecting the text afterwards. When doing notebook-Style work, also something like : #+begin_src octave :session *foo* :results silent <> : <> : #+end_src : #+begin_src octave :session *foo* :results value <> :<> : #+end_src would be possible, though of course no convenient solution. My current solution for long-running octave scripts isn't any more convenient though: Define the task as functions and then switch to the session buffer manually and run those interactively. kind regards, Yu 2012/3/2 Eric Schulte > Erik Garrison writes: > > > Hi Eric, > > > > Thanks for the background. It looks like ob-screen may be very limited > in > > that it doesn't > > > > It seems to me that a decent method would behave similarly to the way to > > "M-x compile" works--- another buffer opens in which the compilation > > progresses. Is there any reason why this might not be applicable to the > > way babel works? > > > > The approach you describe above (a process buffer with a filter) would > be one viable approach, perhaps even something as simple as using > `async-shell-command' would be workable. One place to start looking > would be in ob-eval.el for external evaluation and ob-comint for session > based evaluation. > > The trick would be in setting up the post-execution code block handling > (namely results parsing and insertion) to run after external evaluation > has completed. > > If anyone wants to look into the code and write/propose a way forward > I'm happy to help in any way I can. > > Cheers, > > > > > Erik > > > > On Wed, Feb 29, 2012 at 5:55 PM, Eric Schulte > wrote: > > > >> Hi Erik, > >> > >> Currently there is not (to my knowledge) any support for asynchronous > >> code block evaluation. The one possible exception could be ob-screen > >> which I mention only because I don't really know anything about it. > >> > >> This would certainly be a worthwhile feature to add to Org-mode code > >> blocks, however a good implementation (easy to use, robust and > >> cross-language) will be non-trivial to implement. > >> > >> Best, > >> > >> Erik Garrison writes: > >> > >> > Hi, > >> > > >> > I'm just starting to use org-mode and babel to structure exploratory > data > >> > analysis which I do for my work. > >> > > >> > One issue that I've run into is that many of the queries I have to > issue > >> > will take a very long time to complete. > >> > > >> > Is there any method I could use to execute them in a background > process? > >> > > >> > Thanks, > >> > Erik > >> > >> -- > >> Eric Schulte > >> http://cs.unm.edu/~eschulte/ > >> > > -- > Eric Schulte > http://cs.unm.edu/~eschulte/ > >
[O] [BUG]? Constant-definition-lines in tables get exported.
Hello! org-mode tables currently allow defining table-local constants in lines marked with "$" (as described in the "Tables > Advanced Features" section of the manual). However, when exporting (to LaTeX), these lines are included in the output -- and a cannot find a possibility to re-exclude them. Using #+CONSTANTS: is no adequate replacement, as the table-local constants help to avoid accidentially defining a constant twice, maybe with different values. Also the local character allows to use shorter names, which are better understandable in the context, but maybe not at all outside. An example table from my work: | | site | N |E/N[eV] | E_surf[meV/A²] | |---++++| | * | on-top-1 | 32 | -7.2062959 | 138.89 | | * | bridge-2 | 32 | -7.2063544 | 138.85 | | * | bridge-3 | 32 | -7.2064131 | 138.81 | | $ | e_bulk=-8.30623|||| | $ | e_bulk_zn=-1.26671 |||| | $ | A_int=25.34335655 |||| #+TBLFM: $5=1000*($4*$3-($3-4)*$e_bulk-4*$e_bulk_zn)/(2*$A_int);%.2f My org-mode is a yesterday's pull from the git-repository. kind regards, Yu
[O] Table formulas: Cannot use column names on the left hand side
Hello! I tried today to use named columns for calculations. While this works on the right hand side of the equation, names don't seem to work for the left hand side -- which is a problem, because a change in column arrangement, that isn't caused by org functions (e.g. manually inserting a column with rectangle-copying) may cause an input column to be overwritten accidentially (e.g. having a formula $4=$3*$2+$1 and then manually inserting a column for line markers as described in "Advanced Features"). Exactly this happened to me recently, forcing me to redo some by-hand evaluation. Here some examples to clarify the problem: - Recalculation attempts done each with C-u C-c C-c in the table and with C-c C-c in the formula line, and with C-u C-c *. Works fine: | a | b | a+b | |-+-+-| | 1.0 | 1.0 | 2.0 | | 1.5 | 0.5 | 2.0 | | 0.5 | 0.0 | 0.5 | #+TBLFM: $3=$1+$2;%.1f Doesn't Work: | | a | b | a+b | |---+-+-+-| | | 1.0 | 1.0 | | | | 1.5 | 0.5 | | | | 0.5 | 0.0 | | | ! | a | b | ab | #+TBLFM: $ab=$a+$b Doesn't Work: | | a | b | a+b | |---+-+-+-| | | 1.0 | 1.0 | | | | 1.5 | 0.5 | | | | 0.5 | 0.0 | | | ! | a | b | ab | #+TBLFM: $4=$a+$b Even this doesn't work | | a | b | a+b | |---+-+-+-| | | 1.0 | 1.0 | | | | 1.5 | 0.5 | | | | 0.5 | 0.0 | | | ! | a | b | ab | #+TBLFM: $4=$2+$3 This works again; This is sort of consistent with the specification, that "Unmarked lines are exempt from recalculation with C-u C-c *", but there was no mention, that it affects other methods of causing recalculation too in `(info "(org)")'. | | a | b | a+b | |---+-+-+-| | * | 1.0 | 1.0 | 2. | | * | 1.5 | 0.5 | 2. | | * | 0.5 | 0.0 | 0.5 | | ! | a | b | ab | #+TBLFM: $4=$2+$3 This again does NOT work. | | a | b | a+b | |---+-+-+-| | * | 1.0 | 1.0 | | | * | 1.5 | 0.5 | | | * | 0.5 | 0.0 | | | ! | a | b | ab | #+TBLFM: $ab=$2+$3 Works again. | | a | b | a+b | |---+-+-+-| | * | 1.0 | 1.0 | 2. | | * | 1.5 | 0.5 | 2. | | * | 0.5 | 0.0 | 0.5 | | ! | a | b | ab | #+TBLFM: $4=$a+$b
Re: [O] Weirdness re: inclusion of figures
Hello! The behaviour is actually as expected. To understand this, you have to consider, that org-mode currently only seems to recognize the relation between source block and #+result paragraph if one of these two conditions holds: o The "#+result:" line follows the source code without any text in between. o Both code block and "#+result:" line are labeled with the same name. Also consider, as said by Nick Dokos, the significance of the ":exports" header argument: o By default the result is computed but not exported. o If the (unnamed) result is delimited from the source code by intervening text, it is no longer considered any source blocks result: The exporter just ignores the "#+result:" line and includes the image into the exported file. Labelling a source code block can be done with a "#+NAME:" line preceding the code block. When evaluating the code block, the "#+results"-line automatically gets named too. When reevaluating a code block then the contents of this "#+results" entry is correctly refreshed even after intervening code. What you want thus probably is: : #+name: code-block : #+begin_src R :file z.png :results output graphics : plot(matrix(rnorm(100), ncol=2), type="l") : #+end_src : : Intervening text : : #+results: code-block : [[file:z.png]] I did some tests to verify I'm right about this though, having installed a recent version from git (at most 2 days since the last pull): o No intervening text, no ":exports": Image is not exported. o No intervening text, ":exports both": Image is exported once; When exporting the code is rerun. o Intevening text, no ":exports": The image is exported once. The code block is not rerun on export. o Intervening text, ":exports both": The code is run twice (!), the image is exported both before and after the text. king regards, Yu 2012/2/16 Paul Magwene : > Hi All, > > I'm trying to get up to speed with org-mode and babel for doing > reproducible computational research. I'm just starting to play around > with simple examples, and I'm baffled by the following. > > This first example, when exported to HTML or LaTeX produces the > expected result -- a simply code block with one embedded figure. > > # Example 1. > > This is my R example: > > #+begin_src R :file z.png :results output graphics > plot(matrix(rnorm(100), ncol=2), type="l") > #+end_src > > Some intervening text... > > #+results: > [[file:z.png]] > > > However, this almost identical example, minus the intervening text > between the code and the results, doesn't include the figure: > > # Example 2 > > This is my R example: > > #+begin_src R :file z.png :results output graphics > plot(matrix(rnorm(100), ncol=2), type="l") > #+end_src > > #+results: > [[file:z.png]] > > > What gives here? Do I always need to have intervening text between the > source code and results in order to get a figure in the exported > document? > > Thanks, > Paul >
[O] Images in Tables?
Hello! I was wondering if there is any useful way, to organize images in tables. This would be useful e.g. if one needs to organize some images on a regular grid, but the images aren't equally sized, such that a simple line break doesn't do the trick. Creating just a table with the image links inside will work /basically/, assuming that the images have an appropriate size, but if resizing is needed, I can't see how to do this in a table (because inside no e.g. #+ATTR_LATEX line is possible). The same problem also occurs when I want to preview images side-by-side, e.g. : [[./img1.png]] [[./img2.png]] though here actually newlines from fill-paragraph/auto-fill add to the problem - as will be the size of some high-resolution images. My only current solution is to use explicit LaTeX and then preview the LaTeX, but that slows down operation considerably. Is anything currently implemented to allow such usage?
Re: [O] Showing evaluation buffer while executing source blocks?
Little correction: it doesn't seem to be simple after all. Emacs' single-threading kills the concept, because the display doesn't get updated during execution anyway. Does anybody have an idea, if this can be avoided? 2012/2/2 Yu : > Hello! > > I wondered if there is a way to show the evaluation buffer (if any) > during evaluation of commands -- in particular when the command takes > a long time (e.g. when trying to document a building process involving > `make' invocations) waiting for the command to finish is counter > productive. Even worse if the command used turns out to cause an > infinite loop. > > If not possible yet: At least in the case of session based evaluation, > this would "simply" mean a construct of the form > : (save-excursion > : <> > : (display-buffer <>) > : <>) > > The idea came up because I'm currently trying to document the building > process of mathematical libraries (matplotlib, numpy, scipy) under > Cygwin -- building those is pretty tricky there. And waiting for a > `make' invocation to finish before seeing any result... well ^^' > > On a side note, as mentioned in the "[O] [bug] cannot execute shell > code blocks" thread, for shell commands sadly this "simple" solution > won't work, as session based evaluation never returns from the > session. > > "simple" because: I couldn't figure out where this would have to be done ^^' > > > king regards, Yu
Re: [O] Variable settings in .emacs VS cross device portability.
2012/1/31 Eric S Fraga : > Eric Schulte writes: > > [...] > >> File Local Variables [1] make it possible to explicitly specify the >> values of variables from within the text of a .org file. This can be >> placed in a single line at the top of a file for small changes or in a >> larger section at the end of the file. > > Eric, > > this doesn't always seem to work, at least not for me. BIND always > works but certain org variables seem to be ignored when set using local > file variables. > > The variables I refer to are often, maybe always (?), related to export > functions. My gut feeling is that this has something to do with a copy > of the file being made for the export and maybe emacs not getting a > chance to set local variables for that copy? Grasping at straws here, > mind you ;-) For #+BIND the org manual is probably not quite clear. The "Concept Index" page says: : * #+BIND:Export options. (line 19) "12.2 Export options" says: : #+BIND:lisp-var lisp-val, e.g.: org-export-latex-low-levels itemize : You need to confirm using these, or configure `org-export-allow-BIND' So basically, #+BIND only applies to export, though the manual maybe slightly underemphasizes that fact. Did you try the general emacs syntax for file variables, Eric Schulte mentioned? [1] For me that worked (except that non-safe variables require confirmation in order to avoid text files executing harmful code). The emacs-documentation doesn't mention it, but apparently this works also in shebang'ed files, by moving the single line form (`-*- ... -*-') to the second line. [2] [1] http://www.gnu.org/software/emacs/manual/html_node/emacs/File-Variables.html [2] http://www.lugaru.com/man/File.Variables.html
Re: [O] Syntax error warnings? (Especially important with :noweb-ref's)
Hello! Thanks for the reply. The problem was, that I assumed the list `org-babel-noweb-error-langs' to require the same form as `org-babel-load-languages', i.e. something like : ( (latex . t) (python . t) (sh . t) ) I didn't expect it to require a plain list of strings. Now, that this misunderstanding is cleared though, the next problem becomes visible: The common workflow I excepted is: 1. Define an overall structure of the task. 2. Run org-babel-tangle 3. If there are no errors: Finished. Else: - Choose the next block to implement from the list of unresolved blocks. - Rerun from "1." In the current implementation, the first unresolved code block stops at the `error' statement. Idea Instead of throwing an error, just a warning should be given. A simple implementation could be replacing, in ob.el, `org-babel-expand-noweb-references', (error "%s" (concat (org-babel-noweb-wrap source-name) "could not be resolved (see " "`org-babel-noweb-error-langs')")) by (progn (lwarn 'tangle :warning "%s" (concat (org-babel-noweb-wrap source-name) " could not be resolved (see " "`org-babel-noweb-error-langs')")) "") (the (progn-wrapping) is needed to ensure the enclosing if statement returns a string as expected by `split-string'). The solution has the weakness though, that the warning buffer doesn't show up automatically (due to the save-excursion I assume, so probably the warnings should be thrown in one go /after/ the save excursion and be collected into a list until then. (Multiple advantages: `add-to-list' can take care of multipli occuring warnings and a single warning is more clear by far then several warnings). king regards, Yu 2012/1/30 Eric Schulte : > Yu writes: > >> I tried my test file just again with a fresh pull from git: >> >> : `cat << file1 >> file2' >> now expands as expected, but otherwise I don't see a change. Because I >> thought, well, maybe it's language specific, I made a new example. >> >> == test.org == >> #+begin_src emacs-lisp :tangle test.out :noweb tangle >> (progn >> <> >> <> >> (setq << 1 >> 2) >> (setq <> 1) >> ) >> #+end_src >> #+begin_src emacs-lisp :noweb-ref task1 :noweb tangle >> (princ "Hallo Welt!\n") >> #+end_src >> >> >> exports to >> == test.out == >> >> (progn >> (princ "Hallo Welt!\n") >> >> (setq << 1 >> 2) >> (setq 1) >> ) >> == >> >> still without any error message. >> > > When I add emacs-lisp to the `org-babel-noweb-error-langs' variable then > errors are raised for both <> and <>. > > #+BEGIN_SRC emacs-lisp > (add-to-list 'org-babel-noweb-error-langs "emacs-lisp") > #+END_SRC > >> >> As for the (here pretty artificial) case of "<>", I suppose >> avoiding that problem would require being able to suppress the special >> meaning of the construct, which would render the source less readable, >> so I guess one will just want to avoid this clash (e.g. inserting the >> spaces in shell scripts before/after the filename in a "cmd << EOF >> >> target" construct, so here your solution is certainly sufficient for >> all but very exotic cases :-) >> > > Also, see the recent emails on list in which the ability to set custom > alternatives for << and >> we added. The example used in the email was > the utf8 symbols « and » which should not occur in code. > > Best, > >> >> Suggestion >> For cases, where a corresponding code block is not found: It would >> probably help in debugging and prevent compilers/interpreters from >> ignoring the missing code, if instead of an empty string, the >> "<>" construct itself was inserted, i.e. effectively not expanded >> at all. E.g. my sample code would result in the lisp interpreter >> trying to get the value for an undefined variable "<>", which >> would be a quite obvious cause of failure. >> >> kind regards, Yu
[O] "noweb-ref": Limiting scope of definitions?
Hello! Scenario - * Maintain a potentially long org file as an appendix. * In this appendix, many independent scripting tasks will be documented. * Each such scripting task has similiar partial tasks, e.g. imports, "settings", ... In such a case, many independent scripts may contain a block "<>" or something or something to the same effect, i.e. an overlap of definitions could be avoided only by some sort of scoping: (a) manually, e.g. by prefixing the names with a script-specific string (e.g. <>. While this is flexible (i.e. allows reuse of code from other script), it also reduces the readability of the NOWEB code). (b) providing some sort of scoping, e.g. declaring definitions section-local. Implementation Idea -- A simple implementation, maintaining the flexibility of the manual solution, would be to create a header argument like ":noweb-prefix", that effectively just adds a prefix to the noweb reference names (both in declaring the block (#+name, :noweb-ref) and in using it (<>)), unless such a prefix is explicitly specified. This could then be set as needed, for specific blocks or subtrees (as property) or any mixture of such. A prefix would then be recognized by a delimiter string to be specified. This solution would also be downward compatible with existing files, as the syntax for recognizing a prefix would be relevant only when deciding whether to apply an explicitly introduced ":noweb-prefix".
[O] Variable settings in .emacs VS cross device portability.
Hello! I was wondering if there is a possibility to make org-files fully portable in behaviour (especially when exporting) between different emacs installations. When reading the mailing list or other writing about org-mode, commonly suggestions of the type "just add (setq org-foo bar) to your .emacs". This however creates a dependency on the local setup of the variables, which likely will be a problem, when sharing the file with someone. My current solution is to use a template file with #+BIND: and #+PROPERTY: lines in a setup section rather than setting anything in configuration files. However, is there some way to turn a user-variable dependent file into a portable file? I was thinking of something along the lines of "dumping user-specified variables into a list of #+BIND lines" and, if necessary, the magic "-*- var: value -*-" line at the start of the file (or, less elegant because of spreading options across different positions in the file) the commented "local variables" structure near the end of the file. The latter two variants only apply if I am right about #+BIND lines applying only during export (whereas the magic emacs lines should create buffer-local bindings). king regards, Yu
[O] [BUG]? \\ and `fill-paragraph'
Hello! When using "\\" to force linebreaks, these potentially get lost when reformatting the paragraph with Alt+Q (fill paragraph). Given an input : - long sentence long sentence :long sentence long sentence :long sentence long sentence :long sentence: \\ :Next line. pressing Alt+Q (`fill-paragraph') I'd expect to get : - long sentence long sentence long sentence long sentence long :sentence long sentence long sentence: \\ :Next line. but what I get is : - long sentence long sentence long sentence long sentence long :sentence long sentence long sentence: \\ Next line. This is a problem especially as a "\\" anywhere but at the end of the line is exported literally (i.e. `fill-paragraph' changes both the appearance in emacs and in exported formats). The Problem occurs in the opposite direction too: If a "\\" is m e a n t to occur literally it can end up at the end of a line and thus be interpreted as a line break. The problem can be partially avoided by marking each "line" and /then/ pressing Alt+Q, but it is inconvinient and hinders fille-wide reformatting (e.g. when the variable `fill-column' has changed).
Re: [O] Marking specific elements for folding?
Hello! Thanks for the suggestion, but sadly it doesn't entirely fit my intention; The subheadings in particular kill the purpose of hiding, because it makes something, of which I want only a "here is something folded" indication in a full text view show up in the content view and forces me to introduce subheadings, were I'd rather not have any (after all, overstructuring is as much a diversion from the actual workflow as understructuring). As an alternative (and when the stuff is too unimportant for the main document but still should be exportable as a separate pdf), outsourcing parts to an external org file would be okay too, but there I did not yet find a possibility to refer to a table in a totally different file, e.g. * There is a data table in the main file. * In a child file I want to do some processing using Babel (in particular with gnuplot, but maybe also python, elisp... depending on the case). Here I want to avoid having to copy the tables back and forth, but would rather directly use the data from the main file in the child file (in order to avoid having outdated data in the child file). HOWEVER: For the case where I really just want to hide parts of the documents, that will never be exported as a document and usually shouldn't be visible while editing, I found a solution right now, using the /drawers/ functionality. : # .. Must add PROPERTIES drawer, because otherwise : # .. tree local property definitions will be exported as text. : #+DRAWERS: PROPERTIES HIDDEN : : * Hello World : : #+TBLNAME: hello-world-table : | This is a data table | : : # .. This block is folded to just : # .. :HIDDEN:... : # .. unless explicitly unfolded. : :HIDDEN: : #+BEGIN_SRC gnuplot :var data=hello-world-table :file foo.pdf :<"fold that block" header argument> : set term pdfcairo mono : plot data using 1:2 blablabla : #+END_SRC : :END: : : And this table looks like [[foo.pdf]] when folded. king regards, Yu 2012/1/27 Eric S Fraga : > Yu writes: > >> Hello! >> >> I was wondering, if there is a way to mark specific elements for >> staying folded unless explicitly shown. Reading the manual I only >> found possibilities to control the global folding of sections and >> blocks in general. >> >> However, what I want to do is: >> - Embed a table of numerical data in my org-mode file. >> - Perform calculations on the data, using the spread sheet capabilities. >> - Plot the data, preferably using a (probably lengthy) gnuplot script. >> - Export only the result graph. >> >> However, the calculations are usually not wanted to be seen, when >> looking at the file, so I'd like to specify, that this specific table >> and this specific gnuplot code block are to be folded by default. >> >> Is there some way to achieve this? > > If you are not planning on exporting the data and code, you can put them > into a subheading and "COMMENT" it out. I do this frequently. See the > attached file for a simple example. The really nice thing, for me, is > that you can have the results appearing *before* the data and > code... This is not necessarily so long as you can put the results in > some other heading, say. > > > > HTH, > eric > > -- > : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.92.1 > : using Org-mode version 7.8.03 (release_7.8.03.243.g0e7f) >
[O] Marking specific elements for folding?
Hello! I was wondering, if there is a way to mark specific elements for staying folded unless explicitly shown. Reading the manual I only found possibilities to control the global folding of sections and blocks in general. However, what I want to do is: - Embed a table of numerical data in my org-mode file. - Perform calculations on the data, using the spread sheet capabilities. - Plot the data, preferably using a (probably lengthy) gnuplot script. - Export only the result graph. However, the calculations are usually not wanted to be seen, when looking at the file, so I'd like to specify, that this specific table and this specific gnuplot code block are to be folded by default. Is there some way to achieve this?
[O] Absolute paths in exported files
Hello! An older topic was here: http://lists.gnu.org/archive/html/emacs-orgmode/2010-01/msg00573.html The problem seems to persist as of now for latex (and thus pdf) export. The results are sort of diffuse though. I am working with emacs on Cygwin using the latest git-version and native Windows "Adobe Reader" and "Sumatra PDF" as PDF Viewers. * Apparently [[file:file]] is exported as \href{file://.file}{file:file} (note the extra period) * The same happens with [[./file]] and other local paths like [[file:plots/somefile.pdf]] * For some reason sometimes relative paths get exported as absolute paths. Examples: [[file:/labbook.org]] => \href{file://./labbook.org}{file:/labbook.org} [[./labbook.org]] => \href{file:///absolute/path/to/labbook.org}{./labbook.org} [[./plot/test.plt]] => \href{file://../plot/test.plt}{./plot/test.plt} [[/labbook.org]] => \href{file://./labbook.org}{/labbook.org} In another org file: [[./local.plt]] => \href{file://../local.plt}{./local.plt} [[file:local.org]] => \href{file://.local.org}{file:local.org} [[./local.org]] => \href{file://../local.org}{./local.org} Also: * file://relative/path - style urls fail to be opened (adobe reader passes it to the browser, the browser treats it as absolute path). Might also be related to the windows environment, but a PDF should be portable anyway. * Researching the problem, I read that hyperref's \href doesn't support relative paths to begin with. Any ideas? It works well for html export and for use within the org-mode buffer, but it would be nice if the links in the PDF file could support local files properly too (though I'm not sure if the viewers even support this). kind regards, Yu
Re: [O] Syntax error warnings? (Especially important with :noweb-ref's)
Hello again! I thought about the *noweb* part again. I tried the following: == #+begin_src sh :tangle test.out :noweb tangle <> cat << test.org >> test.out2 #+end_src #+begin_src sh :noweb-ref task1 echo "hello world" #+end_src == The tangled output file "test.out" looked like this: == /bin/sh echo "hello world" cat test.out2 == i.e. the syntactically valid "<< test.org >>" construct was omitted. Thus a separate syntax for forcing a literal "<<" in the tangled output is needed anyway (if not yet implemented) and if so, warning about undefined code blocks should be possible too. The big relevance of warning about undefined and never used code blocks struck me, when recently I tried to use it again. The natural work flow to me would have been to write something like : The task at hand has an overall structure : #+begin_src python :tangle foo.py :noweb tangle : <> : <> : <> : #+end_src When proceeding after this however I would have to keep in mind open tasks or (slightly better) to instantly create TODO sections for said blocks. However, having this order of working imposed on me sort of defeats the purpose for my understanding. I'd rather prefer to do an `M-x org-babel-tangle' tell me, that I forgot to implement one of the partial tasks, rather than having to find out missing code blocks from the output file (where, as mentioned, they result in "nothing" rather than an unresolved "<<...>>" construct). kind regards, Yu 2012/1/14 Eric Schulte : > Yu writes: > >> Hello! >> >> I was wondering, if there is a way to get warnings for typos (e.g. >> when specifying invalid properties or header arguments). It can just >> easily happen that I mix up e.g. ":exports" and ":export" (though >> that's probably a very harmless example). >> > > While there is currently no way to do this there are two related > functions which should help. > > ,[org-babel-view-src-block-info] bound to C-c C-v I > | org-babel-view-src-block-info is an interactive Lisp function in > | `ob.el'. > | > | (org-babel-view-src-block-info) > | > | Display information on the current source block. > | This includes header arguments, language and name, and is largely > | a window into the `org-babel-get-src-block-info' function. > ` > > and > > ,[org-babel-check-src-block] bound to C-c C-v c > | org-babel-check-src-block is an interactive Lisp function in `ob.el'. > | > | (org-babel-check-src-block) > | > | Check for misspelled header arguments in the current code block. > ` > > This problem is not trivial because new language are permitted to create > and use *any* header arguments they like, so there are no /wrong/ header > arguments, there are only /suspicious/ header arguments (like the > :exports option you suggest). The above function reports any suspicious > header arguments. Perhaps there would be a way to integrate the above > function with flyspell for automatic highlighting of suspicious header > arguments. I'll put looking into such integration on my long-term Org > task queue. > >> >> More important it gets though, when trying to use the literate >> programming facilities. >> >> Say I have a source code >> >> #+begin_src sh :noweb tangle :tangle foo.sh >> <> >> #+end_src >> #+begin_src sh :noweb-ref fo >> echo '... how are you?'; >> #+end_src >> >> then tangling would run through without any indication of the typo in >> the name of the "foo" block. Such errors might be hard to debug, >> because there is no indication of the error, maybe nothing other than >> runtime errors. >> >> An error message for the /use/ of undefined references only wouldn't >> avoid such problems either, e.g. consider >> >> #+begin_src sh :noweb tangle :tangle foo.sh >> <> >> #+end_src >> #+begin_src sh :noweb-ref foo >> echo 'Hello World...'; >> #+end_src >> #+begin_src sh :noweb-ref fo >> echo 'Hello World...'; >> #+end_src >> >> where the only detectable error is, that "fo" was never used anywhere. >> >> A similiar question (though without the second part) was asked here: >> http://lists.gnu.org/archive/html/emacs-orgmode/2009-11/msg00273.html >> As far as I can tell, it stands unanswered. >> > > Yes, although in many languages const
[O] Syntax error warnings? (Especially important with :noweb-ref's)
Hello! I was wondering, if there is a way to get warnings for typos (e.g. when specifying invalid properties or header arguments). It can just easily happen that I mix up e.g. ":exports" and ":export" (though that's probably a very harmless example). More important it gets though, when trying to use the literate programming facilities. Say I have a source code #+begin_src sh :noweb tangle :tangle foo.sh <> #+end_src #+begin_src sh :noweb-ref fo echo '... how are you?'; #+end_src then tangling would run through without any indication of the typo in the name of the "foo" block. Such errors might be hard to debug, because there is no indication of the error, maybe nothing other than runtime errors. An error message for the /use/ of undefined references only wouldn't avoid such problems either, e.g. consider #+begin_src sh :noweb tangle :tangle foo.sh <> #+end_src #+begin_src sh :noweb-ref foo echo 'Hello World...'; #+end_src #+begin_src sh :noweb-ref fo echo 'Hello World...'; #+end_src where the only detectable error is, that "fo" was never used anywhere. A similiar question (though without the second part) was asked here: http://lists.gnu.org/archive/html/emacs-orgmode/2009-11/msg00273.html As far as I can tell, it stands unanswered. On a side note: What is the customary way to mention the noweb-relevant name of a source block in the html/pdf export? After all, if a code-block states : <> : <> the reader needs to know, which code blocks define these. kind regards, Yu
[O] Quoting characters?
Hello! When working with Org-mode I sometimes run into oddities, when a character I need clashes with org-mode syntax. Is there a way to avoid this? Examples would be: Writing a macro that expands to `$\neg$': #+macro: not $\neg$ expands to $ eg$ even if I write it as \\neg. Writing the macro in the C-c C-' buffer produces \n, but when editing it again, it is displayed as a newline. Similiarily, I found no way to have "\^" or "\_" appear in the export, when I wanted to write about escaping ^ and _ as =\^= and =\_= respectively. Here as well, writing multiple backslashes wouldn't change the output. Maybe related, I found that when editing an block : #+foo: bar : This is an org-mode example with C-c C-', the result text will be : ,#+foo: bar : This is an org-mode example The extra comma generated will still be there also in the C-c C-' editing buffer. In a source code block, that is declared to be of the language "org", this behaviour doesn't appear, but it reappears for other languages. When exporting to html or pdf, the comma isn't present for "src" blocks, but it is for the "colon" blocks. kind regards, Yu
[Orgmode] A bug of org-freemind.el in org-mode package 3.34c
It seems in the function of org-freemind-write-mm-buffer, in the following code segment, the treatment of sub-node level may have some problem. If the level is one level more than its parent's level, the function will abort, abandoning the expert. I'd wish that it would be more robust to do the export regardless the unusual level number, and just give clearer warning. (when (> next-level current-level) (if (not (and org-odd-levels-only (/= (mod current-level 2) 0) (= next-level (+ 2 current-level (setq skipping-odd nil) (setq skipping-odd t) (setq skipped-odd (1+ skipped-odd))) (unless (or (= next-level (1+ current-level)) skipping-odd) (if (or org-odd-levels-only (/= next-level (+ 2 current-level))) (error "Next level step > +1 for node ending at line %s" (line-number-at-pos)) (error "Next level step = +2 for node ending at line %s, forgot org-odd-levels-only?" (line-number-at-pos))) )) Attached is an example to demonstrate the problem. I'd like to know the author's (Lennart Borgman) intension before I attempt to modify it. Yu Shen yubrs...@gmail.com test.org Description: test.org ___ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[Orgmode] Inline Latex Fragment in html export
Hi everyone, When I use inline latex in a org file like $a=b^2$ or \( a=b^2 \) and export it with C-c C-e b, the formula is not inline. Instead it is displayed in a new line and centered. Do you have any idea about it? Thank you! Yu Zhao ___ 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] word wrapping inside org table
Hello everyone, Is it possible to do word wrapping inside org table as MS Word did? I know that one table mode can do this. (http://www.emacswiki.org/emacs/TableMode) Best wishes, Yu Zhao ___ 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] About grammar highlight
Hello everyone, I'm beginner of org-mode. I was using Muse mode. I found org mode the day before yesterday and decided to use it instead of Muse yesterday. Because I think I can get with org what I could with muse and even more. Moreover, it is easier to manipulate. My question is if it is possible to use htmlize.el to enable grammar highlight like muse does while publishing html. Is it possible to use pgf/tikz package? Best wishes, Yu Zhao ___ 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