From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nathan Neff Subject: Can this function be written better? Date: Mon, 6 Dec 2010 12:29:37 -0600 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from [140.186.70.92] (port=47179 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPfoj-0005xg-Gn for emacs-orgmode@gnu.org; Mon, 06 Dec 2010 13:29:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PPfog-0005gV-VK for emacs-orgmode@gnu.org; Mon, 06 Dec 2010 13:29:41 -0500 Received: from mail-bw0-f41.google.com ([209.85.214.41]:43907) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PPfog-0005gB-N4 for emacs-orgmode@gnu.org; Mon, 06 Dec 2010 13:29:38 -0500 Received: by bwz16 with SMTP id 16so18370758bwz.0 for ; Mon, 06 Dec 2010 10:29:37 -0800 (PST) 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: emacs-orgmode I'd like to be able to easily toggle the showing/hiding of CLOSED clock items in the agenda. I have a function that does exactly that. My Lisp is terrible (I bet that's never been said before :-) and I want to try to improve it. Any suggestions how to improve/refactor the following function? (defun njn/agenda-toggle-show-closed() "Toggle whether closed clock thingies are shown in the agenda" (interactive) (if (eq njn/org-agenda-show-closed 't) (progn (setq org-agenda-log-mode-items (quote (clock))) (setq njn/org-agenda-show-closed nil) (message "NOT Showing closed clock entries in agenda")) (progn (setq org-agenda-log-mode-items (quote (closed clock))) (setq njn/org-agenda-show-closed 't) (message "Showing closed clock entries in agenda")) )) Thanks, --Nate