From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] New Package: resize-mode Date: Sun, 22 Nov 2015 12:22:31 +0000 Message-ID: <87fuzykyuw.fsf@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1448191418 18355 80.91.229.3 (22 Nov 2015 11:23:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 22 Nov 2015 11:23:38 +0000 (UTC) Cc: emacs-devel To: daniel sutton Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 22 12:23:33 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a0Sjz-0004ll-FM for ged-emacs-devel@m.gmane.org; Sun, 22 Nov 2015 12:23:31 +0100 Original-Received: from localhost ([::1]:55541 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0Sjz-0003Tc-8U for ged-emacs-devel@m.gmane.org; Sun, 22 Nov 2015 06:23:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0Sjv-0003TO-NB for emacs-devel@gnu.org; Sun, 22 Nov 2015 06:23:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a0Sjs-0004Ur-Hr for emacs-devel@gnu.org; Sun, 22 Nov 2015 06:23:27 -0500 Original-Received: from mail-wm0-x22f.google.com ([2a00:1450:400c:c09::22f]:34586) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0Sjs-0004UA-88 for emacs-devel@gnu.org; Sun, 22 Nov 2015 06:23:24 -0500 Original-Received: by wmvv187 with SMTP id v187so125570072wmv.1 for ; Sun, 22 Nov 2015 03:23:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=LckDuU7Fvx8/JIlqxTg9khQ/T1ynMWartEeXGI6atwc=; b=zVkUkkqeZEn4993kmOW2b4ejoCR1TruvFxqkGP+QakgPN3CN39jlOgHuAtwKxMa8Xg 9Zc6zXGVZh3IjAGDAUgz5ZFIbAp7EpbGzfFVd7xMoBWTTnJPlsjf4jK2FVQZD0f3S+hN 96jN2NyFt73YBYnKEqUIT3c/07ln0poRJOSbhznfmPcb54BYcXlWTxXQ2jFoIkwffGpL tQ2f8j9ZYnKbOHfJHxtJRxuj3adQzgw8cLVbeTo/M/NvR05d3yES5BVWU8LAI3++P6xL 3GVeVqCmRuooVeTD5kUkmVX7hc1dEtm2jtY8Hlvj2EljV3fMYUG20tuBY1Gfuu1R60A+ IRUg== X-Received: by 10.194.20.2 with SMTP id j2mr25333723wje.46.1448191402740; Sun, 22 Nov 2015 03:23:22 -0800 (PST) Original-Received: from Gandalf-Linux.gmail.com (host-78-151-181-156.as13285.net. [78.151.181.156]) by smtp.gmail.com with ESMTPSA id n7sm8105589wmf.21.2015.11.22.03.23.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Nov 2015 03:23:20 -0800 (PST) In-Reply-To: (daniel sutton's message of "Sat, 21 Nov 2015 21:56:26 -0600") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c09::22f X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:194997 Archived-At: Looks like a fine addition to Gelpa. The only suggestion I would make before pushing it is that it be renamed to `resize-window'. That's more descriptive of what it does (resize-mode could mean quite a few things) and, besides, this package is not a mode. :-) Below are a few comments the code. These are all just small improvements which could be addressed before or after pushing. daniel sutton writes: > (defface rw-background-face > =C2=A0 '((t (:foreground "gray40"))) > =C2=A0 "Face for when resizing window.") Why is it called `background-face' if it only sets the foreground? Also, the current convention is to not have `-face' at the end of face names (I know, a lot of built-in faces have this, but they're for backwards compatibility).=20=20=20=20=20=20=20=20 > (defvar rw-dispatch-alist > =C2=A0 ;; (key function description allow-caps-for-scaled) > =C2=A0 () > =C2=A0 "List of actions for `rw-dispatch-default.") > > (setq rw-dispatch-alist > =C2=A0 =C2=A0 =C2=A0 '((?n rw-enlarge-down =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0" Resize - Expand down" t) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (?p rw-enlarge-up =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0" Resize - Expand up" t) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (?f rw-enlarge-horizontally =C2=A0" Resize - = horizontally" t) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (?b rw-shrink-horizontally =C2=A0 " Resize - = shrink horizontally" > t) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (?r rw-reset-windows =C2=A0 =C2=A0 =C2=A0 =C2= =A0 " Resize - reset window layour" > nil) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (?w rw-cycle-window-positive " Resize - cycle= window" nil) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (?W rw-cycle-window-negative " Resize - cycle= window" nil) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (?? rw-display-menu =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0" Resize - display menu" nil))) Is there a reason why this is done like this? Why not just set this value inside the defvar? > (defun rw-execute-action (choice &optional scaled) > =C2=A0 "Given a CHOICE, grab values out of the alist. > If SCALED, then call action with the rw-capital-argument." > =C2=A0 ;; (char function description) > =C2=A0 (let ((action (cadr choice)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (description (car (cdr (cdr choice))))) > =C2=A0 =C2=A0 (progn This progn is redundant. > (defun resize-window () > =C2=A0 "Resize the window. > Press n to enlarge down, p to enlarge up, b to enlarge left and f > to enlarge right.=C2=A0 Current ARG is not supported." > =C2=A0 (interactive) > =C2=A0 (setq rw-background-overlay (rw-make-background)) > =C2=A0 (message "Resize mode: enter character, ? for help") > =C2=A0 (let ((reading-characters t) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; allow mini-buffer to collapse after displa= ying menu > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (resize-mini-windows t)) > =C2=A0 =C2=A0 (while reading-characters > =C2=A0 =C2=A0 =C2=A0 (let* ((char (read-char-exclusive)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(choice (assoc char rw-di= spatch-alist)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(capital (assoc (+ char 3= 2) rw-dispatch-alist))) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if choice > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (rw-execute-action choice) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (if (and capital (rw-allows-capitals c= apital)) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (rw-execute-action capit= al t) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (progn > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setq reading-characters= nil) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (delete-overlay rw-backg= round-overlay)))))))) Really small nitpick, but this would read better as a cond. (And that progn is redundant).