Re: [Orgmode] Re: patch: link to the log of an ERC session

2008-01-27 Thread Bastien
Hi,

Carsten Dominik <[EMAIL PROTECTED]> writes:

> I would really appreciate if people can test this out and give
> feedback - I would like to include this file with Org-mode, but I am
> not an irc/erc user myself.

I've been testing it and it works fine.  The patch below does this:

- cosmetic re-indentation;

- minor (if COND (if COND ...) -> AND rewriting;

- when point is after ERC prompt, don't add this as a string for
  contextual search, since such a search won't produce the right result.

Thanks for this add-on !

diff -u /home/guerry/org/ /home/guerry/org/Worg/org-code/org-link-irc.el
--- /home/guerry/org/org-link-irc.el	2008-01-27 18:47:50.0 +
+++ /home/guerry/org/Worg/org-code/org-link-irc.el	2008-01-27 18:38:11.0 +
@@ -46,6 +46,7 @@
 
 (add-to-list 'org-store-link-functions
  'org-link-irc-store-link)
+
 (org-add-link-type "irc" 'org-link-irc-visit nil)
 
 (defun org-link-irc-visit (link)
@@ -72,8 +73,8 @@
   "Dispatch to the appropreate function to store a link to
 something IRC related"
   (cond
-((eq major-mode 'erc-mode)
- (org-link-irc-erc-store-link
+   ((eq major-mode 'erc-mode)
+(org-link-irc-erc-store-link
 
 ;; ERC specific functions
 
@@ -94,44 +95,43 @@
 ;; a simple file link does here (use regexp?)
 (setq cpltxt (concat "file:" (abbreviate-file-name
   buffer-file-name)
- "::" erc-line))
+ (unless (equal erc-line (erc-prompt))
+   (concat "::" erc-line
 (org-make-link cpltxt)
-
 t))
-(error "This ERC session is not being logged")))
-  (let ((link (org-link-irc-get-erc-link)))
-(if link
-(progn
-  (setq cpltxt (concat "irc:/" link))
-  (org-make-link cpltxt)
-  (setq link (org-link-irc-parse-link link))
-  (org-store-link-props :type "irc" ; for remember
-:server (car (car link))
-:port (or (cadr (pop link))
-  erc-default-port)
-:nick (pop link))
-  t)
-(error "Failed to create (non-log) ERC link")
+	  (error "This ERC session is not being logged")))
+(let ((link (org-link-irc-get-erc-link)))
+  (if link
+	  (progn
+	(setq cpltxt (concat "irc:/" link))
+	(org-make-link cpltxt)
+	(setq link (org-link-irc-parse-link link))
+	(org-store-link-props :type "irc" ; for remember
+  :server (car (car link))
+  :port (or (cadr (pop link))
+	erc-default-port)
+  :nick (pop link))
+	t)
+	(error "Failed to create (non-log) ERC link")
 
 (defun org-link-irc-get-erc-link ()
   "Return an org compatible irc:/ link from an ERC buffer"
   (let ((link (concat erc-server-announced-name ":"
   erc-session-port)))
 (concat link "/"
-(if (erc-default-target)
-(if (erc-channel-p (erc-default-target))
-(if (and (get-text-property (point) 'erc-parsed)
- (elt (get-text-property (point) 'erc-parsed) 1))
-;; we can get a nick
-(let ((nick
-   (car
-(erc-parse-user
- (elt (get-text-property (point)
- 'erc-parsed) 1)
-(concat (erc-default-target) "/"
-(substring nick 1)))
-(erc-default-target))
-(erc-default-target))
+(if (and (erc-default-target)
+		 (erc-channel-p (erc-default-target))
+		 (get-text-property (point) 'erc-parsed)
+		 (elt (get-text-property (point) 'erc-parsed) 1))
+		;; we can get a nick
+		(let ((nick
+		   (car
+			(erc-parse-user
+			 (elt (get-text-property (point)
+		 'erc-parsed) 1)
+		  (concat (erc-default-target) "/"
+			  (substring nick 1)))
+	  (erc-default-target)
 
 (defun org-link-irc-visit-erc (link)
   "Visit an ERC buffer based on criteria from the followed link"
@@ -142,12 +142,12 @@
   (erc-buffer-filter
(lambda nil
  (let ((tmp-server-buf (erc-server-buffer)))
- (and tmp-server-buf
-  (with-current-buffer tmp-server-buf
-(and
- (string= erc-session-port port)
- (string= erc-server-announced-name server)
- (setq server-buffer tmp-server-buf)
+	   (and tmp-server-buf
+		(with-current-buffer tmp-server-buf
+		  (and
+		   (string= erc-session-port port)
+		   (string= erc-server-announced-name server)
+		 

[Orgmode] Survey results

2008-01-27 Thread Carsten Dominik

Hi,

you might remember that in November, Charles Cave organized a survey
among Org-mode users in November.  The results of this survey can be  
found at

http://orgmode.org/survey.html.

Thanks to Charles!  There is some really interesting stuff in this,
in particular in the answers to question 5.

- Carsten


___
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


automatic reminders in Emacs as pop ups [was: Re: [Orgmode] Survey results ]

2008-01-27 Thread Nick Dokos
One answer to question 5 on the survey was another question: automatic
reminders in Emacs as pop ups?

Here is how I do it, using very little machinery. As part of org-mode
initialization, I add appointments from the diary to the agenda at
startup and I also make org-agenda-redo rescan the appt list:

---
(require 'appt)
(setq org-agenda-include-diary t)
(setq appt-time-msg-list nil)
(org-agenda-to-appt)

(defadvice  org-agenda-redo (after org-agenda-redo-add-appts)
  "Pressing `r' on the agenda will also add appointments."
  (progn 
(setq appt-time-msg-list nil)
(org-agenda-to-appt)))

(ad-activate 'org-agenda-redo)
---

I enable appt reminders, set the format to 'window and provide
a display function that calls a python program to do the popup:

---
(progn
  (appt-activate 1)
  (setq appt-display-format 'window)
  (setq appt-disp-window-function (function my-appt-disp-window))
  (defun my-appt-disp-window (min-to-app new-time msg)
(call-process "/home/nick/bin/popup.py" nil 0 nil min-to-app msg new-time)))
---

Finally, the popup.py program is trivial:

---
#!/usr/bin/env python

""" Simple dialog popup example similar to the GTK+ Tutorials one """

import gtk
import sys

mins = sys.argv[1]
text = ' '.join(sys.argv[2:])
dialog = gtk.MessageDialog(None,
   gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
   gtk.MESSAGE_INFO, gtk.BUTTONS_OK,
   "Appt in %s mins: %s" % (mins, text))
dialog.run()
dialog.destroy()
---

HTH,
Nick


___
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


Re: automatic reminders in Emacs as pop ups [was: Re: [Orgmode] Survey results ]

2008-01-27 Thread Piotr Zielinski
Also, debian/ubuntu package libnotify-bin contains a command-line
utility "notify-send" that you can use to display non-modal user
notifications, in the same way as popup.py.

Piotr

On Jan 27, 2008 10:11 PM, Nick Dokos <[EMAIL PROTECTED]> wrote:
> One answer to question 5 on the survey was another question: automatic
> reminders in Emacs as pop ups?
>
> Here is how I do it, using very little machinery. As part of org-mode
> initialization, I add appointments from the diary to the agenda at
> startup and I also make org-agenda-redo rescan the appt list:
>
> ---
> (require 'appt)
> (setq org-agenda-include-diary t)
> (setq appt-time-msg-list nil)
> (org-agenda-to-appt)
>
> (defadvice  org-agenda-redo (after org-agenda-redo-add-appts)
>   "Pressing `r' on the agenda will also add appointments."
>   (progn
> (setq appt-time-msg-list nil)
> (org-agenda-to-appt)))
>
> (ad-activate 'org-agenda-redo)
> ---
>
> I enable appt reminders, set the format to 'window and provide
> a display function that calls a python program to do the popup:
>
> ---
> (progn
>   (appt-activate 1)
>   (setq appt-display-format 'window)
>   (setq appt-disp-window-function (function my-appt-disp-window))
>   (defun my-appt-disp-window (min-to-app new-time msg)
> (call-process "/home/nick/bin/popup.py" nil 0 nil min-to-app msg 
> new-time)))
> ---
>
> Finally, the popup.py program is trivial:
>
> ---
> #!/usr/bin/env python
>
> """ Simple dialog popup example similar to the GTK+ Tutorials one """
>
> import gtk
> import sys
>
> mins = sys.argv[1]
> text = ' '.join(sys.argv[2:])
> dialog = gtk.MessageDialog(None,
>gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
>gtk.MESSAGE_INFO, gtk.BUTTONS_OK,
>"Appt in %s mins: %s" % (mins, text))
> dialog.run()
> dialog.destroy()
> ---
>
> HTH,
> Nick
>
>
> ___
> 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
>


___
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] Re: Survey results

2008-01-27 Thread Leo
On 2008-01-27 21:22 +, Carsten Dominik wrote:
> Hi,
>
> you might remember that in November, Charles Cave organized a survey
> among Org-mode users in November.  The results of this survey can be
> found at
> http://orgmode.org/survey.html.
>
> Thanks to Charles!  There is some really interesting stuff in this,
> in particular in the answers to question 5.
>
> - Carsten

It is interesting to see the number of Xemacs users is small.

-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .:  [ GPG Key: 9283AA3F ]  :.

  Use the best OS -- http://www.fedoraproject.org/



___
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


Re: [Orgmode] Re: Survey results

2008-01-27 Thread Bastien Guerry
Leo <[EMAIL PROTECTED]> writes:

> It is interesting to see the number of Xemacs users is small.

Being included in GNU Emacs surely helps.  But note that "keeping XEmacs
compatibility" is also mentionned in the 5th section.

-- 
Bastien


___
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] Safer kill-line for org-mode

2008-01-27 Thread Piotr Zielinski
Hi,

Read this to avoid losing your work.

Standard kill-line deletes all text from the point to the end of the
_visible_ line.  It happened to me a few times that I pressed C-k to
delete a few final words of a headline, but instead the whole
(invisible) subtree was deleted.  This kind of mistake is costly
because it may go unnoticed for weeks, when you start wondering what
happened to a sizeable part of your org file and have to go through
rather old backups.  Below is what I believe to be a safer version of
kill-line: it deletes text only to the end of the real line, unless
used at the beginning of the line, in which case it behaves as the
standard kill-line.  I haven't tested much yet, but it seems to be
working ok.

(defun kill-line-safe ()
  (interactive)
  (if (bolp)
  (kill-line)
(kill-region (point) (point-at-eol

(define-key global-map "\C-k" 'kill-line-safe)

Piotr


___
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] using org-mode and screen

2008-01-27 Thread Andrew Hyatt
Hi everyone,
I use org-mode religiously these days.  I blogged about my use here (
http://technical-dresese.blogspot.com/2007/08/org-mode.html) (please excuse
the fact that when I wrote this I didn't know about the existing org-mode
functionality to jump to the current clock).

I generally have a problem of integrating the work I do in the shell with
the tasks in org-mode.   Plus, I often need access to the shells at home I
started from work.  I thought I'd combine these problems into a little
org-mode extension that ties screen and org-mode together, via ansi-term.

For these to work, you have to load ansi-term, which my hack is based on.

If there's enough interest, I'll make a real .el file out of this.

The general idea is that you start a task in which all the work will take
place in a shell.  This usually is not a leaf-task for me, but usually the
parent of a leaf task.  From a task in your org-file, M-x ash-org-screen
will prompt for the name of a session.  Give it a name, and it will insert a
link.  Open the link at any time to go the screen session containing your
work!

It works pretty well for me.  The only problem is that I often run emacs in
a screen session itself, and I can never get scrolling to work right in
screen-in-screen.

(defun ash-org-screen-buffer-name (name)

  "Returns the buffer name corresponding to the screen name given."

  (concat "*screen " name "*"))



(defun ash-org-screen-helper (name arg)

  ;; Pick the name of the new buffer.

  (let ((term-ansi-buffer-name (generate-new-buffer-name
(ash-org-screen-buffer-name name
(setq term-ansi-buffer-name

  (term-ansi-make-term term-ansi-buffer-name "/usr/bin/screen" nil

   arg name))



(set-buffer term-ansi-buffer-name)

(term-mode)

(term-char-mode)



(term-set-escape-char ?\C-x)

term-ansi-buffer-name))



(defun ash-org-screen (name)

  "Start a screen session with name"

  (interactive "MScreen name: ")



  (save-excursion

(ash-org-screen-helper name "-S"))

  (insert-string (concat "[[screen:" name "]]")))

And don't forget to add ("screen" . "elisp:(ash-org-goto-screen \"%s\")") to
org-link-abbrev-alist.
___
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


Re: [Orgmode] Safer kill-line for org-mode

2008-01-27 Thread Carsten Dominik

Hi Piotr,

I do like that a lot.  An extension might be to even keep the tags in  
headlines.


- Carsten

On Jan 28, 2008, at 12:29 AM, Piotr Zielinski wrote:


Hi,

Read this to avoid losing your work.

Standard kill-line deletes all text from the point to the end of the
_visible_ line.  It happened to me a few times that I pressed C-k to
delete a few final words of a headline, but instead the whole
(invisible) subtree was deleted.  This kind of mistake is costly
because it may go unnoticed for weeks, when you start wondering what
happened to a sizeable part of your org file and have to go through
rather old backups.  Below is what I believe to be a safer version of
kill-line: it deletes text only to the end of the real line, unless
used at the beginning of the line, in which case it behaves as the
standard kill-line.  I haven't tested much yet, but it seems to be
working ok.

(defun kill-line-safe ()
 (interactive)
 (if (bolp)
 (kill-line)
   (kill-region (point) (point-at-eol

(define-key global-map "\C-k" 'kill-line-safe)

Piotr


___
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




___
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