From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#35771: [PATCH] Customization type of recentf-max-saved-items Date: Fri, 17 May 2019 06:36:30 -0700 (PDT) Message-ID: <42941bba-e6b4-4a46-b56f-97ffcfc2117f@default> References: <87pnohb79x.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="32067"; mail-complaints-to="usenet@blaine.gmane.org" To: Dario Gjorgjevski , 35771@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 17 15:37:50 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hRd3W-0008Df-0U for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 May 2019 15:37:50 +0200 Original-Received: from localhost ([127.0.0.1]:48785 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRd3U-0002AE-W5 for geb-bug-gnu-emacs@m.gmane.org; Fri, 17 May 2019 09:37:49 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hRd2l-0001mR-AJ for bug-gnu-emacs@gnu.org; Fri, 17 May 2019 09:37:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hRd2k-00060Z-Ad for bug-gnu-emacs@gnu.org; Fri, 17 May 2019 09:37:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44245) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hRd2k-00060P-6D for bug-gnu-emacs@gnu.org; Fri, 17 May 2019 09:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hRd2k-0004XQ-0D for bug-gnu-emacs@gnu.org; Fri, 17 May 2019 09:37:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 17 May 2019 13:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35771 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 35771-submit@debbugs.gnu.org id=B35771.155810020017416 (code B ref 35771); Fri, 17 May 2019 13:37:01 +0000 Original-Received: (at 35771) by debbugs.gnu.org; 17 May 2019 13:36:40 +0000 Original-Received: from localhost ([127.0.0.1]:57789 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRd2O-0004Wq-EV for submit@debbugs.gnu.org; Fri, 17 May 2019 09:36:40 -0400 Original-Received: from userp2120.oracle.com ([156.151.31.85]:45364) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hRd2M-0004Wd-7V for 35771@debbugs.gnu.org; Fri, 17 May 2019 09:36:39 -0400 Original-Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4HDXv0B030637; Fri, 17 May 2019 13:36:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : subject : references : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=r7NK3wqrKQ5/sGbvK5EFBMhLoMp/h5hzHd9QDpD+h1c=; b=gQr9y+b2bspgk2kNVFlxDirNtQexkHIggbGycWKH23QCNe7tML9P75BrFJscNTYn7vVz hsA542x4R9yL+nTyZLs1qF0ZCk534YtUP0oGdK88Ju6KujVcWNAsja6JhTFr8G7L2djb Scj4Uziq7WhJuI6GA6bSwtR4t/ieRR3LSZnNfad/ynSNjkijRoTYlxD9VReRIHeg71KG vjFvotca5qonveTk75VXiyCtr5VO6ft8rj0W+1XB5p6ggA9xtkIVAVcH6F2vx8t+iKHa J9wr7Y+6qAFya9mmcacxqKvstnlJekaNy38A9Do/x4ZUyQFcFgTu1f2pOCsg2gy7+iyi GA== Original-Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 2sdq1r1mgg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 17 May 2019 13:36:32 +0000 Original-Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4HDZQui179684; Fri, 17 May 2019 13:36:31 GMT Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2sggeua07c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 17 May 2019 13:36:31 +0000 Original-Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x4HDaUPU029717; Fri, 17 May 2019 13:36:30 GMT In-Reply-To: <87pnohb79x.fsf@gmail.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4849.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9259 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905170087 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9259 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905170087 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:159450 Archived-At: > The customization type of recentf-max-saved-items is currently defined > as integer, which does not include nil in its domain. However, setting > this variable to nil is supported in the code and also documented. >=20 > This patch changes the customization type to explicitly allow for the > variable to be set to nil through the Customization interface and > similar. (Please note that I copied the type from save-place-limit in > order to be consistent.) (I'm looking at Emacs 26.2, so apologies if the Emacs 27 code has already fixed this.) The code should also be changed to do one of the following: 1. Use `abs' when the variable value is used. 2. Use `restricted-sexp' in the defcustom :type, to require the value to be a non-negative (or possibly a positive?) integer (or nil). I'm guessing there are additional places in Emacs code where :type 'integer is used but a non-negative integer is really needed/appropriate. It would be good to improve those :type specs as well. (We might also want to consider adding `natnum' or `nonnegative-integer', `positive-integer' and `negative-integer' as possible :type values.) But it is simple to use `restricted-sexp' to control such things. And not only would that improve the behavior for users; it would also, by way of model, encourage users to use `restricted-sexp' in their own code. Emacs-Lisp code delivered with Emacs is not a great model in this respect. It rarely uses `restricted-sexp' - at least it uses it much less than it could/should (IMHO). More generally, the distributed Emacs code is pretty "lazy" when it comes to providing defcustom definitions - few :tag descriptions, overly general :type specs, etc. E.g., (defcustom recentf-max-saved-items 20 "Maximum number of recently used file names to save. `nil' means save the whole list. See command `recentf-save-list'." :group 'recentf :type '(choice=20 (restricted-sexp :tag "Save no more than this many file names" :match-alternatives ((lambda (x) (and (natnump x) (not (zerop x))))) :value ignore) (const :tag "Save all file names" nil)))