From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Porter Subject: Re: [PATCH] org-agenda: Add 'none setting for org-agenda-overriding-header Date: Tue, 22 Aug 2017 20:41:12 -0500 Message-ID: <87a82rkqmf.fsf@alphapapa.net> References: <87k22416un.fsf@alphapapa.net> <87bmnep8yz.fsf@nicolasgoaziou.fr> <8760dmynkk.fsf@alphapapa.net> <871so9nt04.fsf@nicolasgoaziou.fr> <87pobrc5vp.fsf@alphapapa.net> <87wp5yir25.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dkKfp-00068g-Vo for emacs-orgmode@gnu.org; Tue, 22 Aug 2017 21:41:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dkKfm-0003pt-SW for emacs-orgmode@gnu.org; Tue, 22 Aug 2017 21:41:38 -0400 Received: from [195.159.176.226] (port=60622 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dkKfm-0003oC-Lu for emacs-orgmode@gnu.org; Tue, 22 Aug 2017 21:41:34 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dkKfY-0006el-B7 for emacs-orgmode@gnu.org; Wed, 23 Aug 2017 03:41:20 +0200 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" To: emacs-orgmode@gnu.org Hi Nicolas, Nicolas Goaziou writes: > Nitpick: the paragraph above usually comes after the list of changes. Fixed. > Nitpick: you can only write "Use macro" once, on the last line. Fixed. > Why `cl-defmacro'? Usually, `defmacro' is enough. Fixed. > While we're at it, > > `org-add-props' + `copy-sequence' = `propertize' > > If you're ready for further refactoring, the nested `if' above could > be turned into a nicer `cond'. > > Same here: `mapc' + `lambda' = `dolist' to avoid funcall overhead. `s' > could be let-bound too. I'll refactor these in a separate patch to isolate any potential mistakes. >> + ;; When nil, make string automatically and insert it >> + ((pred null) (insert ,default)))) > > I suggest to use ,@default (and, obviously (&rest default) in the > arguments) so we are not limited to one S-exp. I saw that all of the default header code boiled down to inserting a string, so I moved the ultimate `insert' into the macro so it could accept a form that evaluates to a string; it seemed like a cleaner, more functional approach to essentially accept a string rather than arbitrary code (even though it does accept any sexp, but that is to avoid evaluating it unless it's needed). I used a keyword argument rather than &rest for two reasons: 1) so the macro could accept different option arguments in the future, and 2) so it's plain from looking at the macro call that the form given is the default, which may be overridden, rather than what's always used. If you would prefer the &rest approach, that would mean doing the actual insertion into the agenda buffer in the macro call rather than the macro expansion. I thought it would be better to separate the actual insertion by abstracting it behind the macro. In fact, it could be done as a function instead, but, of course, that would mean evaluating the default even when it's not used, so that's why I chose a macro. (Or the default could be passed as a lambda, but that seems even more awkward.) Anyway, let me know what you prefer. > All in all, the only requested change is `cl-defmacro' -> `defmacro'. > This is no blocker if you don't want/have time to do the refactoring. I'll post a new patch soon. Thanks.