emacs-wiki-discuss
[Top][All Lists]
Advanced

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

[emacs-wiki-discuss] planner-appt: another fix for description formattin


From: Jim Ottaway
Subject: [emacs-wiki-discuss] planner-appt: another fix for description formatting
Date: Sun, 27 Nov 2005 13:11:54 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

The description formatting for planner-appt still fails sometimes.
Here is a fix: a simplified planner-appt-de-wiki, and checks that the
description is non-nil in appropriate places.

Regards,

-- 
Jim Ottaway

--- orig/planner-appt.el
+++ mod/planner-appt.el
@@ -545,22 +545,14 @@
 the hook's global value rather than its local value."
   (add-hook hook function append (not global)))
 
+
 (defun planner-appt-de-wiki (description)
   "Remove wiki tags from DESCRIPTION."
-  (let (start place new-link)
-    (while (or (string-match "\\[\\[[^][]*\\]\\[[^][]*\\]\\]"
-                             description start)
-               (string-match "\\[\\[\\(.*?\\)\\]\\]"
-                             description start))
-      (setq start (match-beginning 0))
-      (setq description
-            (replace-match
-             (setq new-link
-                   (planner-link-name
-                    (substring
-                     description (match-beginning 0) (match-end 0))))
-             t t description))
-      (setq start (+ (length new-link)))))
+  (while (string-match muse-explicit-link-regexp description)
+    (setq description
+          (replace-match (or (match-string 2 description)
+                             (match-string 1 description))
+                         t t description)))
   description)
 
 (defun planner-appt-remove-task-id (description)
@@ -757,8 +749,8 @@
                   (error "There is no task on the current line")))
         (appt (planner-appt-task-parse-task
                (planner-task-description info)))
-        (desc (planner-appt-format-description (nth 0 appt)))
-        (time (nth 1 appt)))
+         (time (nth 1 appt))
+        (desc (and time (planner-appt-format-description (nth 0 appt)))))
     (when (and time
               (not (string= (planner-task-status info) "C"))
               (string= (planner-task-date info)
@@ -801,8 +793,8 @@
                   (error "There is no task on the current line")))
         (appt (planner-appt-task-parse-task
                (planner-task-description info)))
-        (desc (planner-appt-format-description (nth 0 appt)))
         (time (nth 1 appt))
+         (desc (and time (planner-appt-format-description (nth 0 appt))))
         (tmp-msg-list appt-time-msg-list))
     (when time
       ;; Method from appt-delete

reply via email to

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