Re: [O] Run lisp code in macros?

2011-04-28 Thread Christian Moe

On 4/28/11 10:56 PM, amscopub-m...@yahoo.com wrote:

Is there a way to apply text transformations to arguments in macros?

For example, say that you want to change the first argument to capital letters? 
or transpose the letters of the second argument?

How would you do that? I imagine you would have to run elisp code, perhaps 
babel is the answer?

Sample code:

#+MACRO: test Change $1 to uppercase, somehow.

* Hello World
{{{test(test phrase)}}}

Desired HTML export:

TEST PHRASE to uppercase, somehow.



Hi,

This should do it:

---

#+MACRO: test src_emacs-lisp[:results raw]{(upcase "$1")}

* Hello World

{{{test(test phrase)}}}


---


If you only want HTML output, you could also use CSS styling.


---

Another @test phrase@ 
uppercased with CSS.


---

Yours,
Christian



Re: [O] convert orgmode to docx

2011-04-28 Thread Jambunathan K
Fabian Braennstroem  writes:

> Hi Bastien,
>
> thanks for the info!
> Do you have a hint, how I could do the export in batchmode from the
> console in Linux?
>

You can use the following to convert from org to odt (with suitable
changes to the -L option).

--8<---cut here---start->8---
  emacs --batch -L "~/src/org-jambu/lisp" --eval "(progn (require 'org-odt) 
(setq org-export-headline-levels 3) (toggle-debug-on-error))" 
--visit=draftcopy.org --funcall org-export-as-odt-batch
--8<---cut here---end--->8---


ps: Refer http://orgmode.org/worg/org-faq.html#convert-to-open-office

Jambunathan K.




Re: [O] v3, with support for narrowing

2011-04-28 Thread Eric Abrahamsen
On Fri, Apr 29 2011, Nick Dokos wrote:

> Eric Abrahamsen  wrote:
>
>> On Fri, Apr 29 2011, Simon Guest wrote:
>> 
>> > At Thu, 28 Apr 2011 15:47:07 -0700,
>> > Samuel Wales wrote:
>> >> Is it possible to make it so that you can show the overlays for just a
>> >> subtree or region instead of the entire buffer?
>> >
>> > Hi Samuel,
>> >
>> > Good idea!  So I just fixed it to handle narrowing properly, so narrow
>> > to your region or subtree of interest first, and then count as usual.
>> >
>> > Attached v3 which does this.  I'm not normally this responsive, you
>> > just caught me at a good time.  ;-)
>> 
>> Is this still a good time? Because what I'd really like is
>> inclusion/exclusion tags, so that I can mark some subtrees to count, and
>> others to ignore. I tried doing this last night, based on other parts of
>> the export code, and my elisp failed. Perhaps just exclusion tags?
>> Here's hoping you still have a bit of time/interest for improvements!
>> 
>> (I'm translating a novel, not writing one, and want to keep the original
>> text out of the count. Plus I've got a bunch of research/notes sections
>> that should be excluded.)
>> 
>> If you're out of time, I'll have another whack at it, and maybe bring my
>> broken efforts to the list.
>> 
>
> The mapping API allows you to walk through the entries, filter the ones
> you want and apply a function on each remaining entry. So cribbing heavily
> from Simon's code, the following should count all the entries with tag "foo":

Nice! Seems like the mapping API could be used as the basis for this
whole functionality. Not that I'm quite volunteering yet, I'm still
working out how to make all this work…

Thanks,
Eric




Re: [O] v3, with support for narrowing

2011-04-28 Thread Nick Dokos
Eric Abrahamsen  wrote:

> On Fri, Apr 29 2011, Simon Guest wrote:
> 
> > At Thu, 28 Apr 2011 15:47:07 -0700,
> > Samuel Wales wrote:
> >> Is it possible to make it so that you can show the overlays for just a
> >> subtree or region instead of the entire buffer?
> >
> > Hi Samuel,
> >
> > Good idea!  So I just fixed it to handle narrowing properly, so narrow
> > to your region or subtree of interest first, and then count as usual.
> >
> > Attached v3 which does this.  I'm not normally this responsive, you
> > just caught me at a good time.  ;-)
> 
> Is this still a good time? Because what I'd really like is
> inclusion/exclusion tags, so that I can mark some subtrees to count, and
> others to ignore. I tried doing this last night, based on other parts of
> the export code, and my elisp failed. Perhaps just exclusion tags?
> Here's hoping you still have a bit of time/interest for improvements!
> 
> (I'm translating a novel, not writing one, and want to keep the original
> text out of the count. Plus I've got a bunch of research/notes sections
> that should be excluded.)
> 
> If you're out of time, I'll have another whack at it, and maybe bring my
> broken efforts to the list.
> 

The mapping API allows you to walk through the entries, filter the ones
you want and apply a function on each remaining entry. So cribbing heavily
from Simon's code, the following should count all the entries with tag "foo":

--8<---cut here---start->8---
(defun show-count ()
  (let ((p (point))
wc)
(when (setq wc (get-text-property p :org-wc))
  (org-wc-put-overlay wc (funcall outline-level)))
(when org-remove-highlights-with-change
  (org-add-hook 'before-change-functions 'org-wc-remove-overlays
nil 'local

(defun count-foo ()
  (interactive)
  (let (bmp (buffer-modified-p))
(org-wc-count-subtrees)
(org-map-entries 'show-count "+foo" 'file)
(set-buffer-modified-p bmp)))
--8<---cut here---end--->8---

Nick



Re: [O] v3, with support for narrowing

2011-04-28 Thread Eric Abrahamsen
On Fri, Apr 29 2011, Simon Guest wrote:

> At Thu, 28 Apr 2011 15:47:07 -0700,
> Samuel Wales wrote:
>> Is it possible to make it so that you can show the overlays for just a
>> subtree or region instead of the entire buffer?
>
> Hi Samuel,
>
> Good idea!  So I just fixed it to handle narrowing properly, so narrow
> to your region or subtree of interest first, and then count as usual.
>
> Attached v3 which does this.  I'm not normally this responsive, you
> just caught me at a good time.  ;-)

Is this still a good time? Because what I'd really like is
inclusion/exclusion tags, so that I can mark some subtrees to count, and
others to ignore. I tried doing this last night, based on other parts of
the export code, and my elisp failed. Perhaps just exclusion tags?
Here's hoping you still have a bit of time/interest for improvements!

(I'm translating a novel, not writing one, and want to keep the original
text out of the count. Plus I've got a bunch of research/notes sections
that should be excluded.)

If you're out of time, I'll have another whack at it, and maybe bring my
broken efforts to the list.

Thanks,

Eric




[O] v3, with support for narrowing

2011-04-28 Thread Simon Guest
At Thu, 28 Apr 2011 15:47:07 -0700,
Samuel Wales wrote:
> Is it possible to make it so that you can show the overlays for just a
> subtree or region instead of the entire buffer?

Hi Samuel,

Good idea!  So I just fixed it to handle narrowing properly, so narrow
to your region or subtree of interest first, and then count as usual.

Attached v3 which does this.  I'm not normally this responsive, you
just caught me at a good time.  ;-)

> Also, I have a plugin-compatible backend that will get you the /exact/
> word count (uses w3m).  If you're interested you can have it be an
> alternate backend.

I'm not that interested in higher fidelity counting.  I'm especially
interested in speed.

cheers,
Simon

;; org-wc.el
;;
;; Count words in org mode trees.
;; Shows word count per heading line, summed over sub-headings.
;; Aims to be fast, so doesn't check carefully what it's counting.  ;-)
;;
;; Simon Guest, 23/4/11
;;
;; Implementation based on:
;; - Paul Sexton's word count posted on org-mode mailing list 21/2/11.
;; - clock overlays
;;
;; v2 
;; 29/4/11
;; Don't modify buffer, and fixed handling of empty sections.
;;
;; v3
;; 29/4/11
;; Handle narrowing correctly, so partial word count works on narrowed regions.
(defun org-in-heading-line ()
  "Is point in a line starting with `*'?"
  (equal (char-after (point-at-bol)) ?*))

(defun org-word-count (beg end) 
  "Report the number of words in the Org mode buffer or selected region."
  (interactive "r")
  (unless mark-active
(setf beg (point-min)
  end (point-max)))
  (let ((wc (org-word-count-aux beg end)))
(message (format "%d words in %s." wc
 (if mark-active "region" "buffer")

(defun org-word-count-aux (beg end)
  "Report the number of words in the selected region.
Ignores: heading lines,
 blocks,
 comments,
 drawers.
LaTeX macros are counted as 1 word."

  (let ((wc 0)
(block-begin-re "^#\\\+BEGIN")
(block-end-re "^#\\+END")
(latex-macro-regexp "[A-Za-z]+\\(\\[[^]]*\\]\\|\\){\\([^}]*\\)}")
(drawers-re (concat "^[ \t]*:\\("
(mapconcat 'regexp-quote org-drawers "\\|")
"\\):[ \t]*$"))
(drawers-end-re "^[ \t]*:END:"))
(save-excursion
  (goto-char beg)
  (while (< (point) end)
(cond
 ;; Ignore heading lines.
 ((org-in-heading-line)
  (forward-line))
 ;; Ignore blocks.
 ((looking-at block-begin-re)
  (re-search-forward block-end-re))
 ;; Ignore comments.
 ((org-in-commented-line)
  (forward-line))
 ;; Ignore drawers.
 ((looking-at drawers-re)
  (re-search-forward drawers-end-re nil t))
 ;; Count latex macros as 1 word, ignoring their arguments.
 ((save-excursion
(backward-char)
(looking-at latex-macro-regexp))
  (goto-char (match-end 0))
  (setf wc (+ 2 wc)))
 (t
  (progn
(and (re-search-forward "\\w+\\W*" end 'skip)
 (incf wc)))
wc))

(defun org-wc-count-subtrees ()
  "Count words in each subtree, putting result as the property :org-wc on that 
heading."
  (interactive)
  (remove-text-properties (point-min) (point-max)
  '(:org-wc t))
  (save-excursion
(goto-char (point-max))
(while (outline-previous-heading)
  (save-restriction
(org-narrow-to-subtree)
(let ((wc (org-word-count-aux (point-min) (point-max
  (put-text-property (point) (point-at-eol) :org-wc wc)
  (goto-char (point-min)))

(defun org-wc-display (beg end total-only)
  "Show subtree word counts in the entire buffer.
With prefix argument, only show the total wordcount for the buffer or region
in the echo area.

Use \\[org-wc-remove-overlays] to remove the subtree times.

Ignores: heading lines,
 blocks,
 comments,
 drawers.
LaTeX macros are counted as 1 word."
  (interactive "r\nP")
  (org-wc-remove-overlays)
  (unless total-only
(let ((bmp (buffer-modified-p))
  wc 
  p)
  (org-wc-count-subtrees)
  (save-excursion
(goto-char (point-min))
(while (or (and (equal (setq p (point)) (point-min))
(get-text-property p :org-wc))
   (setq p (next-single-property-change
(point) :org-wc)))
  (goto-char p)
  (when (setq wc (get-text-property p :org-wc))
(org-wc-put-overlay wc (funcall outline-level
;; Arrange to remove the overlays upon next change.
(when org-remove-highlights-with-change
  (org-add-hook 'before-change-functions 'org-wc-remove-overlays
nil 'local)))
(set-buffer-modified-p bmp)))
  (if mark-active
  (org-word-count beg end)
(org-word-count (point-min) (point-max

(defvar org-wc-overlays nil)
(make-variable-buffer-loc

Re: [O] syntax bugs in footnotes

2011-04-28 Thread Samuel Wales
3 bugs confirmed with default export.

-- 
The Kafka Pandemic:
  
http://thekafkapandemic.blogspot.com/2010/12/welcome-to-kafka-pandemic-two-forces_9182.html
I support the Whittemore-Peterson Institute (WPI)
===
I want to see the original (pre-hold) Lo et al. 2010 NIH/FDA/Harvard MRV paper.



[O] [PATCH] org-preview-latex-fragment in indirect buffers

2011-04-28 Thread Darlan Cavalcante Moreira

Hello,

I frequently use indirect buffers with org but org-preview-latex-fragment
does not work when in an indirect buffer. The reason is that
org-preview-latex-fragment uses "buffer-file-name" to get the name of the
file associated with the current buffer, but this is nil for indirect
buffers.

To solve this, all its necessary is to define the function below

--8<---cut here---start->8---
(defun org-buffer-file-name ()
  "Similar to buffer-file-name, but also work on indirect buffers."
  (buffer-file-name (buffer-base-buffer))
  )
--8<---cut here---end--->8---

and replace "buffer-file-name" in the org-preview-latex-fragment by
"(org-buffer-file-name)". This works in both: "normal" buffers and indirect
buffers.

--
Darlan



Re: [O] org-src-fontify-natively makes things very, very slow

2011-04-28 Thread Eric S Fraga
Carsten Dominik  writes:

> On 21.3.2011, at 18:06, Eric S Fraga wrote:
>
>> Hello again,
>> 
>> going back to the original subject of this thread (although thanks all
>> for your inputs on yasnippet ;-), I have started working on a new
>> document and am finding the slowdown of navigation (next-line) very
>> annoying.  In this document, I have two gnuplot source blocks.
>> Navigating through them, I get the following results from elp:

[...]

>> From these timings, the font locking doesn't seem to be the issue but
>> maybe the overlays are.  However, commenting out the code that Sébastien
>> Vauban indicated:
>> 
>>> Maybe this is (partly?) due to the overlay I added:
>>> 
>>> #+begin_src emacs-lisp
>>>(overlay-put (make-overlay beg1 block-end)
>>> 'face 'org-block-background))
>>> #+end_src
>> 
>> (well, commenting out the whole condition that includes this code) makes
>> no difference at all.
>
> Did you restart Emacs?  Because if you just continued, all those
> overlays are there already.

I cannot remember.  Sorry.

>> So, I turned off =org-src-fontify-natively= and things are back to
>> normal: next-line is as fast as previous-line.  I can put up without the
>> fontification so this is what I am doing now.  
>> 
>> However, as it's a pity to lose the native fontification, it would be
>> nice to solve this problem in another way.  Can anybody suggest any
>> other thing to try?
>
> The problem with the multiple overlays that were created
> during native fontification is now fixed.  I would be interested
> to know if this improves the situation.
>
> - Carsten
>

Thanks.  I've re-enabled =org-src-fontify-natively= and will let you
know how I get on!

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.225.gbfdc9.dirty)



Re: [O] Sub-tree word count v2

2011-04-28 Thread Eric S Fraga
Simon Guest  writes:

> At Thu, 28 Apr 2011 09:34:35 +0100,
> Eric S Fraga wrote:
>> However, it would be helpful if the modification flag were not changed
>> by asking for the word count.  I don't know enough elisp to suggest what
>
>> to change but you should be able to add the text properties without
>> causing the buffer modification flag to change?  Column view, for
>> instance, doesn't do this.
>
> Hi Eric,
>
> OK, I fixed this.  Now buffer modification state is preserved.  Also
> now handles empty sections properly.
>
> Version 2 attached below.

Excellent.  Works very well indeed.  Thanks!
-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.223.g4a86.dirty)



Re: [O] revert all org buffers which changed on disk

2011-04-28 Thread Jason Dunsmore
Daniel Clemente  writes:

> Hi.
>   org-revert-all-org-buffers loads all buffers from disk even if they didn't 
> change.

FYI, there's also a package called revbufs:
http://www.neilvandyke.org/revbufs/revbufs.el

Although it's not specific to org files.

Regards,
Jason



[O] syntax bugs in footnotes

2011-04-28 Thread Samuel Wales
Latest git, Emacs 22, my blog exporter settings to HTML, which are
enclosed.  The bugs will probably work with default export.

Bug 1: commented incomplete footnote interacts with link in
later text.  Result is that comments get exported.  IMO
comments should be absolute except in the case of #+ lines.

# [fn::I will call this the status quo effect for lack of an
# existing term.  It isn't a true bias like status quo

see this.  see [[this link][this link]].  and see this too.

Bug 2: partial exporting of inline footnote after an inline
footnote.[fn::watch][fn::this]

Bug 3: closing bracket in a link closes footnote.[fn::Try
exporting [[http://google.com][google]] this.]

===

(defconst alpha-org-blog-html-buffer "alpha-org-blog.html")
;;(defconst alpha-org-wc-buffer "*alpha-org-wc*")
(defun alpha-org-blog-subtree ()
  "Copy the subtree, converted to HTML, for pasting into Blogger
as a blog post.

If there is an active region, use that instead.

No other software needs to be installed.  No temporary file is
created.

For an example of this code in action, see
http://thekafkapandemic.blogspot.com/ .

===

You have to turn off Blogger's conversion of newline to br tags
in two places in settings.  This requires the new Blogger post
editor.

The HTML code is left in a buffer.  To display it in a browser,
use M-x browse-url-of-buffer or similar.

mail2blogger is a very intriguing option here and I'd like to do
that.  Avoids the web entirely.  See comments.

===

The top level headline is not interpreted with Blogger title
semantics.  By default it is not exported at all, because Blogger
already has a title.  For both posts and pages, Blogger's title
field forms the URL and is therefore manually entered.

===

Advanced:

You can export the top level headline with :title:.  For pasting
into Blogger, I don't do this, because it shows up with what
looks like two titles.  In the future, we can make it work with
backends like mail2blogger.  Then it will have title
semantics (the top level will become the title).

In Blogger, pages are different from posts.  They are accessed by
tabs like About, Contribute, Contact.

:title: is also useful if you want to try a different strategy.
I did this for my first blog post.  You can change whether to
include title fields in Blogger settings.  You can only do this
for posts.  Turning off titles has one convenience: you don't
have to enter them manually (simply paste).  It also has two
drawbacks: (1) people who link to your post by copying that link
cannot do so (they can get it from other places, including the
URL bar and Archives in the sidebar) and (2) the URL gets formed
a litle funnily.

===

I use Blogger.com for hosted blogging instead of Wordpress.com
because Google has a better attitude toward accessibility.
"
  (interactive)

;;; todo list
;;;
;;; === mail2blogger ===
;;;
;;; I tried using mail2blogger, but the HTML got posted.  There might
;;; be a way to fix this.  How do you do an HTML email in a format
;;; that gets recognized as HTML?
;;;
;;; We want to use raw programmatic email, such as sent using msmtp
;;; or the built-in Emacs client.  The ability to do so will obviate
;;; the need to use Google's command line client or to run Emacs 23.
;;;
;;; Patch welcome.
;;;
;;; ===
;;;
;;; Another good thing to try would be to automate grabbing the source from
;;; the page automatically to compare what you just created with ediff or
;;; git diff --color-words.  This is for edits.
;;;
;;; Also, export whole blog before each post for git.  Requires post
;;; method maybe.  How to do that?
;;;
;;; Also, check for fixmes.  (Or org could check for fixmes before
;;; all export.  Is there a hook?)
;;;
;;; Also, remind you to extract big chunks of comments for possible ohter
;;; blog entries.
;;;
;;; /Also, remind you to make sure all links work and review formatting/.
;;;
;;; ===
;;;
;;; Is there HTML for a title?  I will guess not.

  ;;say about to publish editing or about to publish post.  with
  ;;mail2blogger or weblogger.el or atom, we can automate this and assume
  ;;publish.
  ;;
  ;;technically, this should be later in case you kill something inside the
  ;;note.  for some reason org adds this to the post command hook instead of
  ;;just doing it at the time.  need to get this to just do it.  maybe
  ;;call-interactively will work?  no, that does not fix it.
  ;;
  ;;(let ((k kill-ring))
  ;;(let ((c (car kill-ring)))

  ;;(org-add-note)

  ;;could add sugu here.  donekeep should be done manually.
  (save-excursion
(save-window-excursion
  ;;i have an issue with "--", which is perfect for emdash in ascii, but
  ;;gets converted to endash in html.  i'd like it to be emdash in html.
  ;;is there an option for that?

  ;;org converts headlines to html h numbers according to the level in the
  ;;org file, not the level in the region.  i prefer the latter.
  ;;
  ;;here we kludge it to do it my way.
  ;;
  ;;top 1 means that the very to

Re: [O] LaTeX beamer class text

2011-04-28 Thread John Tait
Thanks Matt. It works really well.

I need to set org-use-property-inheritance to t, so that subheadings follow
through, but it's really easy.

Cheers

John

On Wed, Apr 27, 2011 at 5:20 PM, Matt Lundin  wrote:

> John Tait  writes:
>
> > Hi
> >
> > When I export an Org file to LaTeX class beamer, much of the content
> > can be pushed off the bottom of the slide if it doesn't all fit on one
> > slide.
> >
> > Other than restricting the amount of text content under headings, is
> > there a simple way of allowing content to spill onto the next slide?
>
> In LaTeX, you can add the following option to the frame:
>
> \begin{frame}[allowframebreaks]
>
> So in org-mode, you could modify :BEAMER_envargs:.
>
> * A slide
>  :PROPERTIES:
>  :BEAMER_envargs: [allowframebreaks]
>  :END:
>
> Best,
> Matt
>


Re: [O] Sub-tree word count v2

2011-04-28 Thread Samuel Wales
This looks great, Simon.

Is it possible to make it so that you can show the overlays for just a
subtree or region instead of the entire buffer?

Also, I have a plugin-compatible backend that will get you the /exact/
word count (uses w3m).  If you're interested you can have it be an
alternate backend.

Samuel

-- 
The Kafka Pandemic:
  
http://thekafkapandemic.blogspot.com/2010/12/welcome-to-kafka-pandemic-two-forces_9182.html
I support the Whittemore-Peterson Institute (WPI)
===
I want to see the original (pre-hold) Lo et al. 2010 NIH/FDA/Harvard MRV paper.



[O] Sub-tree word count v2

2011-04-28 Thread Simon Guest
At Thu, 28 Apr 2011 09:34:35 +0100,
Eric S Fraga wrote:
> However, it would be helpful if the modification flag were not changed
> by asking for the word count.  I don't know enough elisp to suggest what
> to change but you should be able to add the text properties without
> causing the buffer modification flag to change?  Column view, for
> instance, doesn't do this.

Hi Eric,

OK, I fixed this.  Now buffer modification state is preserved.  Also
now handles empty sections properly.

Version 2 attached below.

cheers,
Simon

;; org-wc.el
;;
;; Count words in org mode trees.
;; Shows word count per heading line, summed over sub-headings.
;; Aims to be fast, so doesn't check carefully what it's counting.  ;-)
;;
;; Simon Guest, 23/4/11
;;
;; Implementation based on:
;; - Paul Sexton's word count posted on org-mode mailing list 21/2/11.
;; - clock overlays
;;
;; v2 
;; 29/4/11
;; Don't modify buffer, and fixed handling of empty sections.

(defun org-in-heading-line ()
  "Is point in a line starting with `*'?"
  (equal (char-after (point-at-bol)) ?*))

(defun org-word-count (beg end) 
  "Report the number of words in the Org mode buffer or selected region."
  (interactive "r")
  (unless mark-active
(setf beg (point-min)
  end (point-max)))
  (let ((wc (org-word-count-aux beg end)))
(message (format "%d words in %s." wc
 (if mark-active "region" "buffer")

(defun org-word-count-aux (beg end)
  "Report the number of words in the selected region.
Ignores: heading lines,
 blocks,
 comments,
 drawers.
LaTeX macros are counted as 1 word."

  (let ((wc 0)
(block-begin-re "^#\\\+BEGIN")
(block-end-re "^#\\+END")
(latex-macro-regexp "[A-Za-z]+\\(\\[[^]]*\\]\\|\\){\\([^}]*\\)}")
(drawers-re (concat "^[ \t]*:\\("
(mapconcat 'regexp-quote org-drawers "\\|")
"\\):[ \t]*$"))
(drawers-end-re "^[ \t]*:END:"))
(save-excursion
  (goto-char beg)
  (while (< (point) end)
(cond
 ;; Ignore heading lines.
 ((org-in-heading-line)
  (forward-line))
 ;; Ignore blocks.
 ((looking-at block-begin-re)
  (re-search-forward block-end-re))
 ;; Ignore comments.
 ((org-in-commented-line)
  (forward-line))
 ;; Ignore drawers.
 ((looking-at drawers-re)
  (re-search-forward drawers-end-re nil t))
 ;; Count latex macros as 1 word, ignoring their arguments.
 ((save-excursion
(backward-char)
(looking-at latex-macro-regexp))
  (goto-char (match-end 0))
  (setf wc (+ 2 wc)))
 (t
  (progn
(and (re-search-forward "\\w+\\W*" end 'skip)
 (incf wc)))
wc))

(defun org-wc-count-subtrees ()
  "Count words in each subtree, putting result as the property :org-wc on that 
heading."
  (interactive)
  (remove-text-properties (point-min) (point-max)
  '(:org-wc t))
  (save-excursion
(goto-char (point-max))
(while (outline-previous-heading)
  (org-narrow-to-subtree)
  (let ((wc (org-word-count-aux (point-min) (point-max
(put-text-property (point) (point-at-eol) :org-wc wc)
(goto-char (point-min))
(widen)

(defun org-wc-display (beg end total-only)
  "Show subtree word counts in the entire buffer.
With prefix argument, only show the total wordcount for the buffer or region
in the echo area.

Use \\[org-wc-remove-overlays] to remove the subtree times.

Ignores: heading lines,
 blocks,
 comments,
 drawers.
LaTeX macros are counted as 1 word."
  (interactive "r\nP")
  (org-wc-remove-overlays)
  (unless total-only
(let ((bmp (buffer-modified-p))
  wc 
  p)
  (org-wc-count-subtrees)
  (save-excursion
(goto-char (point-min))
(while (or (and (equal (setq p (point)) (point-min))
(get-text-property p :org-wc))
   (setq p (next-single-property-change
(point) :org-wc)))
  (goto-char p)
  (when (setq wc (get-text-property p :org-wc))
(org-wc-put-overlay wc (funcall outline-level
;; Arrange to remove the overlays upon next change.
(when org-remove-highlights-with-change
  (org-add-hook 'before-change-functions 'org-wc-remove-overlays
nil 'local)))
(set-buffer-modified-p bmp)))
  (if mark-active
  (org-word-count beg end)
(org-word-count (point-min) (point-max

(defvar org-wc-overlays nil)
(make-variable-buffer-local 'org-wc-overlays)

(defun org-wc-put-overlay (wc &optional level)
  "Put an overlays on the current line, displaying word count.
If LEVEL is given, prefix word count with a corresponding number of stars.
This creates a new overlay and stores it in `org-wc-overlays', so that it
will be easy 

Re: [O] [ANN] Inkmacs

2011-04-28 Thread Marcelo de Moraes Serpa
This is *really* cool. That's what I love about org and the org
community in general.

Orgmode is by far the best PIM *framework/platform* out there, and
this is what we need, more integrations (as well as more pre-packaged
org solutions).

Evernote is nice and just works, but I'd never leave org, I'm hooked :)

Something that I'm using and that works well is the iimage mode, it
allows for image embedding and rendering (real-time) on the emacs
buffer, no need to export.

A question if you guys allow me: What are the other solutions that
allow you to "draw" from org? Either export or real-time based. I'd
love to see more that allows rendering on the buffer, in real-time

Cheers,

Marcelo.



On Tue, Mar 29, 2011 at 4:25 PM,   wrote:
> Jambunathan K  writes:
>
>> Joakim
>>
>>> https://github.com/jave/inkmacs>
>>> Inkmacs integrates Inkscap and Emacs. Interesting for this list is
>>> inkorg-mode which lets you write text in Org mode and update text  in
>>> Inkscape.
>>>
>>> It's work in progress with some cmubersome dependencies still.
>>>
>>> Maybe it could be mentioned here:
>>> http://orgmode.org/worg/org-contrib/.
>>
>> I have seen the entry for this in EmacsWiki for quite sometime now [1].
>> It looks quite wonderful.
>>
>> For a common user who doesn't understand much of Inkmacs, SVG etc etc
>> what does all this amount to? From the overall description it seems like
>> it would help create wonderful mashups involving graphics and text
>> (within or outside of Emacs?). The only thing that comes to my mind is -
>> animated powerpoint slides and posters may be mindmappers.
>>
>> Could you please add a couple of lines to this announcement that
>> summarizes the potentiatlities of your work in a way common Emacs user
>> can understand?
>>
>> Footnotes:
>> [1]  http://www.emacswiki.org/emacs/Inkmacs
>
> Maybe this scenario helps?
>
> - start out with an Org mode text tree
> - M-X inkmacs-edit This binds the tree to an Inkscape instance
> - C-M-x will copy the Org mode text tree to Inkscape and bind each node
> to an Inkscape text node. The default layout will be ugly
> - Drag around the text nodes as you please and add graphics
> - Edit the Org mode text tree and update the text nodes in Inkscape
> again with C-M-x
>
> I use this for things like mindmaps.
>
> There are more possibilities but the above scenario should give a hint
> anymay.
>
> --
> Joakim Verona
>
>



Re: [O] serious calendar integration bug

2011-04-28 Thread Daniel Clemente
El Thu, 28 Apr 2011 08:02:33 -0400 Matt Price va escriure:
>
>  debug(error (wrong-type-argument window-live-p nil))
>   select-window(nil)
>   org-eval-in-calendar(nil t)
> 

  I often experience a similar bug but with frames instead of windows:

;Debugger entered--Lisp error: (wrong-type-argument frame-live-p #)
;  frame-selected-window(#)
;  menu-bar-non-minibuffer-window-p()
;  kill-this-buffer()
;  call-interactively(kill-this-buffer nil nil)

  My solution when this happpens is: (setq menu-updating-frame nil)
  I use this for many years and it always restores Emacs and I call close 
buffers again. Maybe it works for you.


  I think I might also have experienced your bug: after opening another buffer 
from Org and messing around, my .org file was completely empty and C-x C-s 
would save all contents to disk. I think it was either due to vc (C-x v =) or 
due to the calendar when scheduling a task. Try changing focus some times: from 
.org to the calendar, back, etc.
  This happened about 3 or 4 weeks ago, but several times. I updated and 
recompiled Emacs and org and now it doesn't seem to happen. I don't have 
detailed information, sorry (I thought it was so severe that many people would 
notice it).
  My workaround: use a version control system, and execute regularly „[VCS] 
diff > /tmp/backup1“. And fear Emacs.


-- Daniel



Re: [O] Patch --- adding an easy template for #+index

2011-04-28 Thread Bernt Hansen
Robert Goldman  writes:

> On 4/28/11 Apr 28 -2:11 PM, Bernt Hansen wrote:
>> rpgold...@sift.info writes:
>> 
>>> The next message will contain a patch that provides a new easy template for 
>>> adding index entries, per Nick Dokos's suggestion.
>> 
>> Hi Robert,
>> 
>> Just a FYI: you can include the above information right in your patch
>> after the --- and before the diffstat like this:
>
> I have been using git send-email, and the only option I understand is
> the --compose one, which generates these predecessor emails.  Are you
> sending an email with a different client and then attaching the patch
> files?  Or something else?

To send a single patch I use

git send-email --annotate -1

which drops the patch in an editor before it is sent out.  I just add
the extra details between the --- and diffstat before the email is sent
to the list.

--annotate just means you want to edit (annotate) the message before it
gets sent.

HTH,
Bernt




[O] Restrict agenda search to specific org files

2011-04-28 Thread Marcelo de Moraes Serpa
Hello list,

I'd like to know if it's possible to create custom agenda search
commands that will search only specific files (a subset) from the
agenda list. It would be nice if we could also override the agenda
file list and just specify the file(s) in the command.

Thanks,

Marcelo.



Re: [O] org-src-fontify-natively makes things very, very slow

2011-04-28 Thread Carsten Dominik

On 21.3.2011, at 18:06, Eric S Fraga wrote:

> Hello again,
> 
> going back to the original subject of this thread (although thanks all
> for your inputs on yasnippet ;-), I have started working on a new
> document and am finding the slowdown of navigation (next-line) very
> annoying.  In this document, I have two gnuplot source blocks.
> Navigating through them, I get the following results from elp:
> 
> --8<---cut here---start->8---
> next-line 54  
> 5.946677  0.1101236481
> previous-line 44  
> 0.435003  0.0098864318
> org-encrypt-entries   1   
> 0.000424  0.000424
> org-scan-tags 1   
> 0.000368  0.000368
> org-make-tags-matcher 1   
> 5.1e-05   5.1e-05
> org-activate-plain-links  1   
> 2.4e-05   2.4e-05
> org-raise-scripts 1   
> 2.1e-05   2.1e-05
> org-fontify-meta-lines-and-blocks 1   
> 1.9e-05   1.9e-05
> org-font-lock-hook1   
> 1.9e-05   1.9e-05
> org-outline-level 5   
> 1.9e-05   3.8e-06
> org-mode-flyspell-verify  14  
> 1.8e-05   1.285...e-06
> org-inlinetask-fontify1   
> 1.5e-05   1.5e-05
> org-activate-footnote-links   1   
> 1.5e-05   1.5e-05
> org-unfontify-region  1   
> 1.2e-05   1.2e-05
> org-do-emphasis-faces 1   
> 1.2e-05   1.2e-05
> org-activate-angle-links  1   
> 1.2e-05   1.2e-05
> org-activate-dates1   
> 1.1e-05   1.1e-05
> org-fontify-entities  1   
> 1.1e-05   1.1e-05
> --8<---cut here---end--->8---
> 
> From these timings, the font locking doesn't seem to be the issue but
> maybe the overlays are.  However, commenting out the code that Sébastien
> Vauban indicated:
> 
>> Maybe this is (partly?) due to the overlay I added:
>> 
>> #+begin_src emacs-lisp
>>(overlay-put (make-overlay beg1 block-end)
>> 'face 'org-block-background))
>> #+end_src
> 
> (well, commenting out the whole condition that includes this code) makes
> no difference at all.

Did you restart Emacs?  Because if you just continued, all those
overlays are there already.

> 
> So, I turned off =org-src-fontify-natively= and things are back to
> normal: next-line is as fast as previous-line.  I can put up without the
> fontification so this is what I am doing now.  
> 
> However, as it's a pity to lose the native fontification, it would be
> nice to solve this problem in another way.  Can anybody suggest any
> other thing to try?

The problem with the multiple overlays that were created
during native fontification is now fixed.  I would be interested
to know if this improves the situation.

- Carsten




[O] Run lisp code in macros?

2011-04-28 Thread amscopub-mail
Is there a way to apply text transformations to arguments in macros?

For example, say that you want to change the first argument to capital letters? 
or transpose the letters of the second argument? 

How would you do that? I imagine you would have to run elisp code, perhaps 
babel is the answer?

Sample code:

#+MACRO: test Change $1 to uppercase, somehow.

* Hello World
{{{test(test phrase)}}}

Desired HTML export:

TEST PHRASE to uppercase, somehow.




Re: [O] [babel] hemorrhaging at the bleeding edge: using clojure

2011-04-28 Thread Eric Schulte
Eric S Fraga  writes:

> "Eric Schulte"  writes:
>
>> [...]
>>>
>>> The problem is that nothing appears in the org file; instead, I get the
>>
>>> following error message:
>>>
>>> Evaluate this clojure code block (simple) on your system? (y or n)  y
>>> executing Clojure code block (simple)...
>>> org-babel-execute:clojure: Invalid read syntax: "#"
>
> [...]
>
>>> Can you help at all?  I am a little confused, to say the least :(
>>>
>>
>> Yes, I just pushed up a commit which should solve this issue.
>
> Brilliant.  The error message is gone and I get the results I expect!
> Many thanks.

Wonderful,

Perhaps at some point it would be worth trying something more
complicated in the case of an error reading as pure lisp, e.g., trying
to invoke a to_string or (if the object designer is an Org-mode fan) a
to_org method on the object being returned...

Best -- Eric

also, off topic, another option for lisp on the JVM is ABCL a full
implementation of Common Lisp on the JVM http://armedbear.org/abcl.html

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] [babel] hemorrhaging at the bleeding edge: using clojure

2011-04-28 Thread Eric S Fraga
"Eric Schulte"  writes:

> [...]
>>
>> The problem is that nothing appears in the org file; instead, I get the
>
>> following error message:
>>
>> Evaluate this clojure code block (simple) on your system? (y or n)  y
>> executing Clojure code block (simple)...
>> org-babel-execute:clojure: Invalid read syntax: "#"

[...]

>> Can you help at all?  I am a little confused, to say the least :(
>>
>
> Yes, I just pushed up a commit which should solve this issue.

Brilliant.  The error message is gone and I get the results I expect!
Many thanks.

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.223.g4a86)



Re: [O] Patch --- adding an easy template for #+index

2011-04-28 Thread Robert Goldman
On 4/28/11 Apr 28 -2:11 PM, Bernt Hansen wrote:
> rpgold...@sift.info writes:
> 
>> The next message will contain a patch that provides a new easy template for 
>> adding index entries, per Nick Dokos's suggestion.
> 
> Hi Robert,
> 
> Just a FYI: you can include the above information right in your patch
> after the --- and before the diffstat like this:

I have been using git send-email, and the only option I understand is
the --compose one, which generates these predecessor emails.  Are you
sending an email with a different client and then attaching the patch
files?  Or something else?

> 
> --8<---cut here---start->8---
> ...
> just made the Muse equivalent of #+index be #+index.  I don't know
> org-mtags enough to know if this is appropriate.
> ---
> The next message will contain a patch that provides a new easy template
> for adding index entries, per Nick Dokos's suggestion.
> 
> Any text you put in here after the '---' and before the diffstat is
> discarded by the git tools that apply the patch.  This is a great place
> to add extra comments and details that do not belong in the commit
> message itself.
> 
>  lisp/org.el |9 ++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/lisp/org.el b/lisp/org.el
> ...
> --8<---cut here---end--->8---
> 
> Regards,
> Bernt




Re: [O] Patch --- adding an easy template for #+index

2011-04-28 Thread Bernt Hansen
rpgold...@sift.info writes:

> The next message will contain a patch that provides a new easy template for 
> adding index entries, per Nick Dokos's suggestion.

Hi Robert,

Just a FYI: you can include the above information right in your patch
after the --- and before the diffstat like this:

--8<---cut here---start->8---
...
just made the Muse equivalent of #+index be #+index.  I don't know
org-mtags enough to know if this is appropriate.
---
The next message will contain a patch that provides a new easy template
for adding index entries, per Nick Dokos's suggestion.

Any text you put in here after the '---' and before the diffstat is
discarded by the git tools that apply the patch.  This is a great place
to add extra comments and details that do not belong in the commit
message itself.

 lisp/org.el |9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
...
--8<---cut here---end--->8---

Regards,
Bernt



Re: [O] [babel] hemorrhaging at the bleeding edge: using clojure

2011-04-28 Thread Eric Schulte
[...]
>
> The problem is that nothing appears in the org file; instead, I get the
> following error message:
>
> Evaluate this clojure code block (simple) on your system? (y or n)  y
> executing Clojure code block (simple)...
> org-babel-execute:clojure: Invalid read syntax: "#"
>
> This is very confusing...  From looking at the relevant elisp code:
>
> (read
>  (slime-eval
>   `(swank:interactive-eval-region
> ,(buffer-substring-no-properties (point-min) (point-max)))
>   (cdr (assoc :package params
>
> =read= is trying to interpret the code.  But I'm not sure what this is
> intended to do in this case.
>
> If I change my code to use the Java =.toString= method on my object, and
> ask for either output or value results, it works:
>
> #+srcname: simple
> #+begin_src clojure :results value
> (.toString (variable [-1 1 2 3]))
> #+end_src
>
> #+results: simple
> : x={ -1.0, 1.0, 2.0, 3.0 }
>
>
> Can you help at all?  I am a little confused, to say the least :(
>

Yes, I just pushed up a commit which should solve this issue.

Babel tries to read the results, to see if they should be inserted as a
table or verbatim, it will now default to verbatim if reading of the
result throws an error.

Best -- Eric

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] [babel] hemorrhaging at the bleeding edge: using clojure

2011-04-28 Thread Eric S Fraga
(followup to my long email a few minutes ago)

I should have added that the output I expect does all appear in the
=*slime-repl clojure*= buffer even if it never appears in the org
buffer.

Maybe I've misunderstood what ob-clojure is meant to do?

thanks,
eric

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.222.g0846a)



Re: [O] serious calendar integration bug

2011-04-28 Thread Matt Price
On Thu, Apr 28, 2011 at 8:43 AM, Nick Dokos  wrote:

> Matt Price  wrote:
>
>
> One thing is to make sure that it is the first select-window which is
> failing:
> there is a second one in there as well. Toggling debug-on-error and getting
> a full backtrace (assuming you are loading .el files and not .elc files)
> would
> take care of that.
>
> If there were any concurrency, I'd suspect a race: you try to select a
> window
> that somebody else killed in the meantime. But I don't think there is
> anything
> like that going in emacs - but I don't know for sure.
>

I think I'm loading .el files, from the git repository.  And I think it must
be the first select-window failing, because  (get-buffer-window
"*Calendar*") evaluates to nil, while (selected-window) evaluates to a
numbered window.  "*scratch*" also works properly, so there's so mething
very odd about the *Calendar* window.  There must be something strange
happening with the calendar functions -- that's part of the emacs core,
right?  Or should I be worrying about my other packages?

Again, many thanks,
Matt


> Nick
>


Re: [O] [babel] hemorrhaging at the bleeding edge: using clojure

2011-04-28 Thread Eric S Fraga
"Eric Schulte"  writes:

[...]

> I would suggest using that latest version of ELPA, and adding the
> following repository sources to your ELPA archives...

[...]

> Once you have slime working, then Babel code blocks should be trivial
> (they rely on a slime session).  Be sure to use the ":package" header
> argument to specify the namespace in which to evaluate your clojure
> code.

Eric (and/or anybody else with babel+clojure expertise?),

again, thanks for your help on this but I hope I can continue to bother
you!

I have finally managed to get clojure working in org+babel.  To cut a
very long story short, there were two problems (for the benefit of the
mailing list):

1. I had a previously installed version of slime on my system that was
   conflicting with the new version being installed by elpa.  In moving
   from emacs 23.x to 24.x, a number of old packages remained and slime
   was one of them.  Removing the old version suddenly made things work
   (sort of).

2. Because I'm using clojure as an interface to an existing Java package
   (in-house, written over the past 15 years so a large investment in
   effort), the whole issue of classpaths raised its ugly head (the
   worst aspect of java, IMO).  I finally sorted this out by making my
   own version of the swank-clojure script to automatically include my
   own very complex classpath.

So, now I have a setup in which my clojure code is executed just fine,
Java packages are found as are clojure packages, etc.  However, I cannot
get output into my org file.  For instance, the following code

--8<---cut here---start->8---
#+srcname: simple
#+begin_src clojure :results output raw
(variable [-1 1 2 3])
#+end_src
--8<---cut here---end--->8---

works, in that the output I would expect appears in the =*slime-events*=
buffer: 

--8<---cut here---start->8---
(:emacs-rex
 (swank:interactive-eval-region "(variable [-1 1 2 3])")
 "user" t 17)
(:return
 (:ok "#")
 17)
--8<---cut here---end--->8---

(don't worry about what the output says...  Variables is a Java object I
need to work with.)

The problem is that nothing appears in the org file; instead, I get the
following error message:

--8<---cut here---start->8---
Evaluate this clojure code block (simple) on your system? (y or n)  y
executing Clojure code block (simple)...
org-babel-execute:clojure: Invalid read syntax: "#"
--8<---cut here---end--->8---

This is very confusing...  From looking at the relevant elisp code:

--8<---cut here---start->8---
(read
 (slime-eval
  `(swank:interactive-eval-region
,(buffer-substring-no-properties (point-min) (point-max)))
  (cdr (assoc :package params
--8<---cut here---end--->8---

=read= is trying to interpret the code.  But I'm not sure what this is
intended to do in this case.

If I change my code to use the Java =.toString= method on my object, and
ask for either output or value results, it works:

--8<---cut here---start->8---
#+srcname: simple
#+begin_src clojure :results value
(.toString (variable [-1 1 2 3]))
#+end_src

#+results: simple
: x={ -1.0, 1.0, 2.0, 3.0 }
--8<---cut here---end--->8---


Can you help at all?  I am a little confused, to say the least :(

But happy in that I've made some progress at least!  Although it *has*
taken me all afternoon!

Thanks again and sorry for the long diatribe,
eric

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.222.g0846a)



Re: [O] Footnotes in LaTeX export

2011-04-28 Thread Thomas S. Dye

Aloha Nicolas,

On Apr 26, 2011, at 8:38 AM, Nicolas Goaziou wrote:


Hello,

"Thomas S. Dye"  writes:

I'm exporting a subtree to LaTeX and am having problems with  
footnotes.


1) If I enter a footnote with C-c C-x f everything works as expected
in the Org-mode buffer, but on export the actual footnote is replaced
by a message something like FOOTNOTE DEFINITION NOT FOUND.

2) I can workaround this problem by using an inline definition, eg.
[fn:: My footnote.].  However, the citation links that I use  
elsewhere

in the document, defined as set out in
http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-17_2_1 
,

are broken inside the footnote.  The same code that yields
\citep{wilmshurst11:_high_east_polyn} in regular text yields
\citep{wilmshurst11:_high$_{\mathrm{east}}$$_{\mathrm{polyn}}$ }
inside the footnote.

I'm using Org-mode version 7.4 (release_7.4.624.gab9f9) with a patch
for captions (which I submitted a while back) and another for org-
bibtex recently developed by Eric Schulte (neither of which should
have an effect on footnotes, I believe).


There has been recently some work done on footnotes, in particular
regarding latex export. Could you upgrade your Org version ?

If it still doesn't work, please post an ECM, I will have a look at  
it.


Regards,

--
Nicolas Goaziou



I *think* this is an ECM.  I appreciate your offer to look at the  
problem.


Org-mode version 7.5 (release_7.5.229.g88a32)

* ECM
** Define link
Source the following code with C-c C-c
#+source: define-citep-link
#+begin_src emacs-lisp :results silent
(org-add-link-type
 "citep" 'ebib
 (lambda (path desc format)
   (cond
((eq format 'html)
 (format "(%s)" path))
((eq format 'latex)
 (if (or (not desc) (equal 0 (search "citep:" desc)))
   (format "\\citep{%s}" path)
   (format "\\citep[%s]{%s}" desc path)
  )
#+end_src
** Export subtree to LaTeX
This link is fine [[citep:link_with_underscore]], but the one in the
footnote is not OK.[fn:: A bad link [[citep:link_with_underscore]].]

LaTeX export:

This link is fine \citep{link_with_underscore}, but the one in the
footnote is not OK.\footnote{A bad link [[citep:link\_{}with 
\_{}underscore }].]


All the best,
Tom



Re: [O] org-bibtex.el

2011-04-28 Thread Eric Schulte
"Thomas S. Dye"  writes:

> Hi Eric,
>
> This is fitting very nicely into my workflow.  Thanks.  Here are some
> reactions after a bit more experience with the package.
>
> It would be nice to be able to call org-bibtex-create with an option
> to fill in required and optional fields.  I typically need a few
> optional fields and so end up running org-bibtex-check with a prefix
> to get at the optional fields.  Perhaps I've missed an easier way to
> do this?
>

Good idea, I just pushed up a patch which adds an optional prefix
argument to `org-bibtex-create' which will result in prompting for
optional as well as required fields.

>
> It might also be good to let the user specify the bibtex file name,
> wither on a per-export basis or as a configuration possibility.
> Bibtex file management can become an issue in a long career and I've
> found naming conventions to be a help in this task.
>

Ok, this function now prompts for a file name, with the default initial
value set to the name of the Org-mode buffer with .org replaced with
.bib.

>
> Thanks again for your work on org-bibtex.
>

My pleasure.

Best -- Eric

>
> All the best,
> Tom
>
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



[O] Fwd: example or source blocks with captions

2011-04-28 Thread Thomas S. Dye

(forgot to cc the list)

Begin forwarded message:


From: "Thomas S. Dye" 
Date: April 28, 2011 5:42:32 AM HST
To: Sébastien Vauban 
Subject: Re: [O] example or source blocks with captions

Aloha Seb,

On Apr 27, 2011, at 9:46 PM, Sébastien Vauban wrote:


Hi Thomas,

"Thomas S. Dye" wrote:

A while back I took a stab at an overly ambitious project that I've
subsequently dropped. In that project I did manage to establish  
captions
that work with org-special-blocks. What follows is a cut and paste  
job from
the bones of the project that might help you solve the problem of  
captioning
constructs other than figures and tables. It was aimed primarily  
at LaTeX

export, but I seem to recall that it worked for html as well.

All the best,
Tom

This link establishes a caption that works with both LaTeX and  
html and can
be used to mark blocks that Org-mode doesn't recognize by default.  
Note that
you currently have to enter these links by hand and not with the  
usual

=org-insert-link= function, which doesn't allow spaces in the =PATH=
argument.

#+BEGIN_listing
# <>
#+source: define-caption-link
#+begin_src emacs-lisp :exports code
  (org-add-link-type
   "caption" nil
   (lambda (path desc format)
 (cond
  ((eq format 'html)
   (format "%s" desc))
  ((eq format 'latex)
   (format "\\caption[%s]{%s}" path desc)
#+end_src
[[caption:A new caption link type][A new caption link type.]]
# <>
#+END_listing

Block-level markup is accomplished with the help of the
[[latex:package][org-special-blocks]] package. It is used in this  
file to

wrap the [[latex:progstruct][listing]] environment defined by the
[[latex:package][minted]] package around a source code block to  
get a

floating listing in the LaTeX document.


Interesting read. Could you share the definition of your `latex'  
link type?


Best regards,
 Seb

--
Sébastien Vauban




Here it is,
http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10_3

All the best,
Tom




Re: [O] Build error in git HEAD with org-bibtex.el

2011-04-28 Thread Matt Lundin
"Eric Schulte"  writes:

> Matt Lundin  writes:
>

[...]

>> And with bleeding edge emacs (compiled from the repos yesterday), I'm
>> getting an additional error:
>>
>> In toplevel form:
>> org-bibtex.el:114:1:Warning: global/dynamic var `description' lacks a prefix
>> org-bibtex.el:257:1:Error: Byte-compiling a redefinition of `get'
>> will not work - use `labels' instead
>> make: *** [lisp/org-bibtex.elc] Error 1
>>
>> Note: the description variable error has nothing to do with the recent
>> changes to org-bibtex.
>
> Yes, the org-mode source is littered with such un-prefixed dynamic
> variables, and I'm not sure how this will be addressed.  Personally I
> would prefer an option to tell the compiler not to complain, as adding
> org- to all of these variable names could make the source harder to
> read.  But, that said, I suppose there is a danger of conflict in common
> variable names between packages...

Thanks for explaining this. I believe I misspoke when I said it was an
error. I now see it is only a warning.

Best,
Matt



[O] [PATCH] Add an easy template for index (i), and move include file to I from i.

2011-04-28 Thread rpgoldman
From: Robert P. Goldman 

Implement Nick Dokos' suggestion for inserting #+INDEX.

Notes about this patch:
1.  It breaks some old user-visible behavior, since ?")
 ("a" "#+begin_ascii\n?\n#+end_ascii")
 ("A" "#+ascii: ")
-("i" "#+include %file ?"
+("i" "#+index: ?"
+ "#+index: ?")
+("I" "#+include %file ?"
  "")
 )
   "Structure completion elements.
 This is a list of abbreviation keys and values.  The value gets inserted
 if you type `<' followed by the key and then press the completion key,
 usually `M-TAB'.  %file will be replaced by a file name after prompting
-for the file using completion.
+for the file using completion.  The cursor will be placed at the position
+of the `?` in the template.
 There are two templates for each key, the first uses the original Org syntax,
 the second uses Emacs Muse-like syntax tags.  These Muse-like tags become
 the default when the /org-mtags.el/ module has been loaded.  See also the
@@ -10779,7 +10782,7 @@ expands them."
   (let ((l (buffer-substring (point-at-bol) (point)))
a)
 (when (and (looking-at "[ \t]*$")
-  (string-match "^[ \t]*<\\([a-z]+\\)$"l)
+  (string-match "^[ \t]*<\\([a-zA-Z]+\\)$" l)
   (setq a (assoc (match-string 1 l) org-structure-template-alist)))
   (org-complete-expand-structure-template (+ -1 (point-at-bol)
 (match-beginning 1)) a)
-- 
1.7.3.5




[O] Patch --- adding an easy template for #+index

2011-04-28 Thread rpgoldman

The next message will contain a patch that provides a new easy template for 
adding index entries, per Nick Dokos's suggestion.




Re: [O] [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index.

2011-04-28 Thread Robert Goldman
My mistake -- I made the template wrong; it wasn't a case-fold issue,
after all.

I have a patch that will do this now.  Will post it soon.

Cheers,
r



Re: [O] org-bibtex.el: var `description' lacks a prefix, redef get use labels instead

2011-04-28 Thread Eric Schulte
Hi Jeff,

Thanks for the report, this should now be fixed.

Best -- Eric

Jeff Kowalczyk  writes:

> Unusual bug in git master this morning:
>
> make clean && make:
> ...
> emacs -batch -q -no-site-file -eval "(setq load-path (cons (expand-file-name
> \"./lisp/\") (cons \"/usr/local/share/emacs/site-lisp\" load-path)))" -f
> batch-byte-compile lisp/org-bibtex.el
>
> In toplevel form:
> org-bibtex.el:114:1:Warning: global/dynamic var `description' lacks a prefix
> org-bibtex.el:257:1:Error: Byte-compiling a redefinition of `get' will not 
> work
> - use `labels' instead
> make: *** [lisp/org-bibtex.elc] Error 1
>
> Thanks,
> Jeff
>
>
>
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index.

2011-04-28 Thread Robert Goldman
On 4/28/11 Apr 28 -7:33 AM, Nick Dokos wrote:
> rpgold...@sift.info wrote:
> 
>> From: Robert P. Goldman 
>>
>> ---
>>  lisp/org-latex.el |   13 +
>>  1 files changed, 13 insertions(+), 0 deletions(-)
>>  ...
> 
> Very nice! Did a small test and it works as advertised.
> 
> Suggestion: maybe add an "I" easy template for it? This can be done
> per-user of course, so it is not strictly necessary and easy templates
> are experimental anyway, but it might be a good idea to reserve the "I"
> for this.  Actually, it might be better to reserve "i" for this and
> shift the include to "I", since there will only be a few includes but
> potentially hundreds of index entries in a file.

I'm not sure that this is feasible.  I tried doing this and as far as I
can tell the template matching is not case-sensitive.  I could wrap the
string-match there in a

(let ((case-fold-search nil))
  ...)

but I'd like some advice from a core maintainer before doing this (I'll
check in on IRC, too).

I've got a patch ready if that's the right way to go.

cheers,
r




Re: [O] Build error in git HEAD with org-bibtex.el

2011-04-28 Thread Eric Schulte
Matt Lundin  writes:

> Christian Egli  writes:
>
>> Hi all
>>
>> When doing a `make update` I get the following compile error:
>>
>> ~/src/org-mode $ make update
>> git pull
>> Already up-to-date.
>> /usr/bin/make clean
>> make[1]: Entering directory `/home/eglic/src/org-mode'
>> [snip]
>> emacs -batch -q -no-site-file -eval "(setq load-path (cons
>> (expand-file-name \"./lisp/\") (cons
>> \"/usr/local/share/emacs/site-lisp\" load-path)))" -f
>> batch-byte-compile lisp/org-bibtex.el
>>
>> In toplevel form:
>> lisp/org-bibtex.el:257:8:Error: Byte-compiling a redefinition of `get'
>> will not work - use `labels' instead
>> make[1]: *** [lisp/org-bibtex.elc] Error 1
>> make[1]: Leaving directory `/home/eglic/src/org-mode'
>> make: *** [update] Error 2
>>
>> This is using GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, GTK+ Version
>> 2.22.0) of 2011-03-04 on yellow, modified by Debian
>>
>
> And with bleeding edge emacs (compiled from the repos yesterday), I'm
> getting an additional error:
>
> In toplevel form:
> org-bibtex.el:114:1:Warning: global/dynamic var `description' lacks a prefix
> org-bibtex.el:257:1:Error: Byte-compiling a redefinition of `get' will not 
> work - use `labels' instead
> make: *** [lisp/org-bibtex.elc] Error 1
>
> Note: the description variable error has nothing to do with the recent
> changes to org-bibtex.
>

Hi Matt,

Yes, the org-mode source is littered with such un-prefixed dynamic
variables, and I'm not sure how this will be addressed.  Personally I
would prefer an option to tell the compiler not to complain, as adding
org- to all of these variable names could make the source harder to
read.  But, that said, I suppose there is a danger of conflict in common
variable names between packages...

Thanks -- Eric

>
> Best,
> Matt
>
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



Re: [O] Starter-kit: How to disable some heading from the initialization

2011-04-28 Thread Darlan Cavalcante Moreira

Thanks Eric,

Adding the property ":TANGLE: no" did the trick. I guess I was so sure the
correct value was "nil", since it is what I use when adding this to the
source blocks, that I didn't even try the more obvious "no" as a value.

--
Darlan

At Wed, 27 Apr 2011 21:43:52 -0600,
Eric Schulte wrote:
> 
> Darlan Cavalcante Moreira  writes:
> 
> > Hello list,
> >
> > I have changed my Emacs initialization from the .emacs file (loading
> > several .el files) to org-mode by using the excellent starter kit. I use a
> > single .org file with the initialization code broken down into level-1
> > headings, possible with subheadings.
> >
> > This works very well, but I'd like to disable some sections that I don't
> > need at the moment or to identify where most of the initialization time is
> > spent.
> >
> >  1.) At first I tried to add the COMMENT keyword in a heading with "C-c ;",
> >  but without any effect. This would be the preferred option IMHO, since
> >  you get an easy visual feedback about which parts of the
> >  initialization are disabled.
> >
> >  2.) Then I tried adding the ":TANGLE: nil" property to a heading, but
> >  again without success. The starter kit probably adds something such as
> >  ":tangle org_file_name.el" to each source block thus overwriting
> >  the :TANGLE: property of the heading.
> >
> 
> Very Close, try adding the ":tangle: no" properties to headings to
> disable their tangling (note: ":TANGLE: no" should work as well).
> 
> Best -- Eric
> 
> >
> >  3.) At last, I tried to add ":tangle nil" to each individual source block
> >  I wanted to disable. This works, but because each heading can have
> >  many source blocks it is a lot of work to add this to each one (and
> >  remove later if I want to enable this configuration again).
> >
> > Is there an easy way to do this? If not, I'd like to suggest 1.) or 2.) as
> > a feature request.
> >
> > --
> > Darlan
> >
> 
> -- 
> Eric Schulte
> http://cs.unm.edu/~eschulte/



Re: [O] Build error in git HEAD with org-bibtex.el

2011-04-28 Thread Eric Schulte
Hi Christian,

Thanks for sharing this.  I've just pushed up a fix for the problem you
mentioned below.  That will teach me to push a big change without
consulting the compiler first.

Best -- Eric

Christian Egli  writes:

> Hi all
>
> When doing a `make update` I get the following compile error:
>
> ~/src/org-mode $ make update
> git pull
> Already up-to-date.
> /usr/bin/make clean
> make[1]: Entering directory `/home/eglic/src/org-mode'
> [snip]
> emacs -batch -q -no-site-file -eval "(setq load-path (cons (expand-file-name 
> \"./lisp/\") (cons \"/usr/local/share/emacs/site-lisp\" load-path)))" -f 
> batch-byte-compile lisp/org-bibtex.el
>
> In toplevel form:
> lisp/org-bibtex.el:257:8:Error: Byte-compiling a redefinition of `get' will 
> not work - use `labels' instead
> make[1]: *** [lisp/org-bibtex.elc] Error 1
> make[1]: Leaving directory `/home/eglic/src/org-mode'
> make: *** [update] Error 2
>
> This is using GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.22.0) of 
> 2011-03-04 on yellow, modified by Debian
>
> Thanks
> Christian

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



[O] Any way to identify a DEADLINE or SCHEDULED item via org-agenda-prefix-format?

2011-04-28 Thread Anupam Sengupta
Hello,

In my custom agenda block, I wanted to distinguish between SCHEDULED and
DEADLINE items using a small character flag.  The docstring for
`org-agenda-prefix-format' mentions %s as the one to use for the
scheduled/deadline string (as is used in the default agenda) - however,
this string does not seem to be working for me (orgmode 7.5).

As an example of a custom agenda block:

(tags-todo 
"+TODO=\"TODO\"+SCHEDULED>=\"\"+SCHEDULED<\"\"|+TODO=\"TODO\"+DEADLINE>=\"\"+DEADLINE<\"\"|+TODO=\"TODO\"+TIMESTAMP>=\"\"+TIMESTAMP<\"\""
  ((org-agenda-overriding-header "\nToday's Action 
Items\n")
   (org-agenda-prefix-format " [ ] %12:c%?-12t % s")))

Note the % s in the `org-agenda-prefix-format' setting.  All other
settings are showing up fine, but the schedule information is missing in
the display.

As an aside, %s is not exactly what I need, as I was looking for a way
to display a single character flag (S or D for scheduled or deadline),
but this is also fine.

Regards,
-- 
Anupam



[O] org-export-latex-verbatim-wrap has no effect on Babel results

2011-04-28 Thread Avdi Grimm
I have customized my org-export-latex-verbatim-wrap to create a shaded
box for verbatim text. However, when I have Babel source code blocks
which export results, the results are always rendered with plain
\begin{verbatim}...\end{verbatim}.

I've been grepping through the code, but I can't figure out where
#+results: blocks are formatted into LaTeX.

Help?

-- 
Avdi Grimm
http://avdi.org



Re: [O] Missing Introduction and About sections in LaTeX export

2011-04-28 Thread Avdi Grimm
On Wed, Apr 27, 2011 at 5:41 PM, Nick Dokos  wrote:
> Just star them by hand in the tex file after exporting for the last
> time: it'll take two seconds. You may be able to do it from Org by
> writing a custom function (C-h v org-export-latex-classes  for
> details) but I suspect that the effort is just not worth it.


Ugh. This is a (somewhat) living document; manually tweaking the .tex
after export isn't really an option.

I was hoping there was a tag or property that I could set on a section
indicating it is frontmatter/backmatter.

-- 
Avdi Grimm
http://avdi.org



Re: [O] Agenda clock report - show currently clocked task?

2011-04-28 Thread Bernt Hansen


Sébastien Vauban 
writes:

> Hi Bernt,
>
> Bernt Hansen wrote:
>> Nathan Neff  writes:
>>> Does the clock report in the agenda exclude time spent in the currently
>>> clocked task?
>>>
>>> Is there a way to turn this on?
>>
>> org-clock-report-include-clocking-task
>
> Don't you find that, when set, the current elapsed time should also be
> inserted in the "logged" view of the agenda for today -- instead of the dash
> sign?
>
> Example with current Org Git version:
>
> 2011-04-27 Wed __
>   Weather: 6:21.. Sunrise (+0200)
>8:00.. 
>   Work:9:08- 9:27 Clocked:   (0:19) TODO Organize work
>   work:9:27-11:42 Clocked:   (2:15) TODO Read email and news
>   10:00.. 
>   Work:   11:42.. Clocked:   (-) TODO Organize work
>   12:00.. 
>   12:06.. now
>   14:00.. 
>
> It'd logical to see 0:24 instead (elapsed time between 11:42 and "now", here
> 12:06)?

Yes that's logical but... I didn't need that functionality when I
created this variable so I intentionally limited it to just the clock
report.

It would make perfect sense to me for this to also affect:

  - log mode in the agenda (as you described)
  - C-c C-x C-d to sum up clock times for trees in org files

This was never implemented mainly because R in the agenda is what I
wanted to work at the time and it has never been revisited.  I'm sure
these types of changes would be welcome, it just isn't high enough of my
radar currently.

Regards,
Bernt




Re: [O] serious calendar integration bug

2011-04-28 Thread Nick Dokos
Matt Price  wrote:

> hmm.  There's definitely something funny going on, I presume with emacs 
> rather than org, and (again
> presumably) something to do with my configs or installed packages. The 
> function that's failing is
> org-eval-in-calendar:
> 
>  debug(error (wrong-type-argument window-live-p nil))
>   select-window(nil)
>   org-eval-in-calendar(nil t)
> 
> If we look at the defun:
> 
> (defun org-eval-in-calendar (form &optional keepdate)
>   "Eval FORM in the calendar window and return to current window.
> Also, store the cursor date in variable org-ans2."
>   (let ((sf (selected-frame))
>     (sw (selected-window)))
>     (select-window (get-buffer-window "*Calendar*" t))
>     (eval form)
>     (when (and (not keepdate) (calendar-cursor-to-date))
>   (let* ((date (calendar-cursor-to-date))
>      (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date
>     (setq org-ans2 (format-time-string "%Y-%m-%d" time
>     (move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer))
>     (select-window sw)
>     (org-select-frame-set-input-focus sf)))
> 
> ---
> I think emacs is having trouble finding the buffer '*Calendar*' -- even 
> though it clearly exists and
> can be manually selected using C-x b.  I could verify this by just 
> eval-defun'ing this line:
> (select-window (get-buffer-window "*Calendar*" t))
> 
> from the scratch buffer -- this produces the same backtrace.  However, oddly, 
> after experiencing the
> same issue about 6 times in a row, the problem mysteriously disappeared just 
> now, and the procedure
> is working fine.  I have no idea what the issue is there -- I'll report when 
> I find it again.  Maybe
> someone on the list can give me suggestions for debugging if it shows up 
> again?  Thanks,
> 

One thing is to make sure that it is the first select-window which is failing:
there is a second one in there as well. Toggling debug-on-error and getting
a full backtrace (assuming you are loading .el files and not .elc files) would
take care of that.

If there were any concurrency, I'd suspect a race: you try to select a window
that somebody else killed in the meantime. But I don't think there is anything
like that going in emacs - but I don't know for sure.

Nick



[O] orgmode.org: 404 page not found error

2011-04-28 Thread Mehul Sanghvi
If you go to http://orgmode.org/index.html#sec-4_1  and then click on the
link in the first list item that says "this directory"  then you will
get the 404
error from nginx.


-- 
Mehul N. Sanghvi
email: mehul.sang...@gmail.com



Re: [O] [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index.

2011-04-28 Thread Nick Dokos
rpgold...@sift.info wrote:

> From: Robert P. Goldman 
> 
> ---
>  lisp/org-latex.el |   13 +
>  1 files changed, 13 insertions(+), 0 deletions(-)
>  ...

Very nice! Did a small test and it works as advertised.

Suggestion: maybe add an "I" easy template for it? This can be done
per-user of course, so it is not strictly necessary and easy templates
are experimental anyway, but it might be a good idea to reserve the "I"
for this.  Actually, it might be better to reserve "i" for this and
shift the include to "I", since there will only be a few includes but
potentially hundreds of index entries in a file.

Thanks,
Nick




[O] org-bibtex.el: var `description' lacks a prefix, redef get use labels instead

2011-04-28 Thread Jeff Kowalczyk
Unusual bug in git master this morning:

make clean && make:
...
emacs -batch -q -no-site-file -eval "(setq load-path (cons (expand-file-name
\"./lisp/\") (cons \"/usr/local/share/emacs/site-lisp\" load-path)))" -f
batch-byte-compile lisp/org-bibtex.el

In toplevel form:
org-bibtex.el:114:1:Warning: global/dynamic var `description' lacks a prefix
org-bibtex.el:257:1:Error: Byte-compiling a redefinition of `get' will not work
- use `labels' instead
make: *** [lisp/org-bibtex.elc] Error 1

Thanks,
Jeff





Re: [O] Build error in git HEAD with org-bibtex.el

2011-04-28 Thread Matt Lundin
Christian Egli  writes:

> Hi all
>
> When doing a `make update` I get the following compile error:
>
> ~/src/org-mode $ make update
> git pull
> Already up-to-date.
> /usr/bin/make clean
> make[1]: Entering directory `/home/eglic/src/org-mode'
> [snip]
> emacs -batch -q -no-site-file -eval "(setq load-path (cons
> (expand-file-name \"./lisp/\") (cons
> \"/usr/local/share/emacs/site-lisp\" load-path)))" -f
> batch-byte-compile lisp/org-bibtex.el
>
> In toplevel form:
> lisp/org-bibtex.el:257:8:Error: Byte-compiling a redefinition of `get'
> will not work - use `labels' instead
> make[1]: *** [lisp/org-bibtex.elc] Error 1
> make[1]: Leaving directory `/home/eglic/src/org-mode'
> make: *** [update] Error 2
>
> This is using GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, GTK+ Version
> 2.22.0) of 2011-03-04 on yellow, modified by Debian
>

And with bleeding edge emacs (compiled from the repos yesterday), I'm
getting an additional error:

In toplevel form:
org-bibtex.el:114:1:Warning: global/dynamic var `description' lacks a prefix
org-bibtex.el:257:1:Error: Byte-compiling a redefinition of `get' will not work 
- use `labels' instead
make: *** [lisp/org-bibtex.elc] Error 1

Note: the description variable error has nothing to do with the recent
changes to org-bibtex.

Best,
Matt



[O] serious calendar integration bug

2011-04-28 Thread Matt Price
forgot to reply  to the list..

-- Forwarded message --
From: Matt Price 
Date: Wed, Apr 27, 2011 at 6:11 PM
Subject: Re: [O] serious calendar integration bug
To: David Maus 




On Wed, Apr 27, 2011 at 3:11 PM, David Maus  wrote:

> At Wed, 27 Apr 2011 11:06:38 -0400,
> Matt Price wrote:
> >
> > [1  ]
> >
> > [2  ]
> > Hi folks,
> >
> > Using a recent git version of org-mode (release_7.5.209.g1a687) with a
> fairly recent emacs-snapshot (20110408-1, a package from the debian
> emacs-snapshot ppa, but running under ubuntu maverick), I'm having a
> > really terrible calendar bug -- not sure if it comes from org or from
> emacs, but reporting here in case anyone else has seen it.  Attempts to
> insert a timestamped schedule or deadline using C-c C-s or C-c C-d
> > bring up an EMPTY buffer called Calendar, while REPLACING THE CONTENTS of
> the active buffer with the text of a calendar.  I had a near-catastrophic
> moment where I killed what I thought was a calendar buffer,
> > but then ended up erasing my main reference file for all my org notes.
> Has anyone seen this behaviour?  And do you think it comes form org or
> calendar?
>
> I can't reproduce this with
>
> GNU Emacs 24.0.50.1 (i486-pc-linux-gnu, GTK+ Version 2.24.3) of
>  2011-04-08 on cigue, modified by Debian
>
> Org-mode version 7.5 (release_7.5.211.gb0094)
>
> I also tried with release_7.5.209.g1a687 but no luck: I created a new
> Org buffer, entered a new headling and scheduling/deadlining with C-c
> C-s and C-c C-d worked as expected.
>
>
hmm.  There's definitely something funny going on, I presume with emacs
rather than org, and (again presumably) something to do with my configs or
installed packages. The function that's failing is org-eval-in-calendar:

 debug(error (wrong-type-argument window-live-p nil))
  select-window(nil)
  org-eval-in-calendar(nil t)

If we look at the defun:

(defun org-eval-in-calendar (form &optional keepdate)
  "Eval FORM in the calendar window and return to current window.
Also, store the cursor date in variable org-ans2."
  (let ((sf (selected-frame))
(sw (selected-window)))
(select-window (get-buffer-window "*Calendar*" t))
(eval form)
(when (and (not keepdate) (calendar-cursor-to-date))
  (let* ((date (calendar-cursor-to-date))
 (time (encode-time 0 0 0 (nth 1 date) (nth 0 date) (nth 2 date
(setq org-ans2 (format-time-string "%Y-%m-%d" time
(move-overlay org-date-ovl (1- (point)) (1+ (point)) (current-buffer))
(select-window sw)
(org-select-frame-set-input-focus sf)))

---
I think emacs is having trouble finding the buffer '*Calendar*' -- even
though it clearly exists and can be manually selected using C-x b.  I could
verify this by just eval-defun'ing this line:
(select-window (get-buffer-window "*Calendar*" t))

from the scratch buffer -- this produces the same backtrace.  However,
oddly, after experiencing the same issue about 6 times in a row, the problem
mysteriously disappeared just now, and the procedure is working fine.  I
have no idea what the issue is there -- I'll report when I find it again.
Maybe someone on the list can give me suggestions for debugging if it shows
up again?  Thanks,

Matt

Best,
>  -- David
>
> --
> OpenPGP... 0x99ADB83B5A4478E6
> Jabber dmj...@jabber.org
> Email. dm...@ictsoc.de
>


Re: [O] Making an index in latex export --- surprisingly difficult

2011-04-28 Thread Eric S Fraga
Robert Goldman  writes:

[...]

>> If the file is indeed in the /current/ directory, then a simple fix may
>> be to use %b for the file argument to makeindex?  I have no problems
>> with bibtex using
>> 
>> ,
>> | org-latex-to-pdf-process is a variable defined in `org-latex.el'.
>> | Its value is ("pdflatex %f" "bibtex %b" "pdflatex %f" "pdflatex %f")
>> `
>> 
>> Note the use of %b instead of %o or %f.  I've never used makeindex so
>> cannot be sure this would work.
>> 
>
> No, actually this does not work, since the expansion of %b is still an
> absolute pathname, rather than a relative pathname.  The only difference
> is that the file extension is removed.  Here's a snippet from my
> *trace-output* buffer when I trace the shell-command function:

Okay, you are correct!  I have sometimes used the following shell script
in lieu of the sequence of commands:

--8<---cut here---start->8---
#!/bin/sh -f
# first argument should be base latex file name but may be absolute
F=$1
B=$(basename $F)
echo 'Original file: ' $F
echo 'Base file: ' $B
echo 'Invoked in dir: ' $PWD
echo '- running pdflatex first 
---'
pdflatex $F
echo '- running bibtex next 
---'
bibtex  $B
echo '- running pdflatex again (and again) 
'
pdflatex $F
pdflatex $F
--8<---cut here---end--->8---

which is =/home/ucecesf/s/bin/org2pdf.sh= (for me). I then define

#+begin_src emacs-lisp
(setq org-latex-to-pdf-process '("/home/ucecesf/s/bin/org2pdf.sh %b"))
#+end_src

You could add a line of the form:

makeindex -o ${B}.ind ${B}.idx

to this script, probably before the bibtex line?

Of course, this doesn't some any of the other problems, as you note
below:

[...]

> The only "solution" I know (aside from disabling the texmf.cnf security
> setting) would be to have org ensure that its CWD is the document
> directory when running these programs and use relative pathnames.  I
> don't know that this solution is compatible with correct use of
> EXPORT_FILE_NAME, however

Yes, the same applies to my simple script above: it assumes that the
current directory *is* the one in which the files are.

> This seems like a very crippling security setting -- it would break many
> plausible uses of the tex suite when they are run under program control
> (I could easily imagine scenarios with make that would result in the use
> of absolute pathnames, too); I'm surprised it was made.

It does seem like a silly restriction.
-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.209.g1a687)



[O] [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index.

2011-04-28 Thread rpgoldman
From: Robert P. Goldman 

---
 lisp/org-latex.el |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index e7307ef..731d6e6 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -1775,6 +1775,8 @@ The conversion is made depending of STRING-BEFORE and 
STRING-AFTER."
(end-of-line 1)
(insert "\n")
 
+
+
 (defun org-export-latex-fixed-width (opt)
   "When OPT is non-nil convert fixed-width sections to LaTeX."
   (goto-char (point-min))
@@ -2322,6 +2324,17 @@ The conversion is made depending of STRING-BEFORE and 
STRING-AFTER."
 (and (looking-at "[ \t]*ORG-VERSE-END.*")
 (org-replace-match-keep-properties "\\end{verse}" t t)))
 
+  ;; Convert #+INDEX to LaTeX \\index.
+  (goto-char (point-min))
+  (while
+  (and
+   (let ((case-fold-search t))
+(re-search-forward "^[ \t]*#\\+index:[ \t]*\\(.*?\\)[ \t]*$" nil t))
+   (> (match-end 1) (match-beginning 1)))
+(let ((entry (match-string 1)))
+;;  (message "Found a #+INDEX match...")
+  (replace-match (format "\\index{%s}" entry) t t)))
+
   ;; Convert center
   (goto-char (point-min))
   (while (search-forward "ORG-CENTER-START" nil t)
-- 
1.7.3.5




[O] Translate #+INDEX to Latex \index{} on export

2011-04-28 Thread rpgoldman
The following email contains a patch that will cause the latex export
preprocessor to rewrite #+INDEX: lines in an org file into LaTeX style
\index{} entries.

As far as I can tell, this should be The Right Thing --- latex doesn't seem
to do anything bad if there are index entries without makeindex.  So no
downside.  And it doesn't seem right to have to do #+INDEX for HTML export
and #+LATEX: \index{} for latex export.

I believe that this should be complemented by some additional code that
would:

1. Add code to turn on and off index generation and appropriately add the
makeindex package and the \makeindex

2. Possibly add code to turn /off/ this translation in the case where the
user wishes to have HTML and Latex documents indexed differently.

Cheers,
r



Re: [O] Missing Introduction and About sections in LaTeX export

2011-04-28 Thread Nick Dokos
[forgot to cc: the list]

Sébastien Vauban  wrote:

> Hi Avdi,
> 
> Nick Dokos wrote:
> > Avdi Grimm  wrote:
> >> On Wed, Apr 27, 2011 at 5:41 PM, Nick Dokos  wrot=
> e:
> >> > Just star them by hand in the tex file after exporting for the last
> >> > time: it'll take two seconds. You may be able to do it from Org by
> >> > writing a custom function (C-h v org-export-latex-classes  for
> >> > details) but I suspect that the effort is just not worth it.
> >>=20
> >> Ugh. This is a (somewhat) living document; manually tweaking the .tex
> >> after export isn't really an option.
> >>=20
> >> I was hoping there was a tag or property that I could set on a section
> >> indicating it is frontmatter/backmatter.
> >
> > I don't know of an easy way within Org - somebody else might have better
> > ideas.
> >
> > If I were in your position, I'd probably write a simple Makefile to produ=
> ce
> > the PDF and incorporate a simple post-processing awk script to do the
> > transformation. Or write an elisp function to run as part of
> > org-export-latex-final-hook perhaps.
> 
> What about just inserting
> 
>   #+LaTeX: \backmatter{}
> 
> and the like where applicable in the Org file?
> 

>From a quick read of the description of \frontmatter, it is not clear to
me that it is going to work the way the OP wants, but it is indeed
worth trying: I forgot about that completely.

[trying it...]
I just ran a quick test: \frontmatter seems to be undefined in the
report class - it's only defined in the book class.

Thanks,
Nick



[O] Build error in git HEAD with org-bibtex.el

2011-04-28 Thread Christian Egli
Hi all

When doing a `make update` I get the following compile error:

~/src/org-mode $ make update
git pull
Already up-to-date.
/usr/bin/make clean
make[1]: Entering directory `/home/eglic/src/org-mode'
[snip]
emacs -batch -q -no-site-file -eval "(setq load-path (cons (expand-file-name 
\"./lisp/\") (cons \"/usr/local/share/emacs/site-lisp\" load-path)))" -f 
batch-byte-compile lisp/org-bibtex.el

In toplevel form:
lisp/org-bibtex.el:257:8:Error: Byte-compiling a redefinition of `get' will not 
work - use `labels' instead
make[1]: *** [lisp/org-bibtex.elc] Error 1
make[1]: Leaving directory `/home/eglic/src/org-mode'
make: *** [update] Error 2

This is using GNU Emacs 23.1.1 (x86_64-pc-linux-gnu, GTK+ Version 2.22.0) of 
2011-03-04 on yellow, modified by Debian

Thanks
Christian
-- 
Christian Egli
Swiss Library for the Blind, Visually Impaired and Print Disabled
Grubenstrasse 12, CH-8045 Zürich, Switzerland




Re: [O] Missing Introduction and About sections in LaTeX export

2011-04-28 Thread Eric S Fraga
Avdi Grimm  writes:

> Update: my initial problem with missing sections has gone away as
> mysteriously as it came.

Just to add that I do have similar problems every now and again: some
sections fail to export, usually the first or first two.  Subsequently,
after editing the document, these sections re-appear in the exported
document.  The problem is only with latex export when this happens:
other export targets will export everything I expect.  This has been
happening to me for >1 year but very sporadically and infrequently and
I've not seen it recently... (fingers crossed).

I've never managed to create a minimal example that illustrates this
bug, however, so it has been difficult to debug (or pose the problem
clearly enough for others to debug).

You have not imagined it! ;-)

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.209.g1a687)



Re: [O] Making an index in latex export --- surprisingly difficult

2011-04-28 Thread Robert Goldman
On 4/28/11 Apr 28 -4:28 AM, Eric S Fraga wrote:
> Robert Goldman  writes:
> 
> [...]
> 
>> I looked at that thread and unfortunately it petered out (partly because
>> it went off into a different direction to solve an easier problem with
>> conflicting style files).
>>
>> The last message from Eric Fraga states:
>>
>>> Oh well, there goes that theory.  The web link you gave yesterday
>>> would seem to indicate that the problem is present if you invoke the
>>> bibtex command from another directory and this does not appear to be
>>> the case here.  Very strange.
>>
>> It's not actually invoking the bibtex command from another directory,
>> AFAICT, but invoking the bibtex command on an argument that is an
>> /absolute/ pathname.  This is now forbidden for makeindex and bibtex (I
>> don't know if it's permitted for pdflatex or not, but I suspect it is,
>> since the pdflatex part of the export process is working --- pdflatex
>> may not honor openout_any=p).
> 
> If the file is indeed in the /current/ directory, then a simple fix may
> be to use %b for the file argument to makeindex?  I have no problems
> with bibtex using
> 
> ,
> | org-latex-to-pdf-process is a variable defined in `org-latex.el'.
> | Its value is ("pdflatex %f" "bibtex %b" "pdflatex %f" "pdflatex %f")
> `
> 
> Note the use of %b instead of %o or %f.  I've never used makeindex so
> cannot be sure this would work.
> 

No, actually this does not work, since the expansion of %b is still an
absolute pathname, rather than a relative pathname.  The only difference
is that the file extension is removed.  Here's a snippet from my
*trace-output* buffer when I trace the shell-command function:

command="makeindex -o
/Users/rpg/obtw/obtw-trunk/memos/plan-representation/manual.ind
/Users/rpg/obtw/obtw-trunk/memos/plan-representation/manual.idx"

The entry from my org-latex-to-pdf-process is:

"makeindex -o %b.ind %b.idx"

So using the basename is orthogonal to the underlying problem, which is
that absolute pathnames are always used.

When I restore the openout_any = p setting, I see:

rpg% makeindex -o
/Users/rpg/obtw/obtw-trunk/memos/plan-representation/manual.ind
/Users/rpg/obtw/obtw-trunk/memos/plan-representation/manual.idx


makeindex: Not writing to
/Users/rpg/obtw/obtw-trunk/memos/plan-representation/manual.ind
(openout_any = p).
Can't create output index file
/Users/rpg/obtw/obtw-trunk/memos/plan-representation/manual.ind.

Note that this isn't something one needs any org-mode testing to verify
--- you can just figure out what %b will expand to, and test
interactively with the shell using makeindex or bibtex, if you have a
recent texlive, with the paranoid settings.

The only "solution" I know (aside from disabling the texmf.cnf security
setting) would be to have org ensure that its CWD is the document
directory when running these programs and use relative pathnames.  I
don't know that this solution is compatible with correct use of
EXPORT_FILE_NAME, however

This seems like a very crippling security setting -- it would break many
plausible uses of the tex suite when they are run under program control
(I could easily imagine scenarios with make that would result in the use
of absolute pathnames, too); I'm surprised it was made.

Best,
r



Re: [O] Conflict between Org-Mode versions?

2011-04-28 Thread Eric S Fraga
Michael Hannon  writes:

[...]

> FWIW, in Emacs I typed:
>
>     C-h v org
>
> and got no fewer than 931 completions.  A lot of knobs to turn!

yes, indeed!  the info manual is your friend here.  it is very difficult
to figure out what you need to set from just the list of org- variables.

>
>>> 
>>>     (2) When I use the construct:
>>> 
>>>             [[URL] [description]]
>
>>                    ^
>>                    ^                
>>No space here       ^
>
>>>         the line does NOT collapse to:
>>> 
>>>             "description"
>>> 
>>>         when I add the closing bracket, and if I export to HTML or PDF, I
>>>         get the whole ugly line, brackets and all.
>
> Yep, omitting the space fixed the problem.  I guess I've got a knee-jerk
> instinct to try to "pretty print", and I didn't notice the the "][" brackets
> were contiguous in the example.

The best approach here is to use some of the specific functions (often
with already defined key bindings) that are set up for just this type of
case: =org-insert-link= in this case.  These will insert things with the
right formatting automatically!

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.209.g1a687)



Re: [O] Maxima persistence between code blocks

2011-04-28 Thread Eric S Fraga
Derek Thomas  writes:

> I'm interested in using org-mode with babel to organize my maxima
> code.  Am I correct in my reading of ob-maxima.el that the babel
> module for maxima doesn't support persistent variables between code
> blocks?  

Correct, basically.

> If so, this seems like a severe limitation.

There are solutions (see below), but their suitability will depend on
*your* use case.  What specifically can you not do currently that you
would like to do (or do more easily)?

> I did some
> searching and found this guide
> (http://www.math.utexas.edu/pipermail/maxima/2010/021027.html) for
> setting up a local maxima "server".  
>
> I'm trying to implement an org
> interface to this process, but my elisp skills are extremely
> rudimentary.  If anyone has any suggestions or recommendations for
> code that does something similar, that would be great.  Thanks,

For org + babel, the more appropriate solution might be to add session
support for maxima.  In principle, this should be possible as one can
have a maxima inferior process; there is no need to re-invent the wheel
as described above basically.  However, I am not sure how to go about
doing this.  I'll investigate when I have some time (but am not
promising anything soon unfortunately) but maybe you could have a look.
Check out other babel languages that provide session support (R?).

In the meantime, there are two alternatives, which I use all the time,
which may help: code tangling =(info "(org) Extracting source code")=
and noweb =(info "(org) Noweb reference syntax")=.  I use the latter
frequently:

--8<---cut here---start->8---

#+srcname: units
#+begin_src maxima
h: 3600*s$
day: 24*h$
#+end_src

#+srcname: unitstest
#+begin_src maxima :results output :exports results :noweb yes
<>
solution: solve([m = 2*day], [m]),numer$
print(solution);
#+end_src

#+results: unitstest
: [m = 172800 s] 

--8<---cut here---end--->8---

Note the =<>= reference in the latter code block.

HTH,
eric

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.209.g1a687)



Re: [O] Making an index in latex export --- surprisingly difficult

2011-04-28 Thread Eric S Fraga
Robert Goldman  writes:

[...]

> I looked at that thread and unfortunately it petered out (partly because
> it went off into a different direction to solve an easier problem with
> conflicting style files).
>
> The last message from Eric Fraga states:
>
>> Oh well, there goes that theory.  The web link you gave yesterday
>> would seem to indicate that the problem is present if you invoke the
>> bibtex command from another directory and this does not appear to be
>> the case here.  Very strange.
>
> It's not actually invoking the bibtex command from another directory,
> AFAICT, but invoking the bibtex command on an argument that is an
> /absolute/ pathname.  This is now forbidden for makeindex and bibtex (I
> don't know if it's permitted for pdflatex or not, but I suspect it is,
> since the pdflatex part of the export process is working --- pdflatex
> may not honor openout_any=p).

If the file is indeed in the /current/ directory, then a simple fix may
be to use %b for the file argument to makeindex?  I have no problems
with bibtex using

,
| org-latex-to-pdf-process is a variable defined in `org-latex.el'.
| Its value is ("pdflatex %f" "bibtex %b" "pdflatex %f" "pdflatex %f")
`

Note the use of %b instead of %o or %f.  I've never used makeindex so
cannot be sure this would work.

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.209.g1a687)



Re: [O] Implemented word count for subtrees

2011-04-28 Thread Eric S Fraga
Sébastien Vauban  writes:

> Hi Simon,
>
> Simon Guest wrote:
>> Dear Org mode people,
>>
>> I implemented word counting for Org mode sub-trees.  That is, count
>> each sub-tree, and accumulate totals into the parent heading lines.
>> Others have asked about this, so I attach my code below.
>
> Another suggestion: a variable to choose between a word-count and a
> line-count?

Or display both at the same time?  =NNN/MM=?
-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.209.g1a687)



Re: [O] Implemented word count for subtrees

2011-04-28 Thread Eric S Fraga
Simon Guest  writes:

> At Wed, 27 Apr 2011 18:51:06 +0100,
> Eric S Fraga wrote:
>> This is quite nice.  Thanks!
>> 
>
>> I cannot help you with the mark problem; hopefully others can.
>> 
>> One suggestion, however: I wonder if you could introduce the word count
>> in a different way?  I do use my headings and having the dots and the
>> actual count inserted is not great (although easy work around:
>> org-wc-display and then undo immediately after looking at the
>> counts...).  Maybe you could automatically define a tag for each
>> heading, something like :wc:?  Of course, this won't be good for
>> anybody that wishes to export documents *with* tags...
>> 
>> Anyway, I've incorporated your code into my emacs configuration.  Thanks
>> again!
>
> Hi Eric,
>
> Thanks for your comments.
>
> The counts are not actually inserted as text in the file.  It's just
> an overlay, done with text properties like the clock durations (from
> where I stole the code).  They don't get saved in the file, and in
> fact as soon as you edit the buffer, they all disappear.  At least,
> they do for me.
>
> Does it do something different for you?  If so, it may be something to
> do with the file coding system that is letting them get saved.  Is
> your Org mode file a simple ASCII file, or something else?

Ah, I see that the counts do disappear as soon as I do anything.  My
confusion came about because as soon as I invoke =org-wc-display=, my
buffer becomes /modified/ which led me believe that the counts were
actually inserted into the document.As they are not inserted, please
ignore my previous comments.

However, it would be helpful if the modification flag were not changed
by asking for the word count.  I don't know enough elisp to suggest what
to change but you should be able to add the text properties without
causing the buffer modification flag to change?  Column view, for
instance, doesn't do this.

Thanks again,
eric

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.209.g1a687)



Re: [O] Missing Introduction and About sections in LaTeX export

2011-04-28 Thread Sébastien Vauban
Hi Avdi,

Nick Dokos wrote:
> Avdi Grimm  wrote:
>> On Wed, Apr 27, 2011 at 5:41 PM, Nick Dokos  wrote:
>> > Just star them by hand in the tex file after exporting for the last
>> > time: it'll take two seconds. You may be able to do it from Org by
>> > writing a custom function (C-h v org-export-latex-classes  for
>> > details) but I suspect that the effort is just not worth it.
>> 
>> Ugh. This is a (somewhat) living document; manually tweaking the .tex
>> after export isn't really an option.
>> 
>> I was hoping there was a tag or property that I could set on a section
>> indicating it is frontmatter/backmatter.
>
> I don't know of an easy way within Org - somebody else might have better
> ideas.
>
> If I were in your position, I'd probably write a simple Makefile to produce
> the PDF and incorporate a simple post-processing awk script to do the
> transformation. Or write an elisp function to run as part of
> org-export-latex-final-hook perhaps.

What about just inserting

  #+LaTeX: \backmatter{}

and the like where applicable in the Org file?

Best regards,
  Seb

-- 
Sébastien Vauban




Re: [O] Implemented word count for subtrees

2011-04-28 Thread Sébastien Vauban
Hi Simon,

Simon Guest wrote:
> Dear Org mode people,
>
> I implemented word counting for Org mode sub-trees.  That is, count
> each sub-tree, and accumulate totals into the parent heading lines.
> Others have asked about this, so I attach my code below.

Another suggestion: a variable to choose between a word-count and a
line-count?

Just thinking at that because of the Org-clone in VIM...

Best regards,
  Seb

-- 
Sébastien Vauban




Re: [O] example or source blocks with captions

2011-04-28 Thread Sébastien Vauban
Hi Thomas,

"Thomas S. Dye" wrote:
> A while back I took a stab at an overly ambitious project that I've
> subsequently dropped. In that project I did manage to establish captions
> that work with org-special-blocks. What follows is a cut and paste job from
> the bones of the project that might help you solve the problem of captioning
> constructs other than figures and tables. It was aimed primarily at LaTeX
> export, but I seem to recall that it worked for html as well.
>
> All the best,
> Tom
>
> This link establishes a caption that works with both LaTeX and html and can
> be used to mark blocks that Org-mode doesn't recognize by default. Note that
> you currently have to enter these links by hand and not with the usual
> =org-insert-link= function, which doesn't allow spaces in the =PATH=
> argument.
>
> #+BEGIN_listing
> # <>
> #+source: define-caption-link
> #+begin_src emacs-lisp :exports code
>(org-add-link-type
> "caption" nil
> (lambda (path desc format)
>   (cond
>((eq format 'html)
> (format "%s" desc))
>((eq format 'latex)
> (format "\\caption[%s]{%s}" path desc)
> #+end_src
> [[caption:A new caption link type][A new caption link type.]]
> # <>
> #+END_listing
>
> Block-level markup is accomplished with the help of the
> [[latex:package][org-special-blocks]] package. It is used in this file to
> wrap the [[latex:progstruct][listing]] environment defined by the
> [[latex:package][minted]] package around a source code block to get a
> floating listing in the LaTeX document.

Interesting read. Could you share the definition of your `latex' link type?

Best regards,
  Seb

-- 
Sébastien Vauban