Re: [O] macro replacement in code block?
Thanks so much. It sort of works but with a bit of work-around: 1) tangle works fine 2) for export, I had to move the > ,#+MACRO: SEC_FOO lines out of the code block. If I didn’t and tried to eval that block, I got the error No org-babel-execute function for org! But I think this will do what I need. Of course emacs / org couldn’t have a simple preproccessor-like macro :) David Sent from my iPhone > On Nov 1, 2017, at 9:17 AM, Kaushal Modiwrote: > >> On Wed, Nov 1, 2017 at 11:51 AM Kaushal Modi wrote: >> I still don't have a fully working solution (see below). Hopefully someone >> can help figure out the reason for "Invalid read syntax: #" error. > > OK, I found a workaround. Below solution works: > > 1. Eval the =org-macros= block once (=C-c C-c=) >- Always use that =org-macros= block to define the Org macros for this > file. >- Hitting =C-c C-c= will insert those macros in this file. >- This block is reused as a noweb-ref in other blocks.. so keeping just > this > block as a source for all Org macros will be convenient. > 2. Then export that file (=C-c C-e h o=) > > = > #+BEGIN_SRC org :noweb-ref org-macros :results output replace :exports none > ,#+MACRO: SEC_FOO Foo Topic > ,#+MACRO: SEC_BAR Bar Topic > #+END_SRC > > #+NAME: ehdr > #+BEGIN_SRC emacs-lisp :var macro="n" :noweb yes :results raw :exports none > (with-temp-buffer > (insert " > <> > \n") > (let ((start (point))) > (insert "// ---\n") > (insert (concat "// {{{" macro "}}}")) > (org-mode) > (org-macro-replace-all > (append org-macro-templates org-export-global-macros)) > (buffer-substring-no-properties start (point-max > #+END_SRC > > * Section 1: {{{SEC_FOO}}} > #+BEGIN_SRC verilog :noweb yes > < > > parameter A = 1; > #+END_SRC > > * Section 2: {{{SEC_BAR}}} > #+BEGIN_SRC verilog :noweb yes > < > > parameter A = 1; > #+END_SRC > = > -- > Kaushal Modi
Re: [O] macro replacement in code block?
> On Oct 31, 2017, at 5:32 PM, Kaushal Modi <kaushal.m...@gmail.com> wrote: > > On Tue, Oct 31, 2017, 7:14 PM David Rogoff <da...@therogoffs.com > <mailto:da...@therogoffs.com>> wrote: > Hi. > > Hello. > > I’m trying to clean it up by using orgmode macros. However, it seems like > these are not replaced when inside code blocks. > > Do you have a minimal example of what you'd like to "macrofy" in the verilog > code blocks? Pretty simple text substitution. Something like this: #+MACRO: SEC_HDR1 // --- #+MACRO: SEC_HDR2 // #+MACRO: SEC_TITLE This section declares local types and constants * File 1 ** Section 1: {{{SEC_TITLE}}} #+BEGIN_SRC verilog {{{SEC_HDR1}}} {{{SEC_HDR2}}} {{{SEC_TITLE}}} parameter A = 1; #+END_SRC So SEC_TITLE expands in the headline and also as a comment in the tangled verilog code. It would be really great to be able to embed newlines in the macro to it could be one line / macro in the src block. > > Probably the solution is to use noweb references with arguments? See the Org > manual. Thanks - I’ll have to look into noweb. I’m not familiar with it. David
[O] macro replacement in code block?
Hi. Trying to set up a large orgmode file with source code for several files that is extracted using tangle and also exported to HTML for documentation (source is verilog-mode). It works but I’m trying to clean it up by using orgmode macros. However, it seems like these are not replaced when inside code blocks. I found a couple of references to this by searching Google but they were very terse and also referenced from orgmode function that doesn’t exist. Can anyone point me to some documentation or example? Thanks, David using gnu emacs 25.2 Linux / orgmode 9.1.2
[O] disable table in EXAMPLE or QUOTE block
I’m trying to draw an ASCII picture in a BEGIN_QUOTE block. However, since it contains vertical bars, when I hit return, it formats the whole block as if it were a table. How do I stop this incorrect behavior? I tried BEGIN_EXAMPLE but it acted the same. I can work around it by using colon-space at the beginning of each line instead of begin/end block but it’s a bit ugly. Thanks - David
[O] org-mode date stamp with just month?
I can’t see how to insert a datestamp with just year and month. I’m adding an archive of various past events that I don’t have the exact date for. Thanks, David
[O] emphasis inside source block?
Sorry if this has been discussed but I wasn’t able to find info on it. I have lots of source blocks in my org files (tcl, verilog, shell-script, etc). I want to be able to highlight (e.g. *bold*) text in the code but this doesn’t work since it’s using the specified language mode instead of org mode. Is there some way to use a minor mode within source blocks that would allow this? It’s become a big problem in generating documentation. Thanks, David
Re: [O] TOC in HTML export - how to change formatting of ToDo levels?
You should be able to customize the todo class only within the TOC context with such a rule: --8---cut here---start-8--- #table-of-contents .todo { ... } --8---cut here---end---8--- Best regards, Seb Thanks for the info. This will help a bit but still doesn't address the TOC code throwing out the actual ToDo states of the headlines and making everything either .todo or .done. David
[O] TOC in HTML export - how to change formatting of ToDo levels?
Hi all. I've just started diving back into org-mode. I'm mostly using it for ToDo / Status tracking. I've been trying to change the format of the TOC entries with little success. I've figured out how to use org-export-html-style to change the CSS markup for my customized ToDo levels, but that just affects the formatting in the body of the document. The table of contents appears to ignore that. I've been digging through org-html.el and the TOC formatting (around line 1474) looks to be mostly card-coded with almost no variables to control anything. Any ToDo status of done is not marked up at all and anything else is just marked as class todo instead of the actual class of the item. Am I missing something? The only solution I've found is to write a script to fix the HTML after exporting. Any better solution? It's a very big ToDo list and I (and others who will look at the document) want to see the actual status (preferably with the CSS font/text markups) in the TOC to know which items to look into for further details. Thanks! David FYI, running emacs 24.3.1 on RHEL 5.3 and org-mode 7.9.3f
Re: [O] problem with orgstruct/outline-minor-mode with indented headlines
David Rogoff david at therogoffs.com writes: Hi all. I'm still trying to get orgstruct to work right. One thing I found is that I7 was getting confused with outline-magic which set up outline-minor-mode-map but not orgstruct-mode-map. I'm working inside verilog-mode, which uses the same // comment as c. So I defined outline-regexp: (setq outline-regexp \\s-*// [*]+ ) ;; any line that starts with // (possibly preceeded with whitespace) and some number of stars and a space This works fine. I needed the whitespace in front since verilog-mode indents comments along with code. The problem is when I run org-cycle on a headline. The following headline ends up on the same line (also in outline-minor-mode). TRIMMED What's going on? There's some confusion about the headline level being based on the indent and the number of stars. I'm so close, but need help figuring out this last problem. Anyone? I've been trying to learn how outline-mode works to modify the outline level, but I'm not quite there yet. I made my own versions of the outline-level function to try and see what's going on: (defun dhr-outline-level () Return the depth to which a statement is nested in the outline. Point must be at the beginning of a header line. This is actually either the level specified in `outline-heading-alist' or else the number of characters matched by `outline-regexp'. (interactive) (or (cdr (assoc (match-string 0) outline-heading-alist)) (- (match-end 0) (match-beginning 0 (defvar dhr-outline-level 'dhr-outline-level *Function of no args to compute a header's nesting level in an outline. It can assume point is at the beginning of a header line and that the match data reflects the `outline-regexp'.) (defun dhr-disp-ol () (interactive) (message outline level = %d (funcall dhr-outline-level)) ) I'm close but still not quite there and could really use a little help! Again, I had to add variable whitespace to the beginning of outline-regex since verilog-mode indents comments. I want to be able to adjust the outline-level based on where // starts, not from the beginning of the line. Thanks in advance for any help on this! This really makes editing my code so much easier and if I can get this last bit to work right I can convince a bunch of other ASIC engineers to use it and emacs! David
[O] problem with orgstruct/outline-minor-mode with indented headlines
Hi all. I'm still trying to get orgstruct to work right. One thing I found is that I was getting confused with outline-magic which set up outline-minor-mode-map but not orgstruct-mode-map. I'm working inside verilog-mode, which uses the same // comment as c. So I defined outline-regexp: (setq outline-regexp \\s-*// [*]+ ) ;; any line that starts with // (possibly preceeded with whitespace) and some number of stars and a space This works fine. I needed the whitespace in front since verilog-mode indents comments along with code. The problem is when I run org-cycle on a headline. The following headline ends up on the same line (also in outline-minor-mode). For example, in plain org mode I have this: * head 1 ** head 2 *** head 3 head 3 text head 3 text ** head 2b head 2b text head 2b text I now run org-cycle on headline head 2 and it looks like this: * head 1 ** head 2... ** head 2b head 2b text head 2b text p.s. - is there a way to copy/export exactly what the collapse buffer looks like? I had to manually create this since copy/paste of the text includes the hidden parts. If I change to verlog-mode with orgstruct minor mode and add // at the beginning of headlines, everything is still good: // * head 1 // ** head 2 // *** head 3 head 3 text head 3 text // ** head 2b head 2b text head 2b text and // * head 1 // ** head 2 // ** head 2b head 2b text head 2b text Where it breaks is the case of indented comments: // * module declaration module a ( // * ports // ** inputs input b, input c, // ** outputs output d, output e ); // module code assign d = b c; assign e = d | e; // * end module declaration endmodule // a If I run org-cycle on headline ports I get this: // * module declaration module a ( // * ports // * end module declaration endmodule // a Instead of this: // * module declaration module a ( // * ports // * end module declaration endmodule // a Likewise, collapsing inputs gives this: // * module declaration module a ( // * ports // ** inputs // ** outputs output d, output e ); // module code assign d = b c; assign e = d | e; // * end module declaration endmodule // a Not this: // * module declaration module a ( // * ports // ** inputs ... // ** outputs output d, output e ); // module code assign d = b c; assign e = d | e; // * end module declaration endmodule // a What's going on? There's some confusion about the headline level being based on the indent and the number of stars. I'm so close, but need help figuring out this last problem. Thanks, David
Re: [O] Minor org mode for achieve code folding effects
David Rogoff david at therogoffs.com writes: Carlos Russo mestre.adamastor at gmail.com writes: I have used both Carsten's and Eric's solution, as well as hideshow-org (https://github.com/secelis/hideshow-org), which works rather well and deserves a mention. Expanding a bit on Carsten's post: Tassilo Horn wrote some convenience functions to set the outline minor mode regexps to correspond to the current comment syntax. Thus, if I'm (for instance) in shell-script mode, # * and # ** become the outline level 1 and 2 markers. I have all this working and it's great. But... This is using outline-minor- mode. Like Giovanni, who started this thread, I'm used to orgmode, which is a little different although it uses outline mode. I tried hacking the code to use orgstruct-mode, which is the minor mode version of orgmode. I got a little figured out, but got lost. I would think all of Tassilo's code to automatically set up outline-regexp would still be valid, but I'm not doing something right. I saw Carsten's message to look at the visibility cycling and understand that, but the keymaps are not working right and the outline-regexp isn't being set right. I've worked around the latter with a quick function I can call from the file buffer. However, I don't know what's going on with the keymap. It looks right. For example, c-h k TAB gives this: tab runs the command orgstruct-hijacker-command-102, which is an interactive Lisp function. It is bound to tab. (orgstruct-hijacker-command-102 ARG) In Structure, run `org-cycle'. Outside of structure, run the binding of `[(tab)]' or ` '. However, it doesn't seem to recognize when it's in a structure. M-x org-cycle works as does M-x org-global-cycle. I only need this for emacs-lisp-mode and verilog-mode so I simplified Tassilo's code (for now) like this: (when (eq major-mode 'emacs-lisp-mode) (setq outline-regexp ;; [*]+ )) (when (eq major-mode 'verilog-mode) (setq outline-regexp \\s-*// [*]+ )) Anyone?
Re: [O] Minor org mode for achieve code folding effects
Carlos Russo mestre.adamastor at gmail.com writes: I have used both Carsten's and Eric's solution, as well as hideshow-org (https://github.com/secelis/hideshow-org), which works rather well and deserves a mention. Expanding a bit on Carsten's post: Tassilo Horn wrote some convenience functions to set the outline minor mode regexps to correspond to the current comment syntax. Thus, if I'm (for instance) in shell-script mode, # * and # ** become the outline level 1 and 2 markers. I have all this working and it's great. But...This is using outline-minor-mode. Like Giovanni, who started this thread, I'm used to orgmode, which is a little different although it uses outline mode. I tried hacking the code to use orgstruct-mode, which is the minor mode version of orgmode. I got a little figured out, but got lost. I would think all of Tassilo's code to automatically set up outline-regexp would still be valid, but I'm not doing something right. I saw Carsten's message to look at the visibility cycling and understand that, but the keymaps are not working right and the outline-regexp isn't being set right. I've worked around the latter with a quick function I can call from the file buffer. However, I don't know what's going on with the keymap. It looks right. For example, c-h k TAB gives this: tab runs the command orgstruct-hijacker-command-102, which is an interactive Lisp function. It is bound to tab. (orgstruct-hijacker-command-102 ARG) In Structure, run `org-cycle'. Outside of structure, run the binding of `[(tab)]' or `'. However, it doesn't seem to recognize when it's in a structure. M-x org-cycle works as does M-x org-global-cycle. I only need this for emacs-lisp-mode and verilog-mode so I simplified Tassilo's code like this: (when (eq major-mode 'emacs-lisp-mode) (setq outline-regexp ;; [*]+ )) (when (eq major-mode 'verilog-mode) (setq outline-regexp \\s-*// [*]+ )) Help Please! Thanks! David
Re: [O] text background when exporting as HTML
Hi all. I'm using orgmode for outlines and documentation. Since no one else I work with does this, I export to HTML which generally works fine. However, I've got a problem with embedded code samples using #+BEGIN_SRC / #+END_SRC. The faces for the source code are set up for a black background. The exported HTML picked up the face colors, but the background is white, so they're mostly unreadable. Is there a (hopefully simple) way to tell the HTML export to specify a black background for these blocks? FYI, emacs 23.3.1, REH Linux, orgmode 7.5 Thanks, David Check out the info manual: (org) CSS support This might be the easiest way. -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.92.1 Thanks Eric. I searched around the mailing list archives and found this: http://thread.gmane.org/gmane.emacs.orgmode/19605/focus=19633 I just added this to the beginning of my org file and it works great: #+STYLE: style pre { background-color: #191919 } pre { color:#00FF00 } /style This matches the colors I use for the default font in emacs. David
Re: [O] Minor org mode for achieve code folding effects
Carlos Russo mestre.adamastor at gmail.com writes: I have used both Carsten's and Eric's solution, as well as hideshow-org (https://github.com/secelis/hideshow-org), which works rather well and deserves a mention. Expanding a bit on Carsten's post: Tassilo Horn wrote some convenience functions to set the outline minor mode regexps to correspond to the current comment syntax. Thus, if I'm (for instance) in shell-script mode, # * and # ** become the outline level 1 and 2 markers. This is great info! I was just looking for this in the last couple of days and appreciate everyone's code since it's way beyond my elisp abilities. I like this a lot more than the folding.el I had been using since I already use orgmode. However, I've got a question: I'm using this with verilog-mode which uses // to start comments. The problem is that when I indent my file, the comments indent too and it seems that output-minor-mode (and, I assume, orgmode) only recognize headings that start in column 0. How/where can I change this so it will recognize any line that is whitepace followed by the comment-start? Thanks! David
Re: [O] Minor org mode for achieve code folding effects
David Rogoff January 10, 2012 4:34 PM Carlos Russo mestre.adamastor at gmail.com writes: I have used both Carsten's and Eric's solution, as well as hideshow-org (https://github.com/secelis/hideshow-org), which works rather well and deserves a mention. Expanding a bit on Carsten's post: Tassilo Horn wrote some convenience functions to set the outline minor mode regexps to correspond to the current comment syntax. Thus, if I'm (for instance) in shell-script mode, # * and # ** become the outline level 1 and 2 markers. This is great info! I was just looking for this in the last couple of days and appreciate everyone's code since it's way beyond my elisp abilities. I like this a lot more than the folding.el I had been using since I already use orgmode. However, I've got a question: I'm using this with verilog-mode which uses "// " to start comments. The problem is that when I indent my file, the comments indent too and it seems that output-minor-mode (and, I assume, orgmode) only recognize headings that start in column 0. How/where can I change this so it will recognize any line that is whitepace followed by the comment-start? This works, but is probably not the best way to do it: (defun th-outline-regexp () "Calculate the outline regexp for the current mode." (let ((comment-starter (replace-regexp-in-string "[[:space:]]+" "" comment-start))) (when (string= comment-starter ";") (setq comment-starter ";;")) (when (string= comment-starter "#") (setq comment-starter "##")) (when (eq major-mode 'verilog-mode) (setq comment-starter "\\s-*//")) ;; for verilog-mode, define comment-starter as any amount of whitespace followed by "//". This allows indented comments as outline levels (concat comment-starter " [*]+ ")))
[O] text background when exporting as HTML
Hi all. I'm using orgmode for outlines and documentation. Since no one else I work with does this, I export to HTML which generally works fine. However, I've got a problem with embedded code samples using #+BEGIN_SRC / #+END_SRC. The faces for the source code are set up for a black background. The exported HTML picked up the face colors, but the background is white, so they're mostly unreadable. Is there a (hopefully simple) way to tell the HTML export to specify a black background for these blocks? FYI, emacs 23.3.1, REH Linux, orgmode 7.5 Thanks, David
[O] multiple modes in single buffer?
I have a feeling I know the answer, but it's worth bringing up. I'd like to have multiple modes for different regions of a file. I'm using the -*- mode: org -*- as the first line of my org files. However, many of my org files contains bits of c and Verilog code. I'd like these regions to be formatted and use the faces for those modes. Is this possible? Thanks, David
Re: [O] multiple modes in single buffer?
Matt Lundin May 20, 2011 4:12 PM Yes. Source blocks and org-babel provide all sorts of ways to include bits of code (and their results/output) in an org file. (info "(org) Working With Source Code") The variables org-src-fontify-natively and org-src-tab-acts-natively might be of particular interest. Best, Matt Amazing - and it didn't take me an hour to get it set up :) Thanks, David
Re: [Orgmode] numbered outlines?
Carsten Dominik wrote: On Oct 21, 2010, at 3:02 AM, David Rogoff wrote: Thanks - that might do the job. Native would be best, of course. This could be implemented as a little module. One could just run through the outline and put overlays on the stars showing the numbers. Looking for a fun little project, anyone? :-) I'd do it, but I'm a hardware guy and my elisp expertise is really minimal! - Carsten Jeff Horn wrote: I don't know if it is an ideal solution, but you can export to ASCII using `C-c C-e a` which will dump an ascii text file with the name filename.txt into the same directory as filename.org. Outlines will have numbers in the text file. HTH, Jeff On Tue, Oct 19, 2010 at 6:40 PM, David Rogoff da...@cox.net wrote: Sorry if this is obvious, but I couldn't find anything on it. orgmode's use of asterisks for outline levels is fine when I'm working on something by myself. However, if I'm collaborating with other people, there's no good way to reference a particular outline entry. Is there a way to get org-mode to use numbering (e.g. 1, 1.1, 1.1.1 ) for outline levels? If not, how can you work with other people on an outline? Thanks, David ___ 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 ___ 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 ___ 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 ___ 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] numbered outlines?
Sorry if this is obvious, but I couldn't find anything on it. orgmode's use of asterisks for outline levels is fine when I'm working on something by myself. However, if I'm collaborating with other people, there's no good way to reference a particular outline entry. Is there a way to get org-mode to use numbering (e.g. 1, 1.1, 1.1.1 ) for outline levels? If not, how can you work with other people on an outline? Thanks, David ___ 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] numbered outlines?
Sorry if this is obvious, but I couldn't find anything on it. orgmode's use of asterisks for outline levels is fine when I'm working on something by myself. However, if I'm collaborating with other people, there's no good way to reference a particular outline entry. Is there a way to get org-mode to use numbering (e.g. 1, 1.1, 1.1.1 ) for outline levels? If not, how can you work with other people on an outline? FYI, I'm running org-mode 6.33x in emacs 23.2.1 Mac/Linux/WinXP Thanks, David ___ 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
Re: [Orgmode] numbered outlines?
Thanks - that might do the job. Native would be best, of course. Jeff Horn wrote: I don't know if it is an ideal solution, but you can export to ASCII using `C-c C-e a` which will dump an ascii text file with the name filename.txt into the same directory as filename.org. Outlines will have numbers in the text file. HTH, Jeff On Tue, Oct 19, 2010 at 6:40 PM, David Rogoffda...@cox.net wrote: Sorry if this is obvious, but I couldn't find anything on it. orgmode's use of asterisks for outline levels is fine when I'm working on something by myself. However, if I'm collaborating with other people, there's no good way to reference a particular outline entry. Is there a way to get org-mode to use numbering (e.g. 1, 1.1, 1.1.1 ) for outline levels? If not, how can you work with other people on an outline? Thanks, David ___ 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 ___ 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] wrap text in table cell?
I'm still learning org mode and have a question about table mode. Is there a way to wrap text in a cell? I search the docs I could find and the closest thing was putting N in a cell which forced that column to be N characters wide. That sort-or works, but isn't great. Am I missing something, or can org-mode not do this? Thanks, David ___ 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] emacs/org-mode on Droid?
Hi all. New org-mode convert also looking at new phones. It looks like the Moto Droid would be great for running org-mode. Has anyone ported emacs to this platform and gotten org-mode running? Thanks, David ___ 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] Re: emacs/org-mode on Droid?
On 2010-02-16 13:47:59 -0800, Tom Tobin said: On Tue, Feb 16, 2010 at 12:18 PM, David Rogoff da...@therogoffs.com wrote: Hi all. New org-mode convert also looking at new phones. It looks like theMoto Droid would be great for running org-mode. Has anyone ported emacs to this platform and gotten org-mode running? I just switched from my iPhone back to an Android phone; I came across this project: http://github.com/matburt/mobileorg-android I haven't tried it yet, though. Thanks - I'll take a look. ___ 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