From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: New version of todo-mode.el (announcement + user guide) Date: Sat, 15 Jun 2013 20:44:03 -0400 Message-ID: References: <87k3m2275u.fsf@rosalinde.fritz.box> <8761xmxfnx.fsf@bzg.ath.cx> <87txl6ghjq.fsf@rosalinde.fritz.box> <87a9myggr7.fsf@wanadoo.es> <87sj0p8z99.fsf@rosalinde.fritz.box> <87mwqwpk98.fsf@rosalinde.fritz.box> <6emwqvxmpo.fsf@fencepost.gnu.org> <8761xjdn7t.fsf@rosalinde.fritz.box> <87txl1bula.fsf@rosalinde.fritz.box> <87obb874ru.fsf@rosalinde.fritz.box> <87y5abbkov.fsf@rosalinde.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1371343450 30411 80.91.229.3 (16 Jun 2013 00:44:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 16 Jun 2013 00:44:10 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stephen Berman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 16 02:44:10 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Uo14k-0003U9-6B for ged-emacs-devel@m.gmane.org; Sun, 16 Jun 2013 02:44:10 +0200 Original-Received: from localhost ([::1]:33455 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uo14j-0007Ys-SN for ged-emacs-devel@m.gmane.org; Sat, 15 Jun 2013 20:44:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39267) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uo14g-0007Yf-KM for emacs-devel@gnu.org; Sat, 15 Jun 2013 20:44:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uo14f-0008M4-0N for emacs-devel@gnu.org; Sat, 15 Jun 2013 20:44:06 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:22014) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uo14e-0008L0-SH; Sat, 15 Jun 2013 20:44:04 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFpZVy/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IPAS-Result: Av4EABK/CFFFpZVy/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="16486426" Original-Received: from 69-165-149-114.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([69.165.149.114]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 15 Jun 2013 20:43:58 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 6D0FBAE2E2; Sat, 15 Jun 2013 20:44:03 -0400 (EDT) In-Reply-To: <87y5abbkov.fsf@rosalinde.fritz.box> (Stephen Berman's message of "Sat, 15 Jun 2013 14:52:16 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.182 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:160454 Archived-At: > restore the proper display. But what happens between widening and > re-narrowing is different in the two situations (indicated below by the You could unify the two with something like (defvar diary-goto-entry-function (lambda (pos) (if (number-or-marker-p pos) (goto-char pos)) (goto-char (point-min)) (when (re-search-forward (format "%s.*\\(%s\\)" (regexp-quote (car locator)) (regexp-quote (nth 1 locator))) nil t) (goto-char (match-beginning 1)))) "Function called to jump to a diary entry. Called with one argument which can be either a simple buffer position, or a description of the form (FOO BAR) where FOO is some leading text and BAR is the actual text of the entry.") (defun diary-goto-entry (button) "Jump to the diary entry for the BUTTON at point." (let* ((locator (button-get button 'locator)) (marker (car locator)) (file (nth 1 locator)) (place (cond ;; If marker pointing to diary location is valid, use that. ((and marker (marker-buffer marker)) (cons (marker-buffer marker) marker)) ;; Marker is invalid (eg buffer has been killed). ((and file (file-exists-p file)) (cons (find-file-noselect file) (cddr locator))) (t (message "Unable to locate this diary entry") nil)))) (when place (pop-to-buffer (car place)) (funcall diary-goto-entry-function (cdr place))))) > Actually, I don't see why the first situation, using a valid marker, is > needed. I don't have any opinion on that part because I don't use this part of the diary. Stefan