emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nathan Neff <nathan.neff@gmail.com>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Can this function be written better?
Date: Mon, 6 Dec 2010 12:29:37 -0600	[thread overview]
Message-ID: <AANLkTimMhnsUme2qAWoXY2cUPdCj_wVVYGjJQW43zuuc@mail.gmail.com> (raw)

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

             reply	other threads:[~2010-12-06 18:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-06 18:29 Nathan Neff [this message]
2010-12-06 21:53 ` Can this function be written better? Bernt Hansen
2010-12-07  3:00   ` Nathan Neff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTimMhnsUme2qAWoXY2cUPdCj_wVVYGjJQW43zuuc@mail.gmail.com \
    --to=nathan.neff@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).