From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Problem with org-toggle-timestamp-type Date: Sat, 1 Nov 2008 14:48:40 +0100 Message-ID: <88813C58-031D-41AE-9590-2B50E4824C79@uva.nl> References: <0A7CF9F9-391A-4424-AB1A-D124293AD9A8@alexanderonline.org> Mime-Version: 1.0 (Apple Message framework v929.2) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KwHa7-0004iA-2m for emacs-orgmode@gnu.org; Sat, 01 Nov 2008 10:36:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KwHa5-0004hx-L5 for emacs-orgmode@gnu.org; Sat, 01 Nov 2008 10:36:02 -0400 Received: from [199.232.76.173] (port=59390 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KwHa5-0004hu-GY for emacs-orgmode@gnu.org; Sat, 01 Nov 2008 10:36:01 -0400 Received: from ug-out-1314.google.com ([66.249.92.171]:38552) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KwHa5-0004ZT-DE for emacs-orgmode@gnu.org; Sat, 01 Nov 2008 10:36:01 -0400 Received: by ug-out-1314.google.com with SMTP id 36so1684570uga.17 for ; Sat, 01 Nov 2008 07:36:00 -0700 (PDT) In-Reply-To: <0A7CF9F9-391A-4424-AB1A-D124293AD9A8@alexanderonline.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Ben Alexander Cc: emacs-orgmode Org-Mode Hi Ben, On Oct 29, 2008, at 9:46 PM, Ben Alexander wrote: > 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 ( 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"))))) I have applied a similar fix, thanks. > > > 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- 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. Yes, there is a problem with this regexp, and I not not know myself how to fix it. Negated character classes do not seem to work as advertised if there is a bracket inside. Thanks! - Carsten