emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New version of todo-mode.el (code)


From: Stephen Berman
Subject: New version of todo-mode.el (code)
Date: Mon, 10 Jun 2013 22:51:41 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

On Mon, 10 Jun 2013 16:49:14 +0200 Bastien <address@hidden> wrote:

> Stephen Berman <address@hidden> writes:
>
>> I think it would be if I compressed it, but I'm still waiting for
>> the go-ahead from the list admin or someone else who knows.
>
> I suggest you go ahead and send the compressed version on the list.
> If this is not acceptable, it will not be accepted and publishing it
> elsewhere will be the solution.  But I guess it will be accepted.

Your argument (plus an unfortunate mistake I just made, which I posted
separately about) convinces me, so here it is (I hope), compressed with
bzip2.  I'm also attaching a patch for diary-lib.el, which is needed if
todo files made using the package are included in the diary file for the
Fancy Diary display.

Steve Berman

*** /home/steve/bzr/emacs/trunk/lisp/calendar/diary-lib.el      2013-06-05 
11:41:31.000000000 +0200
--- /home/steve/bzr/emacs/todos/lisp/calendar/diary-lib.el      2013-06-10 
22:28:48.000000000 +0200
***************
*** 1040,1063 ****
    "Jump to the diary entry for the BUTTON at point."
    (let* ((locator (button-get button 'locator))
           (marker (car locator))
!          markbuf file)
      ;; If marker pointing to diary location is valid, use that.
      (if (and marker (setq markbuf (marker-buffer marker)))
          (progn
            (pop-to-buffer markbuf)
!           (goto-char (marker-position marker)))
        ;; Marker is invalid (eg buffer has been killed).
        (or (and (setq file (cadr locator))
                 (file-exists-p file)
                 (find-file-other-window file)
                 (progn
                   (when (eq major-mode (default-value 'major-mode)) 
(diary-mode))
                   (goto-char (point-min))
!                  (if (re-search-forward (format "%s.*\\(%s\\)"
!                                                 (regexp-quote (nth 2 locator))
!                                                 (regexp-quote (nth 3 
locator)))
!                                         nil t)
!                      (goto-char (match-beginning 1)))))
            (message "Unable to locate this diary entry")))))
  
  (defun diary-fancy-display ()
--- 1040,1073 ----
    "Jump to the diary entry for the BUTTON at point."
    (let* ((locator (button-get button 'locator))
           (marker (car locator))
!          markbuf file opoint)
!     ;; FIXME: Is there a better way to conditionally require todos.el?
!     (catch 'found
!       (dolist (f diary-included-files)
!       (when (string-match "\\.todo\\'" f)
!         (require 'todos)
!         (throw 'found nil))))
      ;; If marker pointing to diary location is valid, use that.
      (if (and marker (setq markbuf (marker-buffer marker)))
          (progn
            (pop-to-buffer markbuf)
!         (when (eq major-mode 'todos-mode) (widen))
!           (goto-char (marker-position marker))
!         (todos-diary-goto-entry))
        ;; Marker is invalid (eg buffer has been killed).
        (or (and (setq file (cadr locator))
                 (file-exists-p file)
                 (find-file-other-window file)
                 (progn
                   (when (eq major-mode (default-value 'major-mode)) 
(diary-mode))
+                (when (eq major-mode 'todos-mode) (widen))
                   (goto-char (point-min))
!                  (when (re-search-forward (format "%s.*\\(%s\\)"
!                                                 (regexp-quote (nth 2 locator))
!                                                 (regexp-quote (nth 3 
locator)))
!                                         nil t)
!                  (goto-char (match-beginning 1))
!                  (todos-diary-goto-entry))))
            (message "Unable to locate this diary entry")))))
  
  (defun diary-fancy-display ()

Attachment: todos.el.bz2
Description: todos.el -- new version of todo-mode.el


reply via email to

[Prev in Thread] Current Thread [Next in Thread]