From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [PATCH] org-agenda: Add 'none setting for org-agenda-overriding-header Date: Wed, 23 Aug 2017 10:48:28 +0200 Message-ID: <87lgma1xgj.fsf@nicolasgoaziou.fr> 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> <87a82rkqmf.fsf@alphapapa.net> <8760dfko9f.fsf@alphapapa.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47524) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dkRL0-0008K4-BG for emacs-orgmode@gnu.org; Wed, 23 Aug 2017 04:48:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dkRKx-0003JP-5p for emacs-orgmode@gnu.org; Wed, 23 Aug 2017 04:48:34 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:44710) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dkRKw-0003J7-WD for emacs-orgmode@gnu.org; Wed, 23 Aug 2017 04:48:31 -0400 In-Reply-To: <8760dfko9f.fsf@alphapapa.net> (Adam Porter's message of "Tue, 22 Aug 2017 21:32:12 -0500") 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: Adam Porter Cc: emacs-orgmode@gnu.org Adam Porter writes: > Here are the patches. Please let me know if any other changes are > needed. Thank you! Comments follow. > +(defmacro org-agenda--insert-overriding-header (&key default) There is no "&key" in `defmacro'. It should be (default). > + "Insert header into agenda view depending on value of `org-agenda-overriding-header'. > +If the empty string, don't insert a header. If any other string, > +insert it as a header. If nil, insert DEFAULT, which should > +evaluate to a string." > + (declare (debug (&key form))) It needs to be updated according to the above. > + ;; Format week number span > + (cond ((< (- d2 d1) 350) > + (if (= w1 w2) > + (format " (W%02d)" w1) > + (format " (W%02d-W%02d)" w1 w2))) > + (t "")) (cond ((<= 350 (- d2 d1)) "") ((= w1 w2) (format " (W%02d)" w1)) (t (format " (W%02d-W%02d)" w1 w2))) > - (let ((n 0) s) > - (mapc (lambda (x) > - (setq s (format "(%d)%s" (setq n (1+ n)) x)) > - (if (> (+ (current-column) (string-width s) 1) (frame-width)) > - (insert "\n ")) > - (insert " " s)) > - kwds)) > + (cl-loop for keyword in kwds > + and num from 1 > + for string = (format "(%d)%s" num keyword) > + when (> (+ (current-column) (string-width string) 1) > + (window-width)) > + do (insert "\n ") > + do (insert " " string)) Ouch. Why `cl-loop' over `dolist'? Also it looks wrong since the last `do' is not always executed? (or is it?). I know there is more than one way to skin a cat, but I'd rather use a straightforward one: (let ((n 0)) (dolist (k kwds) (let ((s (format "(%d)%s" (cl-incf n) k))) (when (> (+ (current-column) (string-width s) 1) (frame-width)) (insert "\n ")) (insert " " s)))) Regards,