emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] Problem with org-toggle-timestamp-type


From: Ben Alexander
Subject: [Orgmode] Problem with org-toggle-timestamp-type
Date: Wed, 29 Oct 2008 20:46:54 +0000

Hi!

I'm cannot figure out how to use version control in general, and git in particular. However, I think there is a mistake with org-toggle- timestamp-type.

Currently, the message always returns "Timestamp is now active" regardless of wether it is or not. I think this is because the message is not inside the save-excursion block, so we can't be sure whether point was outside the timestamp (just in front) or inside (at the very end). Inside save-excursion, I think it is always moved to the end, does the edit, and is moved outside.

Also, I think the sense of the test is backwards. And for some reason (if (equal (char-before) ?]) "in" "") didn't work (went to elisp debugger). I can't read lisp, it's beyond me.

So here's the change I made (to org-version 6.10c)


(defun org-toggle-timestamp-type ()
  "Toggle the type (<active> or [inactive]) of a time stamp."
  (interactive)
  (when (org-at-timestamp-p t)
    (save-excursion
      (goto-char (match-beginning 0))
      (insert (if (equal (char-after) ?<) "[" "<")) (delete-char 1)
      (goto-char (1- (match-end 0)))
      (insert (if (equal (char-after) ?>) "]" ">")) (delete-char 1)
      (message "Timestamp is now %sactive"
             (if (equal (char-before) ?>) "" "in")))))

There's something else, and this might very well because my git repo is not what emacs is actually running, and my modified Makefile install target might be foobar.

If I have a timestamp that looks like <2009-01-29 Thu>--<2009-01-29 Thu> and the cursor is in front of the first > symbol and then I hit the S-<up> twice, my timestamp no longer is a range. It now looks like [2009-01-30 Fri]

I tried to look at the org-ts[r]?-regexp-* variables, but my eyes crossed. Plus, I'm very afraid that any change I'd make would add parentheses, and thereby screwup every (match-begin 8) in the code.

TFOM*

Ben

----
footnotes
* TFOM = Thanks for Org-Mode






reply via email to

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