From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: non-existent agenda file ~/file.txt. [R]emove from list or [A]bort? Date: Mon, 04 Jun 2012 12:13:06 -0400 Message-ID: <26575.1338826386@alphaville> References: <804nr9sqcz.fsf@somewhere.org> <80lik3nsim.fsf@somewhere.org> <24826.1338816954@alphaville> <80sjebkuwk.fsf@somewhere.org> Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([208.118.235.92]:60915) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbZuA-0004b5-Mf for emacs-orgmode@gnu.org; Mon, 04 Jun 2012 12:13:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SbZu5-0000hA-La for emacs-orgmode@gnu.org; Mon, 04 Jun 2012 12:13:18 -0400 Received: from g4t0016.houston.hp.com ([15.201.24.19]:31261) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SbZu5-0000gq-F3 for emacs-orgmode@gnu.org; Mon, 04 Jun 2012 12:13:13 -0400 In-Reply-To: Message from "Sebastien Vauban" of "Mon, 04 Jun 2012 16:34:51 +0200." <80sjebkuwk.fsf@somewhere.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Sebastien Vauban Cc: emacs-orgmode@gnu.org Sebastien Vauban wrote: > (progn (debug) (message "non-existent agenda file %s. [R]emove from list = > or [A]bort?" (abbreviate-file-name file)) (let ((r (downcase (read-char-exc= > lusive)))) (cond ((equal r 114) (org-remove-file file) (throw (quote nextfi= > le) t)) (t (error "Abort"))))) > (if (not (file-exists-p file)) (progn (debug) (message "non-existent agen= > da file %s. [R]emove from list or [A]bort?" (abbreviate-file-name file)) (l= > et ((r (downcase (read-char-exclusive)))) (cond ((equal r 114) (org-remove-= > file file) (throw (quote nextfile) t)) (t (error "Abort")))))) > (when (not (file-exists-p file)) (debug) (message "non-existent agenda fi= > le %s. [R]emove from list or [A]bort?" (abbreviate-file-name file)) (let ((= > r (downcase (read-char-exclusive)))) (cond ((equal r 114) (org-remove-file = > file) (throw (quote nextfile) t)) (t (error "Abort"))))) > org-check-agenda-file("c:/home/sva/Projects/ttttttttttttttt.txt") > ... > org-prepare-agenda-buffers(("c:/home/sva/Projects/ttttttttttttttt.txt")) > ... > org-map-entries((lambda nil (let ((alltags (split-string (or (org-entry-get (point) "ALLTAGS") "") ":")) local inherited tag) (dolist (tag alltags) (if (get-text-property 0 (quote inherited) tag) (push tag inherited) (push tag local))) (dolist (tag local) (if (member tag inherited) (org-toggle-tag tag (quote off)))))) t nil) > ... > my/org-remove-redundant-tags() > (progn (my/org-remove-redundant-tags) (org-align-all-tags) (org-update-al= > l-dblocks) (org-table-iterate-buffer-tables)) > (if (eq major-mode (quote org-mode)) (progn (my/org-remove-redundant-tags= > ) (org-align-all-tags) (org-update-all-dblocks) (org-table-iterate-buffer-t= > ables))) > (when (eq major-mode (quote org-mode)) (my/org-remove-redundant-tags) (or= > g-align-all-tags) (org-update-all-dblocks) (org-table-iterate-buffer-tables= > )) > (lambda nil (when (eq major-mode (quote org-mode)) (my/org-remove-redunda= > nt-tags) (org-align-all-tags) (org-update-all-dblocks) (org-table-iterate-b= > uffer-tables)))() > run-hooks(before-save-hook) > basic-save-buffer() > save-buffer(1) > call-interactively(save-buffer nil nil) > org-map-entries calls org-prepare-agenda-buffers like this: (org-prepare-agenda-buffers (list (buffer-file-name (current-buffer)))) In turn, this calls org-check-agenda-file() and if the current buffer has not been written out yet, this pops the question. So there is a chicken-and-egg problem here, because you added the function to the before-save hook. Not sure how to resolve it though. Nick