Re: [O] org-open-link-from-string in a program

2013-08-04 Thread Eric Abrahamsen
Eric Abrahamsen e...@ericabrahamsen.net writes:

 I'm trying to write a small function that programmatically follows a
 link to a gnus message, then calls
 `gnus-summary-wide-reply-with-original' to start a reply to that
 message. It seemed like `org-open-link-from-string' (after extracting
 the address part from the link) would be the right choice, but I'm
 seeing odd behavior.

 When gnus sets up the reply buffer it also adds several hooks and
 actions for restoring windows and marking messages as responded-to, etc,
 and these hooks and actions depend on the value of (current-buffer) when
 the reply was initiated. That's supposed to be the gnus summary buffer.

 When I call all this from a function, however, (current-buffer)
 continues to return the org buffer I started in, even after the link was
 opened, which confuses gnus, and me. What I mean is this:

 (let ((addr the-address-part-of-the-link))
(org-open-link-from-string addr)
(message %s (current-buffer)) ; returns the org buffer I started in
(call-interactively
  'gnus-summary-wide-reply-with-original))

 There must be something I'm misunderstanding about how buffers work when
 you're doing something non-interactive. If I manually eval the
 org-open-link-from-string statement, I end up in the summary buffer,
 obviously, and all works fine.

 What am I not getting?

 Thanks!
 Eric

I think I've got it: when `org-open-link-from-string' calls
`org-open-at-point', it passes the current buffer as an argument.
`org-open-at-point' then wraps the call to `org-link-protocols'
(specifically `org-gnus-open' in this case) in a `with-current-buffer'
that uses that original buffer.

To be honest I'm not really sure if that's the problem -- once
`org-open-link-from-string' returns, I would think that interior
`with-current-buffer' had passed out of scope. Gnus sets up the reply
buffer after open-link-from-string has returned, by which point I would
think it could get new values of `current-buffer'.

Anyway, it works to replace `org-open-link-from-string' with:

(org-gnus-open (org-link-unescape link-address))

So that's what I'll do! Once I've made sure I haven't broken these
functions while messing with them, I'll post code here.

Eric




Re: [O] table export to same buffer

2013-08-04 Thread Rustom Mody
On Sun, Aug 4, 2013 at 5:04 AM, William Henney when...@gmail.com wrote:


 On Fri, Aug 2, 2013 at 11:52 PM, Rustom Mody rustompm...@gmail.comwrote:

 Sebastien Vauban wrote

 On Fri, Aug 2, 2013 at 10:53 PM, Rustom Mody rustompm...@gmail.comwrote:

 Is it possible to export an orgmode table not to a new file but
 overwriting the org table in the same buffer?

 Context is editing source code which contains a largeish table of (say)
 constants.
 Editing is done with orgtbl minor mode.
 When done it should become back the table in the natural format of the
 programming language
 [For simplicity lets just say csv will do]



 Using an Org Babel code block (which you have to write, of course) taking as
 input your table, and outputting your constants in the wished format should 
 do
 what you're looking for, right?


 I dont think so.
 The context is writing C with C mode (or haskell with haskell-mode python
 with python-mode etc) ie the user is not using orgmode.  That is why I
 mentioned orgtbl, ie org table editing facilities are needed but the major
 mode is something else.


 What about a radio table using orgtbl-to-generic?

 See Appendix 6 of the Org manual

 Will


This looks like a useful approach

The variable names dont seem to match:
Appendix 6.2 talks of orgtbl-radio-tables
However org (8.0.7) seems to have orgtbl-radio-table-templates

Assuming they are the same, anywhere I can read about the documentation of
the template format?
Specifically I find that the name of the receiving function
(orgtbl-to-latex) seems to have a significance.  The same in the template
seems to have none


Re: [O] LaTex Adjustments for Org-Export

2013-08-04 Thread Anthony Lander
Hi Jeff,

I just saw your question about removing paragraph indent, and adding space
between paragraphs. You can do that with the following LaTeX commands:

\setlength{\parskip}{1ex plus 0.5ex minus 0.2ex} %% Add space between
paragraphs

\setlength{\parindent}{0pt} %% Do not indent paragraphs


You can put them at the top of your org document like so:


#+LATEX_HEADER: \setlength{\parskip}{1ex plus 0.5ex minus 0.2ex} %% Add
space between paragraphs

#+LATEX_HEADER: \setlength{\parindent}{0pt} %% Do not indent paragraphs


I hope this helps!


  -Anthony


On Wed, Jul 31, 2013 at 8:27 AM, Jeff Rush jr...@taupro.com wrote:

 I'm trying to export a .org file to .pdf and although I've gotten past
 many formatting hurdles, I am stuck on two problems.

 1) How can I redefine, in my org-export-latex-classes variable, the
 \section definition, such that it includes \pagebreak?
  My reason is that I would like each of my top-level headings to
 start on a new page, like a new chapter.

 2) How can I change the basic formatting of paragraphs everywhere to

  a) omit the leading indent, and
  b) have a blank line between paragraphs

 Instead of this strange-looking style:

 This is a test paragraph
 of the following kind of thing.
 And so is this one.

 I want it to look like this:

 This is a test paragraph
 of the following kind of thing.
   And so is this one.

 Thanks for any helpful souls out there.  I'm working on learning LaTeX
 but can't see how the various parts of the article base class fit
 together and how to selectively override them.

 -Jeff





Re: [O] Agenda in the mode-line?

2013-08-04 Thread Daniel Clemente

El Fri, 02 Aug 2013 09:59:55 -0500 Kyle Sexton va escriure:
 What I am after is more of a overview of How many total TODO tasks do I
 have, ideally with some function to limit or match based on tag.
 

  I manually run a script each day to update many things, one of them is 
exporting the agenda to a file. I can then use „wc -l“ to count the number of 
tasks and „grep“ to filter.
  The downside is that the file is usually outdated. But computing it at every 
change would be too slow.




Re: [O] How to trigger the clockcheck in an agenda view.

2013-08-04 Thread Mike McLean



On Jul 31, 2013, at 3:25 AM, Rainer Stengele rainer.steng...@online.de wrote:

 
 
 Am 7/29/2013 10:48 AM, schrieb Sebastien Vauban:
 Hi Rainer Stengele,
 
 Rainer Stengele wrote:
 Am 7/17/2013 2:07 PM, schrieb Rainer Stengele:
 Am 12.07.2013 10:06, schrieb Rainer Stengele:
 
 I want to start an aganda view over a week and immediately check the
 consistency of clock entries:
 
 I can't seem to find a way to trigger the clockcheck in the agenda view
 options.
 
 At the moment I have::
 
   (Aw
agenda + no todos - this week - log-mode - ARCHIVE included - clock 
 report
agenda 
(
 (org-agenda-sorting-strategy '(time-up priority-down))
 (org-agenda-span 'week)
 (org-agenda-start-with-log-mode t)
 (org-agenda-archives-mode t)
 (org-agenda-start-with-clockreport-mode t)
 ))
 
 Do I miss the variable to be set?
 
 Anybody?
 
 I know this is special, but I do not know how to check the existence of such
 a variable. If it doesn't I would suggest it as enhancement.
 
 The following does what you want:
 
 --8---cut here---start-8---
  (add-to-list 'org-agenda-custom-commands
   '(rC Clock Review
 agenda 
 ((org-agenda-archives-mode t)
  (org-agenda-clockreport-mode t)
  (org-agenda-overriding-header Clocking Review)
  (org-agenda-show-log 'clockcheck)
  (org-agenda-span 'day))) t)
 --8---cut here---end---8---
 
 Best regards,
  Seb
 
 PS- I've been on holidays and still ahve ~300 Org posts to read...
 
 Sebastian,
 
 thank you for taking your precious time to consider my question!
 I replaced my configuration with exactly yours and it doesn't start with 
 showing the clockchecks (time gaps etc.).
 I have to type v c to activate the clockcheck.
 I run the latest org version from just 3 minutes ago.
 
 Any idea?

Mine is almost identical to the one Sebastian posted and goes right to a clock 
check view.

(setq org-agenda-custom-commands
  (append
   org-agenda-custom-commands
   '((c Clock Review
 ((agenda 
  (
   (org-agenda-overriding-header Clocking Review)
   (org-agenda-archives-mode t)
   (org-agenda-span 'day)
   (org-agenda-show-log 'clockcheck)
   (org-agenda-clockreport-mode t)))
  )







[O] mac-message for Growl 2

2013-08-04 Thread Iain Houston
I encountered a few problems with org-mac-mail bundled with emacs 24.3.1; some 
errors interfacing with Growl (2.1) so the patch below works for me and I 
wondered whether it would be of use to anyone else.

I adapted the insertion of flagged mail to look at all active mail accounts 
rather than having to name any particular one.

This is how I use org-mac-message: and below is the patch.

(require 'org)
(load org-mac-message)
(global-set-key [(shift f10)] (lambda() (interactive)
(progn
  (find-file-noselect 
~/Dropbox/org/refile.org)
  (org-mac-message-insert-flagged refile.org 
Flagged mail


diff --git a/org-mac-message.el b/org-mac-message.el
index 5df68f5..be2a654 100644
--- a/org-mac-message.el
+++ b/org-mac-message.el
@@ -95,86 +95,89 @@ This will use the command `open' with the message URL.
 return theLinkList as string\n
 end tell)))
 
-(defun as-get-flagged-mail ()
-  AppleScript to create links to flagged messages in Mail.app.
-  (do-applescript
-   (concat
-;; Is Growl installed?
-tell application \System Events\\n
-set growlHelpers to the name of every process whose creator type contains 
\GRRR\\n
-if (count of growlHelpers)  0 then\n
-set growlHelperApp to item 1 of growlHelpers\n
-else\n
-set growlHelperApp to \\\n
-end if\n
-end tell\n
-
-;; Get links
-tell application \Mail\\n
-set theMailboxes to every mailbox of account \ org-mac-mail-account 
\\n
-set theLinkList to {}\n
-repeat with aMailbox in theMailboxes\n
-set theSelection to (every message in aMailbox whose flagged status = 
true)\n
-repeat with theMessage in theSelection\n
-set theID to message id of theMessage\n
-set theSubject to subject of theMessage\n
-set theLink to \message://\  theID  \::split::\  theSubject  
\\n\\n
-copy theLink to end of theLinkList\n
-
-;; Report progress through Growl
-;; This double tell idiom is described in detail at
-;; http://macscripter.net/viewtopic.php?id=24570 The
-;; script compiler needs static knowledge of the
-;; growlHelperApp.  Hmm, since we're compiling
-;; on-the-fly here, this is likely to be way less
-;; portable than I'd hoped.  It'll work when the name
-;; is still GrowlHelperApp, though.
-if growlHelperApp is not \\ then\n
-tell application \GrowlHelperApp\\n
-tell application growlHelperApp\n
-set the allNotificationsList to {\FlaggedMail\}\n
-set the enabledNotificationsList to allNotificationsList\n
-register as application \FlaggedMail\ all notifications 
allNotificationsList default notifications enabledNotificationsList icon of 
application \Mail\\n
-notify with name \FlaggedMail\ title \Importing flagged message\ 
description theSubject application name \FlaggedMail\\n
-end tell\n
-end tell\n
-end if\n
-end repeat\n
-end repeat\n
-return theLinkList as string\n
-end tell)))
+(defun  as-get-flagged-mail ()
+ AppleScript to create links to flagged messages in all Mail.app accounts
+ ;; Revised use of Growl interface and no need for variable 
org-mac-mail-account
+ (do-applescript
+  (concat
+   ;; Is Growl running? Use API as recommended at 
http://growl.info/documentation/applescript-support.php 
+   tell application \System Events\\n
+   set growlIsRunning to (count of (every process whose bundle identifier 
is \com.Growl.GrowlHelperApp\))  0\n
+   end tell\n
+
+   set theLinkList to {}\n
+   set isNotRegisteredToGrowl to true\n
+   tell application \Mail\\n
+   set theAccountList to the name of every account\n
+   repeat with theMailAccount in theAccountList\n
+   set theMailboxes to every mailbox of account theMailAccount\n
+   repeat with aMailbox in theMailboxes\n
+   set theSelection to (every message in aMailbox whose flagged status = 
true)\n
+   repeat with theMessage in theSelection\n
+   set theID to message id of theMessage\n
+   set theSubject to subject of theMessage\n
+   set theLink to \message://\  theID  \::split::\  theSubject  
\\n\\n
+   copy theLink to end of theLinkList\n
+   
+   if growlIsRunning then\n
+   tell application id \com.Growl.GrowlHelperApp\\n
+   if isNotRegisteredToGrowl then\n
+   set the allNotificationsList to {\FlaggedMail\}\n
+   set the enabledNotificationsList to allNotificationsList\n
+   register as application \FlaggedMail\ all notifications 
allNotificationsList default notifications enabledNotificationsList icon of 
application \Mail\\n
+   set isNotRegisteredToGrowl to false\n
+   end if\n
+   notify with name \FlaggedMail\ title \Importing flagged message\ 
description theSubject application name \FlaggedMail\\n
+   end tell\n
+   end if\n
+   
+   end repeat\n
+   end repeat\n
+   end repeat\n
+