[BUG] org-bibtex-read requires that bibtex is properly initialized

2021-01-09 Thread Matthieu Lemerre
Hi,
 When calling org-bibtex-read on a fresh emacs on a text which is not a
.bib file, we get the following error: bibtex-parse-entry: Wrong type
argument: stringp, nil

This problem is solved if the (bibtex-set-dialect) function is called
before. Note that this function is called automatically the first time a
.bib file is opened, so many users may not have seen this problem.

I don't know what the right fix would be though. For now I call
(bibtex-set-dialect) in my init.el, but maybe org-bibtex-read should do it?

Thank you for org-mode!
Matthieu


Re: [O] org and microsoft exchange

2011-07-07 Thread Matthieu Lemerre

Hi Bastien,

On Wed, 29 Jun 2011 01:16:17 +0200, Bastien  wrote:
> Can you give an example of a RFC-2446 compliant entry (with the new
> field you mentioned in the previous email)?

If I take the example given here:
http://stackoverflow.com/questions/45453/icalendar-and-event-updates-not-working-in-outlook

Here is the original ics 

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//WA//FRWEB//EN
METHOD:REQUEST
BEGIN:VEVENT
UID:FRICAL201
SEQUENCE:0
DTSTAMP:20081108T151809Z
ORGANIZER:donotre...@test.com
DTSTART:20081109T121200
SUMMARY:11/9/2008 12:12:00 PM TRIP FROM JFK AIRPORT (JFK)
LOCATION:JFK AIRPORT (JFK)
END:VEVENT
END:VCALENDAR

and here is the update

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//WA//FRWEB//EN
METHOD:REQUEST
BEGIN:VEVENT
UID:FRICAL201
SEQUENCE:1
DTSTAMP:20081108T161809Z
ORGANIZER:donotre...@test.com
DTSTART:20081109T121300
SUMMARY:11/9/2008 12:13:00 PM TRIP FROM JFK AIRPORT (JFK)
LOCATION:JFK AIRPORT (JFK)
END:VEVENT
END:VCALENDAR


> I guess adding this files to org-icalendar.el is not a big fuss.

Compared to what org-mode currently exports, only three fields are missing:

 - Organizer. This should not be too hard to do (using
   user-mail-adress).
 - Method:request (should also be easy...)
 - The sequence number is more difficult. I think it could be stored as
   a property of an org-mode node, but when should it be updated? Maybe
   it can be just be updated everytime the file is exported, just as ids
   are created when the file is exported.
  
Matthieu



Re: [O] org and microsoft exchange

2011-07-07 Thread Matthieu Lemerre
> 
> I have no idea what I will need to do!  I really am truly ignorant of
> the whole MS world other than I know, if push comes to shove, I can
> install cygwin and then Emacs when I have to... ;-)

Actually, there are emacs binaries for win32 that work without needing
cygwin.

> > For the record, here are some other things that I tried/maybe worth
> > trying:
> >
> > - Davmail + thunderbird: allows accessing exchange mail and calendar and
> >   syncinc with it, but did not manage to import org ics into that.
> >
> > - Evolution and the openexchange client may be other things to try.
> 
> These two seem to imply using something other than Emacs for my email?
> Or have I misunderstood?

Openexchange is a command line tool to synchronize with an exchange
server. But it is still incomplete, and I found it a nightmare to
configure and use.

Evolution is indeed another mail client, but my intent was to use it
solely as a mean to synchronize the org mode ics file with the exchange
calendar. Instead of using outlook for this...

Matthieu




Re: [O] org and microsoft exchange

2011-06-27 Thread Matthieu Lemerre
On Mon, 27 Jun 2011 18:14:19 +0100, Eric S Fraga  wrote:
> Matthieu Lemerre  writes:
> 
> > Hi,
> >
> > After some digging I found the following setup to share my calendar with
> > people using outlook.
> 
> [...]
> 
> Matthieu,
> 
> thanks for this.  I am unable to test it but will likely have to do so
> at the end of the summer (northern hemisphere) when we are supposedly
> going to be expected to start using various MS tools for collaboration
> (yech).  I'll come back to you then! ;-)

Eric,

No problem. But note that currently I am able to synchronize with people
using Outlook, but not really with Exchange, if that's what you would
like to do...
For the record, here are some other things that I tried/maybe worth
trying:

- Davmail + thunderbird: allows accessing exchange mail and calendar and
  syncinc with it, but did not manage to import org ics into that.

- Evolution and the openexchange client may be other things to try.

- With a bit of elisp (to implement RFC-2446 compliant export), I think
  full outlook/exchange compliance could be really doable.

Matthieu






Re: [O] org and microsoft exchange

2011-06-26 Thread Matthieu Lemerre

Hi,

After some digging I found the following setup to share my calendar with
people using outlook.

One problem is that org-mode produces ics files, but they are "calendar
snapshots", and outlook does import them well (if you import them twice,
your calendar items will appear twice)

This problem is described here: 
http://stackoverflow.com/questions/45453/icalendar-and-event-updates-not-working-in-outlook

Basically, Outlook requires RFC2446 calendars for this, which requires
some additional fields (organizer, method, and sequence). It should be
possible to convert org-mode calendar import to produce this kind of
calendars, the only difficult track being to track the sequence numbers.

As a workaround, the best solution I found wast to generate a .ics file
and put it on a private http server (webfsd is appropriate for this).
If the URL to this file is http://nommachine.domain:3000/dir/file.ics,
just change it to webcal://nommachine.domain:3000/dir/file.ics and enter
this URL to Internet explorer. Then outlook can automatically subscribe
to this calendar.

The following lisp code launches the webfsd server and regularly updates
the ics file.

This isn't really "sync", but at least allows yourself and others to see
your calendar in outlook!

Hope that can be useful
Matthieu

#+begin_src emacs-lisp
(defun export-icalendar-at-the-right-place ()
   (interactive)
(let ((org-agenda-files '("~/org/org.org"))
  (org-combined-agenda-icalendar-file "~/webfsd_public/org.ics"))
  (org-export-icalendar-combine-agenda-files)))

;; Automacally exports my calendar every 1800s (30 minutes)
(run-at-time "10 min" 1800 #'export-icalendar-at-the-right-place)

;; Launch webfsd to serve the .ics file
(start-process "webfsd" "webfsd" "webfsd" "-r" "/home/me/webfsd_public" "-p" 
"3001")

;; To access it from outook:
;; webcal://myhost.mydomain.fr:3001/org.ics
#+end_src



[O] [PATCH] Make org-capture more generic

2011-06-16 Thread Matthieu Lemerre

Hi,

I really like org-capture, and especially the "hierarchical" interface
for selecting possible capture templates, but I think it needs to be
extended slightly so that it can be used to archive anything.

Some of the things I would like to do when capturing are:
 1. Just jump to some location without inserting anything so that I can
edit things by myself (for instance, jump to the location where my
org-capture-template is defined to manually add new templates)
 2. Copying some file to some location (no org involved)
 3. Extract some files from my mail to attach them to some org item
 4. Insert some parametrized code at point (e.g. for repetitive
projects, like planning a business trip, I would like to insert
a predefined project at point, so I don't have to do all the 
planning every time I do it)

Item 1. is feasible if I remember to use C-u before calling
org-template, but this is a ugly workaround. Another way that I tried
was to using "" as a template with an unnarrowed buffer, but this
triggers a default template instead.

My first patch just extends org-capture to allow empty template, using a
new entry type, 'empty.

The second allows to use functions to define template. Together with an
empty template, it should allow implementing my 2, and may be useful to
implement 3 and 4.

I don't think these patches will be definitive; I mostly would like to
discuss org-capture evolution with org-mode gurus ;)

Regards
Matthieu

>From 8fa638b36f477f2b81e131439729dda954d2e0ad Mon Sep 17 00:00:00 2001
From: Matthieu Lemerre 
Date: Fri, 17 Jun 2011 00:04:40 +0200
Subject: [PATCH 1/2] Add a new "empty" entry-type to org-capture.

This special empty entry type allows to not insert any text in a
template. This can be used e.g. to only jump to a location, so that
the user can edit it by hand.
---
 lisp/org-capture.el |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 7d3f630..7e055f9 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1178,6 +1178,7 @@ Point will remain at the first line after the inserted text."
((eq type 'item) (setq txt "- %?"))
((eq type 'checkitem) (setq txt "- [ ] %?"))
((eq type 'table-line) (setq txt "| %? |"))
+   ((eq type 'empty) (setq txt ""))
((member type '(nil entry)) (setq txt "* %?\n  %a"
 (org-capture-put :template txt :type type)))
 
-- 
1.7.4.1

>From 4d933ee2cc91f93c8e78a792175751e27c9d03e4 Mon Sep 17 00:00:00 2001
From: Matthieu Lemerre 
Date: Fri, 17 Jun 2011 00:19:40 +0200
Subject: [PATCH 2/2] Allows org-capture template to be a function.

The function should return a string, which is used as a template.
---
 lisp/org-capture.el |   20 +++-
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 7e055f9..368532f 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1171,15 +1171,17 @@ Point will remain at the first line after the inserted text."
   (org-capture-put :key (car entry) :description (nth 1 entry)
 		   :target (nth 3 entry))
   (let ((txt (nth 4 entry)) (type (or (nth 2 entry) 'entry)))
-(when (or (not txt) (and (stringp txt) (not (string-match "\\S-" txt
-  ;; The template may be empty or omitted for special types.
-  ;; Here we insert the default templates for such cases.
-  (cond
-   ((eq type 'item) (setq txt "- %?"))
-   ((eq type 'checkitem) (setq txt "- [ ] %?"))
-   ((eq type 'table-line) (setq txt "| %? |"))
-   ((eq type 'empty) (setq txt ""))
-   ((member type '(nil entry)) (setq txt "* %?\n  %a"
+(if (functionp txt)
+	(setq txt (funcall txt))
+  (when (or (not txt) (and (stringp txt) (not (string-match "\\S-" txt
+	;; The template may be empty or omitted for special types.
+	;; Here we insert the default templates for such cases.
+	(cond
+	 ((eq type 'item) (setq txt "- %?"))
+	 ((eq type 'checkitem) (setq txt "- [ ] %?"))
+	 ((eq type 'table-line) (setq txt "| %? |"))
+	 ((eq type 'empty) (setq txt ""))
+	 ((member type '(nil entry)) (setq txt "* %?\n  %a")
 (org-capture-put :template txt :type type)))
 
 (defun org-capture-goto-target (&optional template-key)
-- 
1.7.4.1



[O] Reusing the same agenda view

2011-05-12 Thread Matthieu Lemerre

Hello org-mode,

I have noticed a small thing that bothers me about agenda view: every
agenda command just resets the agenda buffer.

What I would really like to do is to start e.g. viewing my global todo
list, moving the point to where I would like to work, stop viewing the
todo list and getting to work, and then getting back to the global todo
list. Eventually while I am working, I might want to use other
org-agenda commands.

To get back to the global todo list, I usually relaunch this command as
it is so fast with org-agenda. But the point is lost and restored to the
beginning of the buffer.


 - Is it possible to always reuse the same todo list buffer, so that my
   point is not lost? I mean using the agenda dispatcher, because I
   could of course use switch-buffer but I don't think it is meant to be
   used that way.
 
 - Or as a fallback, is it is possible to put the point in some special
   place in the todo list using custom agenda commands?

 - Or is my use wrong?

Thanks
Matthieu
 



[O] [Florian Friesdorf] Re: Org-mode support

2011-04-15 Thread Matthieu Lemerre

Hi,

Florian Friesdorf has suggested this patch to org-notmuch so that it is
enough to require org-notmuch in user init, and it seems a good idea. Is
it possible to include his patch?

Thanks
Matthieu

>From 4128169c3d22527342c90b675e847f4227f3b0c1 Mon Sep 17 00:00:00 2001
From: Florian Friesdorf 
Date: Thu, 14 Apr 2011 14:44:54 +0200
Subject: [PATCH] org-notmuch: require org for org-add-link-type and others

---
 contrib/lisp/org-notmuch.el |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/contrib/lisp/org-notmuch.el b/contrib/lisp/org-notmuch.el
index 9cde34f..9283385 100644
--- a/contrib/lisp/org-notmuch.el
+++ b/contrib/lisp/org-notmuch.el
@@ -41,6 +41,8 @@
 
 ;;; Code:
 
+(require 'org)
+
 ;; Install the link type
 (org-add-link-type "notmuch" 'org-notmuch-open)
 (add-hook 'org-store-link-functions 'org-notmuch-store-link)
-- 
1.7.4.4



Re: [Orgmode] Org support for the notmuch mail client

2011-02-12 Thread Matthieu Lemerre

Hi Bastien,

> I'm not using notmuch, but people reported it as useful -- I'm willing
> to add org-notmuch.el to the contrib/lisp/ folder in org-mode.git.

[...]

> PS: just add a "This file is not part of GNU Emacs" somewhere in the
> comments.

Great! Here it is.



org-notmuch.el
Description: application/emacs-lisp

Best,
Matthieu
___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] Mails with icalendar appointments (Was: Org support for the notmuch mail client)

2011-02-12 Thread Matthieu Lemerre

Hi Andreas,

I have the same problem at work. I also use icalendar-import-buffer, but
I find it not ideal... I have recently found this

http://lists.gnu.org/archive/html/emacs-orgmode/2010-07/msg00732.html

but did not try it yet.

Matthieu

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: Org support for the notmuch mail client

2010-12-05 Thread Matthieu Lemerre

I should have mentioned that the reason why I wrote it is that I would
very much like to have it included in org-mode, and I'm OK to sign the
copyright papers if necessary.

Regards,
Matthieu


On Sun, 28 Nov 2010 17:26:29 +0100, Matthieu Lemerre  wrote:
> 
> Hello, org-mode!
> 
> The attached file implements links to mail collections and "searchs" to
> the notmuch mail client. A "search" is a query to be performed by
> notmuch; it is the equivalent to folders in other mail
> clients. Similarly, mails are refered to by a query, so both a link can
> refer to several mails.
> 
> I had read on this list
> (http://www.mail-archive.com/emacs-orgmode@gnu.org/msg28411.html) that
> there already was an implementation of links to notmuch, but it could
> not be implemented because of paperwork problems. I have implemented
> this because I got tired of waiting :)
> 
> I'm new to hacking org-mode, and the implementation might not be
> perfect. I would be happy to receive comments. I already have one
> question: why is it needed to url-encode the links in org mode? For
> instance, I would like to be able to hand-write links like this:
> 
> [[notmuch-search:to:xxx and not from:]]
> 
> But it only works if I org-link-encode/org-link-decode the link (else,
> the and not .. is completely skipped from the query). Similarly, if I do
> 
> (org-open-link-from-string
> "notmuch:id:\"7f39qo4aut@aeuaue.free.fr\""))
> 
> The last " gets removed in the argument I receive in org-notmuch-open.
> 
> This is a pity because hand-writing url-encoded links is not
> user-friendly.
> 
> 
> PS: could you please Cc me because I am not subscribed to the list.
> 
> Matthieu
> 
Attachment: org-notmuch.el (application/emacs-lisp)

___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Org support for the notmuch mail client

2010-11-28 Thread Matthieu Lemerre

Hello, org-mode!

The attached file implements links to mail collections and "searchs" to
the notmuch mail client. A "search" is a query to be performed by
notmuch; it is the equivalent to folders in other mail
clients. Similarly, mails are refered to by a query, so both a link can
refer to several mails.

I had read on this list
(http://www.mail-archive.com/emacs-orgmode@gnu.org/msg28411.html) that
there already was an implementation of links to notmuch, but it could
not be implemented because of paperwork problems. I have implemented
this because I got tired of waiting :)

I'm new to hacking org-mode, and the implementation might not be
perfect. I would be happy to receive comments. I already have one
question: why is it needed to url-encode the links in org mode? For
instance, I would like to be able to hand-write links like this:

[[notmuch-search:to:xxx and not from:]]

But it only works if I org-link-encode/org-link-decode the link (else,
the and not .. is completely skipped from the query). Similarly, if I do

(org-open-link-from-string
"notmuch:id:\"7f39qo4aut@aeuaue.free.fr\""))

The last " gets removed in the argument I receive in org-notmuch-open.

This is a pity because hand-writing url-encoded links is not
user-friendly.


PS: could you please Cc me because I am not subscribed to the list.

Matthieu



org-notmuch.el
Description: application/emacs-lisp
___
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Bug and patch in org-toggle-fixed-width-section

2009-10-22 Thread Matthieu Lemerre
Hi

There is a bug in org-toggle-fixed-width-section in the org version
shipped with emacs23: this function only inserts ":", when this colon
should be followed by a space.

I joined a patch for your convenience; it seems to work. Maybe this has
already been fixed in later versions.


Regards,
Matthieu Lemerre



*** /tmp/ediff3735oPQ   2009-10-22 15:02:21.0 +0100
--- /tmp/ediff37351ZW   2009-10-22 15:02:21.0 +0100
***
*** 1,3 
--- 1,7 
+ ;; This buffer is for notes you don't want to save, and for Lisp
evaluation.
+ ;; If you want to create a file, visit that file with C-x C-f,
+ ;; then enter the text in that file's own buffer.
+
  (defun org-toggle-fixed-width-section (arg)
"Toggle the fixed-width export.
  If there is no active region, the QUOTE keyword at the current headline is
***
*** 13,19 
 (end (if regionp (region-end)))
 (nlines (or arg (if (and beg end) (count-lines beg end) 1)))
 (case-fold-search nil)
!(re "[ \t]*\\(:\\)")
 off)
  (if regionp
(save-excursion
--- 17,23 
 (end (if regionp (region-end)))
 (nlines (or arg (if (and beg end) (count-lines beg end) 1)))
 (case-fold-search nil)
!(re "[ \t]*\\(: \\)")
 off)
  (if regionp
(save-excursion
***
*** 31,37 
  (forward-line -1))
 ((and off (looking-at re))
  (replace-match "" t t nil 1))
!((not off) (org-move-to-column cc t) (insert ":")))
(forward-line 1)))
(save-excursion
(org-back-to-heading)
--- 35,41 
  (forward-line -1))
 ((and off (looking-at re))
  (replace-match "" t t nil 1))
!((not off) (org-move-to-column cc t) (insert ": ")))
(forward-line 1)))
(save-excursion
(org-back-to-heading)


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Adding latex packages

2007-04-04 Thread Matthieu Lemerre

Hello,

I wondered if it was possible to include custom Latex packages when
processing embedded LaTeX fragments in org. This would require only a
simple change in org-create-formula-image:

  (defun org-create-formula-image (string tofile options)
(let* ((tmpdir (if (featurep 'xemacs)
 (temp-directory)
   temporary-file-directory))
 (texfilebase (make-temp-name
   (expand-file-name "orgtex" tmpdir)))
  
  ;(texfilebase (make-temp-file "orgtex"))
  ;  (dummy (delete-file texfilebase))
 (texfile (concat texfilebase ".tex"))
 (dvifile (concat texfilebase ".dvi"))
 (pngfile (concat texfilebase ".png"))
 (scale (number-to-string (* 1000 (or (plist-get options :scale) 1.0
 (fg (or (plist-get options :foreground) "Black"))
 (bg (or (plist-get options :background) "Transparent")))
  (with-temp-file texfile
(insert "\\documentclass{article}
  \\usepackage{fullpage}
  \\usepackage{amssymb}
  \\usepackage[usenames]{color}
  \\usepackage{amsmath}
  \\usepackage{latexsym}
  \\usepackage[mathscr]{eucal}

XXX insert custom packages here

  \\pagestyle{empty}
  \\begin{document}\n" string "\n\\end{document}\n"))
  (let ((dir default-directory))
(condition-case nil
  (progn
(cd tmpdir)
(call-process "latex" nil nil nil texfile))
(error nil))
(cd dir))
  (if (not (file-exists-p dvifile))
(progn (message "Failed to create dvi file from %s" texfile) nil)
(call-process "dvipng" nil nil nil
"-E" "-fg" fg "-bg" bg
"-x" scale "-y" scale "-T" "tight"
"-o" pngfile
dvifile)
(if (not (file-exists-p pngfile))
  (progn (message "Failed to create png file from %s" texfile) nil)
;; Use the requested file name and clean up
(copy-file pngfile tofile 'replace)
(loop for e in '(".dvi" ".tex" ".aux" ".log" ".png") do
  (delete-file (concat texfilebase e)))
pngfile
  

This should be global or per-file options. The point is that there are
plenty of good LaTeX environments that it would be useful to have in
org (for instance algorithm or tikz).

One of these environments is tikzpicture, and using tikzpicture in org
would allow to create high-quality graphics in org documents. There is
one remaining difficulty though; tikz pictures aren't extracted with
dvipng.

What do you think?

Thanks,
Matthieu Lemerre


___
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode