Re: [O] org-capture in message-mode buffer

2011-05-08 Thread Leo
On 2011-05-05 17:19 +0800, Ulf Stegemann wrote:
[elide 4 lines]
> This sounds interesting (at least for those that use gmail).  Is the URL
> where the archived message will be available predictable, i.e. is it
> possible to know it while still composing the message?  If yes, it would
> be great to expand `org-gnus-store-link' to either use a Gnus archive
> group (Gcc) or a gmail one.

I have started using latest No Gnus and realised the Gcc header is now
enabled per default. But after some trial I turned it off anyway. I use
gmail smtp which does the archiving automatically. I don't know enough
whether that is predictable.

Leo




Re: [O] Agenda todo filter order

2011-05-08 Thread Bernt Hansen
Carsten Dominik  writes:

> On 6.5.2011, at 19:40, Bernt Hansen wrote:
>
>> Hi Carsten,
>> 
>> Thanks for the patch!  This almost does what I want :)
>> 
>> This patch works for TODO agendas but not tags match agendas which is
>> what I am trying to use.
>> 
>> C-c a y returns the result I want
>> C-c a x should be identical and is not.
>
>
> Hi Bernt,
>
> here is a patch to *replace* the other patch I sent earlier.  This one
> should also work for tags-todo searches
>
> Completely untested..
>

Thanks!  I'll try that out shortly and report back.

Regards,
Bernt



Re: [O] Agenda todo filter order

2011-05-08 Thread Bernt Hansen
Carsten Dominik  writes:

> On 6.5.2011, at 19:40, Bernt Hansen wrote:
>
>> Hi Carsten,
>> 
>> Thanks for the patch!  This almost does what I want :)
>> 
>> This patch works for TODO agendas but not tags match agendas which is
>> what I am trying to use.
>> 
>> C-c a y returns the result I want
>> C-c a x should be identical and is not.
>
>
> Hi Bernt,
>
> here is a patch to *replace* the other patch I sent earlier.  This one
> should also work for tags-todo searches
>
> Completely untested..

Hi Carsten,

This patch works for me.  I'll be running with it on my master branch
until further notice.

Thanks!!

Bernt



Re: [O] Agenda todo filter order

2011-05-08 Thread Bernt Hansen
Bernt Hansen  writes:

> Carsten Dominik  writes:
>
>> On 6.5.2011, at 19:40, Bernt Hansen wrote:
>>
>>> Hi Carsten,
>>> 
>>> Thanks for the patch!  This almost does what I want :)
>>> 
>>> This patch works for TODO agendas but not tags match agendas which is
>>> what I am trying to use.
>>> 
>>> C-c a y returns the result I want
>>> C-c a x should be identical and is not.
>>
>>
>> Hi Bernt,
>>
>> here is a patch to *replace* the other patch I sent earlier.  This one
>> should also work for tags-todo searches
>>
>> Completely untested..
>
> Hi Carsten,
>
> This patch works for me.  I'll be running with it on my master branch
> until further notice.
>
> Thanks!!
>
> Bernt

Bah.  I spoke too soon on that.  It works great for the minimal example
I sent earlier but as soon as I applied to to my regular files my list
of REFILE tasks is broken.

   (tags "LEVEL=1+REFILE"
 ((org-agenda-overriding-header "Notes and Tasks to Refile")
  (org-agenda-overriding-header "Tasks to Refile")))

This now returns tasks without REFILE as a tag -- I think maybe it's
getting ALL level 1 headings.

So tag filtering is broken with this patch.

-Bernt



Re: [O] insert picture feature request.

2011-05-08 Thread Mark S.
Thanks Aankhen.

That seems to have fixed the technical problem. Unfortunately, because of the 
way irfan works, all I was able to get pictures of was the emacs screen! People 
with lots of screen real-estate can have emacs and their target application up 
at the same time, but that doesn't work on my older screen.

So instead, I have the code grab whatever is in the clipboard and use it. Then 
if I want a screen capture, I can use whatever tool is available. Surfulator 
has a really nice free screen capture. Also, with this approach I can 
right-click on images in the browser, click "copy image" and use those images 
directly. 

As for viewing, the only way I know is to export to HTML. Ctl-c e b is quick. I 
vaguely remember that there is a way to actually view images inline in Emacs, 
but its not portable or something.

Modified code below.

Thanks!
Mark

(defun org-screenshot ()
  "Take a screenshot into a time stamped
   unique-named file in the same directory as
   the org-buffer and insert a link to this file."
  (interactive)
  (setq filename
   (convert-standard-filename
(concat
 (make-temp-name
  (concat (buffer-file-name)
  "_"
  (format-time-string
   "%Y%m%d_%H%M%S_")) ) ".png")))
  (call-process "C:\\Program Files\\IrfanView\\i_view32.exe" nil nil nil
"/clippaste" (concat "/convert=" filename) )
  (insert (concat "[[" filename "]]"))
  (org-display-inline-images))


--- On Sat, 5/7/11, Aankhen wrote:

> Subject: Re: [O] insert picture feature request.
> 
> I believe ‘convert-standard-filename’ should do it:
> 
> ,
> | (defun org-screenshot ()
> |  "Take a screenshot into a time stamped
> |   unique-named file in the same directory
> as
> |   the org-buffer and insert a link to this
> file."
> |  (interactive)
> |  (setq filename
> |        (convert-standard-filename
> |         (concat
> |          (make-temp-name
> |           (concat
> (buffer-file-name)
> |               
>    "_"
> |               
>    (format-time-string
> |               
>     "%Y%m%d_%H%M%S_")) ) ".png")))
> |  (call-process "i_view32.exe" nil nil nil
> |               
> "/capture=2" (concat "/convert=" filename) )
> |  (insert (concat "[[" filename "]]"))
> |  (org-display-inline-images))
> `
> 
> Seems to work here, although I’m unable to get the
> resulting image to
> display inline.
> 
> Aankhen
>



Re: [O] insert picture feature request.

2011-05-08 Thread Mark S.
Additional thought. Having all those pngs in the main directory will get messy. 
I would like to put them in a sub-directory like "images". But there doesn't 
seem to be an easy way to insert that into (buffer-file-name). I've looked, but 
can't seem to be a variable that just holds the current buffer directory. Where 
would I start?

Thanks!
Mark

--- On Sun, 5/8/11, Mark S.  wrote:

> From: Mark S. 
> Subject: Re: [O] insert picture feature request.
> To: emacs-orgmode@gnu.org
> Date: Sunday, May 8, 2011, 9:28 AM
> Thanks Aankhen.
> 
> That seems to have fixed the technical problem.
> Unfortunately, because of the way irfan works, all I was
> able to get pictures of was the emacs screen! People with
> lots of screen real-estate can have emacs and their target
> application up at the same time, but that doesn't work on my
> older screen.
> 
> So instead, I have the code grab whatever is in the
> clipboard and use it. Then if I want a screen capture, I can
> use whatever tool is available. Surfulator has a really nice
> free screen capture. Also, with this approach I can
> right-click on images in the browser, click "copy image" and
> use those images directly. 
> 
> As for viewing, the only way I know is to export to HTML.
> Ctl-c e b is quick. I vaguely remember that there is a way
> to actually view images inline in Emacs, but its not
> portable or something.
> 
> Modified code below.
> 
> Thanks!
> Mark
> 
> (defun org-screenshot ()
>   "Take a screenshot into a time stamped
>    unique-named file in the same directory
> as
>    the org-buffer and insert a link to this
> file."
>   (interactive)
>   (setq filename
>        (convert-standard-filename
>         (concat
>          (make-temp-name
>           (concat
> (buffer-file-name)
>                
>   "_"
>                
>   (format-time-string
>                
>    "%Y%m%d_%H%M%S_")) ) ".png")))
>   (call-process "C:\\Program
> Files\\IrfanView\\i_view32.exe" nil nil nil
>                
> "/clippaste" (concat "/convert=" filename) )
>   (insert (concat "[[" filename "]]"))
>   (org-display-inline-images))
> 
> 
> --- On Sat, 5/7/11, Aankhen wrote:
> 
> > Subject: Re: [O] insert picture feature request.
> > 
> > I believe ‘convert-standard-filename’ should do
> it:
> > 
> > ,
> > | (defun org-screenshot ()
> > |  "Take a screenshot into a time stamped
> > |   unique-named file in the same directory
> > as
> > |   the org-buffer and insert a link to this
> > file."
> > |  (interactive)
> > |  (setq filename
> > |        (convert-standard-filename
> > |         (concat
> > |          (make-temp-name
> > |           (concat
> > (buffer-file-name)
> > |               
> >    "_"
> > |               
> >    (format-time-string
> > |               
> >     "%Y%m%d_%H%M%S_")) ) ".png")))
> > |  (call-process "i_view32.exe" nil nil nil
> > |               
> > "/capture=2" (concat "/convert=" filename) )
> > |  (insert (concat "[[" filename "]]"))
> > |  (org-display-inline-images))
> > `
> > 
> > Seems to work here, although I’m unable to get the
> > resulting image to
> > display inline.
> > 
> > Aankhen
> >
> 
>



[O] [PATCH] Optional \caption argument for LaTeX export

2011-05-08 Thread Thomas S. Dye
Aloha all,

The attached patch initializes the existing variable shortn, adds it to
two caption situations in addition to the one already coded, and adds
some description to the manual.

With this patch, #+CAPTION: [Short caption]{Long caption.} in the
Org-mode source exports to \caption[Short caption]{Long caption.} in the
LaTeX export, which is, I think, as it should be.

Many thanks to Nick Dokos who made me understand why earlier patches
hadn't shown up on the patchwork server (wrong mime type, evil mail
client).  This one sent with gnus and fingers crossed.

All the best,
Tom

>From 9dc65f7e598dd171ebce9448cd39c4062f7cafff Mon Sep 17 00:00:00 2001
From: Tom Dye 
Date: Sun, 8 May 2011 06:56:25 -1000
Subject: [PATCH] optional caption arguments in LaTeX export

---
 doc/org.texi  |5 +
 lisp/org-exp.el   |2 +-
 lisp/org-latex.el |4 ++--
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 844de6d..3988838 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -8817,6 +8817,11 @@ the object with @code{\ref@{tab:basic-data@}}:
|-||
 @end example
 
+Optionally, the caption can take the form:
+@example
+#+CAPTION: [Caption for list of figures]{Caption for table (or link).}
+@end example
+
 @cindex inlined images, markup rules
 Some backends (HTML, @LaTeX{}, and DocBook) allow you to directly include
 images into the exported document.  Org does this, if a link to an image
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index cda1f98..e840b6c 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -1871,7 +1871,7 @@ table line.  If it is a link, add it to the line containing the link."
    'org-label label))
 	(if label (push (cons label label) target-alist))
 	(goto-char end)
-	(setq cap nil attr nil label nil)
+	(setq cap nil shortn nil attr nil label nil)
   target-alist)
 
 (defun org-export-remove-comment-blocks-and-subtrees ()
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index bc9a3f3..516ee12 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -2199,12 +2199,12 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 	   (multicolumnp "\\begin{figure*}%placement
 \\centering
 \\includegraphics[%attr]{%path}
-\\caption{%labelcmd%caption}
+\\caption%shortn{%labelcmd%caption}
 \\end{figure*}")
 	   (floatp "\\begin{figure}%placement
 \\centering
 \\includegraphics[%attr]{%path}
-\\caption{%labelcmd%caption}
+\\caption%shortn{%labelcmd%caption}
 \\end{figure}")
 	   (t "\\includegraphics[%attr]{%path}")))
 
-- 
1.7.1



-- 
Thomas S. Dye
http://www.tsdye.com


Re: [O] [Accepted] Making the output of %% functions linkable in agenda views

2011-05-08 Thread Carsten Dominik

On 7.5.2011, at 17:20, Bert Burgemeister wrote:

> Matt Lundin  writes:
> 
>> Bert Burgemeister  writes:
>> 
>>> Just curious, is there anything I should have known that prevented the
>>> patch submitted in http://article.gmane.org/gmane.emacs.orgmode/39313,
>> 
>> Is it still in the bugtracker, or was it rejected?
> 
> Yes, and no.
> 
>> With your patch, what would happen if there were two or more links in
>> the headline?
>> 
>> * Two links
>> %%(format "%s" (concat "[[elisp:(info)]" "[Link to info]]"))
>> http://www.orgmode.org
>> 
>> This entry would show up in the agenda as:
>> 
>>  org:  [[elisp:(info)][Link to info]]
>> 
>> But AFAICT, hitting C-c C-o in the agenda-buffer (even on the elisp
>> link) would jump immediately to http://www.orgmode.org, bypassing the
>> opportunity to select the the %%(...) generated link.
> 
> That's true and your patch reduces org-mode's LOC, so you win.

Hi Bert,

does this mean

http://patchwork.newartisans.com/patch/681/

is now obsolete?

Thanks.

- Carsten

> 
> -- 
> Bert
> 
> 




Re: [O] [PATCH] Optional \caption argument for LaTeX export

2011-05-08 Thread Bernt Hansen
t...@tsdye.com (Thomas S. Dye) writes:

> With this patch, #+CAPTION: [Short caption]{Long caption.} in the
> Org-mode source exports to \caption[Short caption]{Long caption.} in the
> LaTeX export, which is, I think, as it should be.

Hi Thomas,

Thanks for the patch!

Please add the above details (without the 'With this patch' and ', which
is, I think, as it should be') to body of the commit message (starting
on line 3).  This makes it possible to read just the commit log message
6 months from now and know what the patch is about without the necessity
of reading the code changes.

Regards,
Bernt



Re: [O] insert picture feature request.

2011-05-08 Thread Nick Dokos
Mark S.  wrote:

> Additional thought. Having all those pngs in the main directory will
> get messy. I would like to put them in a sub-directory like
> "images". But there doesn't seem to be an easy way to insert that into
> (buffer-file-name). I've looked, but can't seem to be a variable that
> just holds the current buffer directory. Where would I start?
> 

C-h f file-name-directory 
C-h f file-name-nondirectory 

Nick



Re: [O] [PATCH] Optional \caption argument for LaTeX export

2011-05-08 Thread Thomas S. Dye
Bernt Hansen  writes:

> t...@tsdye.com (Thomas S. Dye) writes:
>
>> With this patch, #+CAPTION: [Short caption]{Long caption.} in the
>> Org-mode source exports to \caption[Short caption]{Long caption.} in the
>> LaTeX export, which is, I think, as it should be.
>
> Hi Thomas,
>
> Thanks for the patch!
>
> Please add the above details (without the 'With this patch' and ', which
> is, I think, as it should be') to body of the commit message (starting
> on line 3).  This makes it possible to read just the commit log message
> 6 months from now and know what the patch is about without the necessity
> of reading the code changes.
>
> Regards,
> Bernt
>

6 months ... yikes!

I think this is what you're asking for.  Let me know if it falls short.

All the best,
Tom

>From 37eba27e80a84175e09b01e7125269154c40396d Mon Sep 17 00:00:00 2001
From: Tom Dye 
Date: Sun, 8 May 2011 13:16:15 -1000
Subject: [PATCH] Activate optional argument to LaTeX caption command.
 CAPTION: [Short caption]{Long caption.} in the Org-mode source exports to \caption[Short caption]{Long caption.} in theLaTeX export.

---
 doc/org.texi  |6 ++
 lisp/org-exp.el   |2 +-
 lisp/org-latex.el |4 ++--
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 844de6d..8058288 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -8817,6 +8817,12 @@ the object with @code{\ref@{tab:basic-data@}}:
|-||
 @end example
 
+Optionally, the caption can take the form:
+@example
+#+CAPTION: [Caption for list of figures]{Caption for table (or link).}
+@end example
+
+
 @cindex inlined images, markup rules
 Some backends (HTML, @LaTeX{}, and DocBook) allow you to directly include
 images into the exported document.  Org does this, if a link to an image
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index cda1f98..e840b6c 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -1871,7 +1871,7 @@ table line.  If it is a link, add it to the line containing the link."
    'org-label label))
 	(if label (push (cons label label) target-alist))
 	(goto-char end)
-	(setq cap nil attr nil label nil)
+	(setq cap nil shortn nil attr nil label nil)
   target-alist)
 
 (defun org-export-remove-comment-blocks-and-subtrees ()
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index bc9a3f3..516ee12 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -2199,12 +2199,12 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 	   (multicolumnp "\\begin{figure*}%placement
 \\centering
 \\includegraphics[%attr]{%path}
-\\caption{%labelcmd%caption}
+\\caption%shortn{%labelcmd%caption}
 \\end{figure*}")
 	   (floatp "\\begin{figure}%placement
 \\centering
 \\includegraphics[%attr]{%path}
-\\caption{%labelcmd%caption}
+\\caption%shortn{%labelcmd%caption}
 \\end{figure}")
 	   (t "\\includegraphics[%attr]{%path}")))
 
-- 
1.7.1


-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com


Re: [O] insert picture feature request.

2011-05-08 Thread Mark S.
Thanks Nick!

Revised code below with your help. Note that I've changed the name of function 
to reflect the fact that we're using the clipboard for the shot. Also, needed 
"file:" in the insert name for the inline images to view directly.

Note to Aankhen: To get inline images to work, you need to install the PNG and 
JPEG libraries from http://gnuwin32.sourceforge.net/ . Then put the resulting 
C:...gnuwin32/bin directory in your windows system path. Maybe everyone here 
already knew this, but I had to spend a bit of time to work it out.

Thanks!
Mark


(defun org-clipshot ()
  "Take a screenshot into a time stamped
   unique-named file in the same directory as
   the org-buffer and insert a link to this file."
  (interactive)
  (setq filename
   (convert-standard-filename
(concat
 (make-temp-name
  (concat 
;;  (buffer-file-name)
 (file-name-directory (buffer-file-name))
  "images/"
 (file-name-nondirectory (buffer-file-name))
  "_"
  (format-time-string
   "%Y%m%d_%H%M%S_")) ) ".png")))
  (call-process "C:\\Program Files\\IrfanView\\i_view32.exe" nil nil nil
"/clippaste" (concat "/convert=" filename) )
  (insert (concat "[[file:" filename "]]"))
  (org-display-inline-images))




--- On Sun, 5/8/11, Nick Dokos  wrote:

> From: Nick Dokos 
> Subject: Re: [O] insert picture feature request.
> To: "Mark S." 
> Cc: nicholas.do...@hp.com, emacs-orgmode@gnu.org
> Date: Sunday, May 8, 2011, 4:11 PM
> Mark S. 
> wrote:
> 
> > Additional thought. Having all those pngs in the main
> directory will
> > get messy. I would like to put them in a sub-directory
> like
> > "images". But there doesn't seem to be an easy way to
> insert that into
> > (buffer-file-name). I've looked, but can't seem to be
> a variable that
> > just holds the current buffer directory. Where would I
> start?
> > 
> 
> C-h f file-name-directory 
> C-h f file-name-nondirectory 
> 
> Nick
> 
> 



Re: [O] [PATCH] Optional \caption argument for LaTeX export

2011-05-08 Thread Bernt Hansen
t...@tsdye.com (Thomas S. Dye) writes:

> Bernt Hansen  writes:
>
>> t...@tsdye.com (Thomas S. Dye) writes:
>>
>>> With this patch, #+CAPTION: [Short caption]{Long caption.} in the
>>> Org-mode source exports to \caption[Short caption]{Long caption.} in the
>>> LaTeX export, which is, I think, as it should be.
>>
>> Hi Thomas,
>>
>> Thanks for the patch!
>>
>> Please add the above details (without the 'With this patch' and ', which
>> is, I think, as it should be') to body of the commit message (starting
>> on line 3).  This makes it possible to read just the commit log message
>> 6 months from now and know what the patch is about without the necessity
>> of reading the code changes.
>>
>> Regards,
>> Bernt
>>
>
> 6 months ... yikes!
>
> I think this is what you're asking for.  Let me know if it falls short.

Close :)

The attached patch would be better I think.  After applying it 
git log shows the following:

,
| ~/git/org-mode$ git log -1
| commit cec944435abb688dd1e4b5acbe6d9bcc557c171b
| Author: Tom Dye 
| Date:   Sun May 8 13:16:15 2011 -1000
| 
| Activate optional argument to LaTeX caption command
| 
| * doc/org.texi (Images and tables): Document optional #+CAPTION: form
| * lisp/org-exp.el: Add support for optional caption form
| * lisp/org-latex.el: Add support for optional caption form
| 
| Captions of the form
|#+CAPTION: [Short caption]{Long caption.}
| export to
|\caption[Short caption]{Long caption.} in the LaTeX export.
`

git needs the blank line separating the subject from the body and I've
added the changelog entries (although you might want to reword them if
they are incorrect.

The updated patch is attached.

Regards,
Bernt

>From 37eba27e80a84175e09b01e7125269154c40396d Mon Sep 17 00:00:00 2001
From: Tom Dye 
Date: Sun, 8 May 2011 13:16:15 -1000
Subject: [PATCH] Activate optional argument to LaTeX caption command

* doc/org.texi (Images and tables): Document optional #+CAPTION: form
* lisp/org-exp.el: Add support for optional caption form
* lisp/org-latex.el: Add support for optional caption form

Captions of the form
   #+CAPTION: [Short caption]{Long caption.}
export to
   \caption[Short caption]{Long caption.} in the LaTeX export.
---
 doc/org.texi  |6 ++
 lisp/org-exp.el   |2 +-
 lisp/org-latex.el |4 ++--
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 844de6d..8058288 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -8817,6 +8817,12 @@ the object with @code{\ref@{tab:basic-data@}}:
|-||
 @end example
 
+Optionally, the caption can take the form:
+@example
+#+CAPTION: [Caption for list of figures]{Caption for table (or link).}
+@end example
+
+
 @cindex inlined images, markup rules
 Some backends (HTML, @LaTeX{}, and DocBook) allow you to directly include
 images into the exported document.  Org does this, if a link to an image
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index cda1f98..e840b6c 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -1871,7 +1871,7 @@ table line.  If it is a link, add it to the line containing the link."
    'org-label label))
 	(if label (push (cons label label) target-alist))
 	(goto-char end)
-	(setq cap nil attr nil label nil)
+	(setq cap nil shortn nil attr nil label nil)
   target-alist)
 
 (defun org-export-remove-comment-blocks-and-subtrees ()
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index bc9a3f3..516ee12 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -2199,12 +2199,12 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 	   (multicolumnp "\\begin{figure*}%placement
 \\centering
 \\includegraphics[%attr]{%path}
-\\caption{%labelcmd%caption}
+\\caption%shortn{%labelcmd%caption}
 \\end{figure*}")
 	   (floatp "\\begin{figure}%placement
 \\centering
 \\includegraphics[%attr]{%path}
-\\caption{%labelcmd%caption}
+\\caption%shortn{%labelcmd%caption}
 \\end{figure}")
 	   (t "\\includegraphics[%attr]{%path}")))
 
-- 
1.7.1



Re: [O] [PATCH] Optional \caption argument for LaTeX export

2011-05-08 Thread Thomas S. Dye
Bernt Hansen  writes:

> t...@tsdye.com (Thomas S. Dye) writes:
>
>> Bernt Hansen  writes:
>>
>>> t...@tsdye.com (Thomas S. Dye) writes:
>>>
 With this patch, #+CAPTION: [Short caption]{Long caption.} in the
 Org-mode source exports to \caption[Short caption]{Long caption.} in the
 LaTeX export, which is, I think, as it should be.
>>>
>>> Hi Thomas,
>>>
>>> Thanks for the patch!
>>>
>>> Please add the above details (without the 'With this patch' and ', which
>>> is, I think, as it should be') to body of the commit message (starting
>>> on line 3).  This makes it possible to read just the commit log message
>>> 6 months from now and know what the patch is about without the necessity
>>> of reading the code changes.
>>>
>>> Regards,
>>> Bernt
>>>
>>
>> 6 months ... yikes!
>>
>> I think this is what you're asking for.  Let me know if it falls short.
>
> Close :)
>
> The attached patch would be better I think.  After applying it 
> git log shows the following:
>
> ,
> | ~/git/org-mode$ git log -1
> | commit cec944435abb688dd1e4b5acbe6d9bcc557c171b
> | Author: Tom Dye 
> | Date:   Sun May 8 13:16:15 2011 -1000
> | 
> | Activate optional argument to LaTeX caption command
> | 
> | * doc/org.texi (Images and tables): Document optional #+CAPTION: form
> | * lisp/org-exp.el: Add support for optional caption form
> | * lisp/org-latex.el: Add support for optional caption form
> | 
> | Captions of the form
> |#+CAPTION: [Short caption]{Long caption.}
> | export to
> |\caption[Short caption]{Long caption.} in the LaTeX export.
> `
>
> git needs the blank line separating the subject from the body and I've
> added the changelog entries (although you might want to reword them if
> they are incorrect.
>
> The updated patch is attached.
>
> Regards,
> Bernt
>
>
> From 37eba27e80a84175e09b01e7125269154c40396d Mon Sep 17 00:00:00 2001
> From: Tom Dye 
> Date: Sun, 8 May 2011 13:16:15 -1000
> Subject: [PATCH] Activate optional argument to LaTeX caption command
>
> * doc/org.texi (Images and tables): Document optional #+CAPTION: form
> * lisp/org-exp.el: Add support for optional caption form
> * lisp/org-latex.el: Add support for optional caption form
>
> Captions of the form
>#+CAPTION: [Short caption]{Long caption.}
> export to
>\caption[Short caption]{Long caption.} in the LaTeX export.
> ---
>  doc/org.texi  |6 ++
>  lisp/org-exp.el   |2 +-
>  lisp/org-latex.el |4 ++--
>  3 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/doc/org.texi b/doc/org.texi
> index 844de6d..8058288 100644
> --- a/doc/org.texi
> +++ b/doc/org.texi
> @@ -8817,6 +8817,12 @@ the object with @code{\ref@{tab:basic-data@}}:
> |-||
>  @end example
>  
> +Optionally, the caption can take the form:
> +@example
> +#+CAPTION: [Caption for list of figures]{Caption for table (or link).}
> +@end example
> +
> +
>  @cindex inlined images, markup rules
>  Some backends (HTML, @LaTeX{}, and DocBook) allow you to directly include
>  images into the exported document.  Org does this, if a link to an image
> diff --git a/lisp/org-exp.el b/lisp/org-exp.el
> index cda1f98..e840b6c 100644
> --- a/lisp/org-exp.el
> +++ b/lisp/org-exp.el
> @@ -1871,7 +1871,7 @@ table line.  If it is a link, add it to the line 
> containing the link."
>  'org-label label))
>   (if label (push (cons label label) target-alist))
>   (goto-char end)
> - (setq cap nil attr nil label nil)
> + (setq cap nil shortn nil attr nil label nil)
>target-alist)
>  
>  (defun org-export-remove-comment-blocks-and-subtrees ()
> diff --git a/lisp/org-latex.el b/lisp/org-latex.el
> index bc9a3f3..516ee12 100644
> --- a/lisp/org-latex.el
> +++ b/lisp/org-latex.el
> @@ -2199,12 +2199,12 @@ The conversion is made depending of STRING-BEFORE and 
> STRING-AFTER."
>  (multicolumnp "\\begin{figure*}%placement
>  \\centering
>  \\includegraphics[%attr]{%path}
> -\\caption{%labelcmd%caption}
> +\\caption%shortn{%labelcmd%caption}
>  \\end{figure*}")
>  (floatp "\\begin{figure}%placement
>  \\centering
>  \\includegraphics[%attr]{%path}
> -\\caption{%labelcmd%caption}
> +\\caption%shortn{%labelcmd%caption}
>  \\end{figure}")
>  (t "\\includegraphics[%attr]{%path}")))

Thanks Bernt,

Anything left for me to do?

All the best,
Tom

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com



Re: [O] [PATCH] Optional \caption argument for LaTeX export

2011-05-08 Thread Bernt Hansen
t...@tsdye.com (Thomas S. Dye) writes:

> Thanks Bernt,
>
> Anything left for me to do?
>
> All the best,
> Tom

Not if you're happy with what I posted and it shows up correctly in
patchwork for someone to apply it.  I don't have commit access myself.

Regards,
Bernt



Re: [O] Org table with long lines visibility

2011-05-08 Thread Michael Brand
Hi Johnny

As I understand, the issue tracker on Worg
http://orgmode.org/worg/org-issues.html
is thought also as a wish-list and you may add this with the keyword
WISH there. But I wouldn't expect too much from doing only this. The
best in many cases is to try to implement by oneself and ask for help
here where necessary. And it's fun too. To start to understand I would
single step with Edebug firstly "TAB" in a table, then "C-c `" with
"C-c C-q" and maybe also "S-" on a reference after "C-c '" on
#+TBLFM.

Michael

On Sat, May 7, 2011 at 13:50, Johnny  wrote:
> Michael Brand  writes:
>> There is not such a way yet but I totally agree that it would be
>> nothing but natural to have keys assigned to the buffer that opens
>> with "C-c `" to move around in the current table. I suggest
>> "S-///" for this in honor of the same keys in
>> the table formula editor ("C-c '") used to move around field
>> references. These keys could be available at least as long as the
>> buffer/cell content is left unchanged.
> This sounds like a good idea! Unfortunately, my lisp skills are
> abysmal and will have to rely on an interest by others to implement such
> a feature. Is there a "wish-list" one should post ideas to, or is this
> captured by the mailing list?



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

2011-05-08 Thread Tom Dye

On 2011-04-26 20:35:06 -1000, Nick Dokos  said:


Robert Goldman  wrote:


4.  Modify the org-latex-to-pdf-process to

("pdflatex -interaction nonstopmode -output-directory %o %f" "makeindex
-o %b.ind %b.idx" "pdflatex -interaction nonstopmode -output-directory
%o %f" "pdflatex -interaction nonstopmode -output-directory %o %f")

[This was /somewhat/ of a big deal.  Suggest we add support for indexing
as a built-in option, like bibtex...]



Maybe you can try the texi2dvi option (I think it runs makeindex), but
texi2dvi did have a bug that has caused problems here in the past:
that's the reason it's not the default setting for
org-latex-to-pdf-process. If you run into the bug but still want to try
texi2dvi anyway, see

http://lists.gnu.org/archive/html/bug-texinfo/2010-03/msg00032.html

for the fix Karl Berry applied to the development sources.


Once one has makeindex hacked in there (oh, and you've broken the
security!), it works fine, thanks.



an absolute pathname.  But org-mode will only pass absolute pathnames to
makeindex (AFAICT).  Question:  it seems like bibtex should suffer from
this same restriction.  Has anyone had that problem with it?



I haven't had the problem, primarily because I haven't used bibtex
through org yet :-) But bibtex should exhibit the same problem: the
bibtex change predated the makeindex one. Maybe bibtex is only called
with a relative path (if that's the case, then the same method should
cure makeindex as well). BTW, ".." is not allowed in the relative path:
you can only use subdirectories of the current directory.



Here's a step-by-step that uses texi2dvi[fn:1]:

o Download a bibliography file:

  cd /home/nick/lib/bibtex
  wget -nd http://ftp.math.utah.edu/pub//tex/bib/linux.html
  mv linux.html linux.bib

o Set the BIBINPUTS environment variable in .profile (or similar):

  BIBINPUTS=/home/nick/lib/bibtex:$BIBINPUTS
  export BIBINPUTS

o Set org-latex-to-pdf-process in .emacs (or similar):

  (setq org-latex-to-pdf-process '("texi2dvi --pdf --tidy --batch %f"))

  The --tidy keeps all the intermediate files tucked away in a subdirectory.
  You can use --clean instead if you want automatic cleanup of intermediate
  files.

That's all for one-time setup. There is no problem with bibtex/makeindex
security because all the output files end up in a subdirectory and (I guess)
texi2dvi uses relative pathnames.

Here's an org file with an index and a bibliography that is properly exported
to PDF with the above setup:

--8<---cut here---start->8---
#+LATEX_HEADER: \usepackage{makeidx}
#+LATEX_HEADER: \makeindex

#+LaTeX: \bibliographystyle{plain}

* this

#+LaTeX: \index{foo}
is a test of foo \cite{Torvalds:1999:LE}

#+LaTeX: \bibliography{linux}
#+LaTeX: \printindex
--8<---cut here---end--->8---

Nick

Footnotes:

[fn:1] My egrep does not choke on the suspect [A-z] pattern that
texi2dvi uses, so I don't need Karl Berry's patch - if your egrep does
choke, the patch just changes the pattern to [A-Za-z] which although not
exactly the same, since it omits a few punctuation chars that come
between Z and a in ASCII[fn:2], is good enough.

[fn:2] The pattern tries to recognize legal drive names on DOS/Windoze,
and these characters are *legal drive names*!! We have Novell to thank
for that though, not M$. OTOH, if you are on Windoze and have a drive
named `[', watch out ;-)


Aloha all,

I've found it convenient to add paths to system-wide bibliographic 
databases to BIBINPUTS in .profile, as Nick suggests, and then use a sh 
source code block for project-specific databases, like this for a 
project in /org/tsdye/:


#+source: bibinputs
#+begin_src sh
 BIBINPUTS=/org/tsdye/:$BIBINPUTS
 export BIBINPUTS
#+end_src

If I remember to execute this before I start editing, then I can add 
references to my work from either the system-wide or project-specific 
databases and LaTeX export produces an error-free pdf file full of 
references.


Tom

--
Tom Dye
T. S. Dye & Colleagues, Archaeologists, Inc.
Honolulu, Hawai`i