From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id C1F8A2A381 for ; Sat, 8 Jun 2024 07:51:46 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1717825906; b=beUeXvtBcuSL7FuQFgr7wcwAgUoOkqIa8scLA5zztsyQu0Yr1YHFz3XpZezNgtza+5b7LRSDpK oBo1tijVaVe8k3tZH4Xb2TEuFDcNsDinzWx3GumJKcVOG2MvM3ef6OxKtw/JsOISRrxDgK1Jo7 +zbzm1PwCDdJCJR5AE18/XWhMB2mPTj0o5C2YkKmJ7e8M0ZIYdjand9mA1prSE49X7lm3wPEED k9AgYm46ZClveJQL8gG/WxtO+Ma2+wsXvbuwK7lv9TZhoMWoQkXsdtbWaLO+OfSK46tCUrCgG2 QttNY1HBcuAYh9omwDXdJnc/fh+NpyaCr7kZFHeGreq0LQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (wfhigh6-smtp.messagingengine.com) smtp.remote-ip=64.147.123.157; dkim=pass header.d=arp242.net header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=arp242.net; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1717825906; bh=rn31DW7K9Xdlx9yNImmGeUnv/Yd5Ri7RXiq7SP6a8I8=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Subject:To:From:Date:Message-ID:MIME-Version: DKIM-Signature:DKIM-Signature:DKIM-Signature; b=Udk44ayB2eZ53g4veTd2DoD4CYRmItfLdXs3FGxNTYfAGoFPAKFVDQRUUqiJWy/oTU+EesPWFJ tRP73jtDVIWcjk2GV04xjUiK5qtVPkz39bqBqvICNRuBd1GvlC9tO8Mvgu9Z3jzlKEQuvZge/b nqHRwVI123jGn6gnnBmC+sHnKF+Edn69GKBryZ3ptAT7s9PeNvxR8r7G+YTE2o7D8uDWytHUC3 ahvb7n31RWHxLaoO/RsteiGovkFnSfN/jkXuNBhsgcZVfeCon+h1WfyWX+L+mIA/auzGhj4aMx dzIkNyweClDmZlStCkvbC9FiNUZiFx98A4yp6U0b1LdYhw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Subject:To:From:Date: Message-Id:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=kINcy4KPyWPC9XOydeVUbaV5e4aUPi5afK6ADP/48Aw=; b=EsUOpS28hjPmQ6Ygb1+dYprKMo Pw9ChDHjXPqSjpVOoESA0Al48u/M1S+Ny8Q+qxBElDzgpY1H3oJS+ce5zYSQgkj/BPf4H/3ZFv25c WaX2kwgfVyB/hTk4e2NZlvJtqOx2xpup8fIaylYDcOL/QwxFJMP3naVAmmW/IL00mabA3Zqsk1Ucj /mWIM3MqvCOYLBAVSb7P4Qc3djrXnFSXhnXbL5iv5KNzueuT+Exx8v/cYiqMbaVK9E5bNiCiRQhqt mU/L5AQ8xSj78ecRJ/5R1tlW6MgRohDDrxepcvBhARgsPLHMYe+pWPG2ZVwwEPNZZhNeunDO/8/zA H6Hk/fqQ==; Received: by zero.zsh.org with local id 1sFozQ-000GE4-OC; Sat, 08 Jun 2024 05:51:44 +0000 Authentication-Results: zsh.org; iprev=pass (wfhigh6-smtp.messagingengine.com) smtp.remote-ip=64.147.123.157; dkim=pass header.d=arp242.net header.s=fm1 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=arp242.net; arc=none Received: from wfhigh6-smtp.messagingengine.com ([64.147.123.157]:50083) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1sFoz4-000Fw0-9T; Sat, 08 Jun 2024 05:51:24 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailfhigh.west.internal (Postfix) with ESMTP id 9AE4C1800097 for ; Sat, 8 Jun 2024 01:51:19 -0400 (EDT) Received: from imap47 ([10.202.2.97]) by compute5.internal (MEProxy); Sat, 08 Jun 2024 01:51:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arp242.net; h=cc :content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm1; t=1717825879; x=1717912279; bh=kINcy4KPyWPC9XOydeVUbaV5e4aUPi5a fK6ADP/48Aw=; b=PYkQTEi68BWTq4tbbmdZk0CzqYh2O1b9qqLP0RDpX1BtzzNk fXW5O95XmQpf4LGYDwOxnUZt5mzHeGKB0mCybo6cgCCDAS+rwig8vsNNFfBQfzr7 CCr580XCfZtkUMRiY6guU7f7TC3wLbFxEoy5sWNsnnySRogmbEHwdP5DhTMxR7pk oU6pVtA+FsVGY3qYpInUzRU+JIVM1+YkR5LsAdrsCfdly49reY20ijDkk/Cf+VoU 7VLV4OCr+ViDJztHNB01ZFlEdlSnSvbcKtGObjooIlaiymFCMpxvu1UhRN1p+v33 TIxS1EmPLaZIg+q7lWO6qIbS3QJPQ78g7E/Oaw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1717825879; x=1717912279; bh=kINcy4KPyWPC9XOydeVUbaV5e4aUPi5afK6 ADP/48Aw=; b=emja2yajuNDd1cpboK3+C3yQ4ry/0cdfFq38wiV6gCaf8zaH5EB sZslZ/MrEvpNpFFrD5I8uJtXpCDamJ+Mk9P+cQLy2AbxcB4WBw4F0z98cPVlBba4 XYXVE8cAToSCmNRI050W95b/rnbNVx0HOcsnSBD4RmDZ/NeHKmtzznuwWtVDzdNm CMrfITsyLgFydNHYTg5H5GnuhX39BJOBTH8lb1iY4EGOcNYhzxJncxJUQ52ZNQpo ipDtkzuZBOv9KQ8yewm7QpUVPVeSzgbZtMSPJ4rQ5gUs5E4X3vqSQS1d/ghHFbfn qpRc9SwGISVfiMtBEQvm5NjaDVniYVPNj/w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrfedtvddgleekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfffhffvufgtsehttdertd erredtnecuhfhrohhmpedfofgrrhhtihhnucfvohhurhhnohhijhdfuceomhgrrhhtihhn segrrhhpvdegvddrnhgvtheqnecuggftrfgrthhtvghrnhepvddvledvvdejiefgvdevgf evtdegheevkeejtedtieejtdffteeuveduteeiieefnecuvehluhhsthgvrhfuihiivgep tdenucfrrghrrghmpehmrghilhhfrhhomhepmhgrrhhtihhnsegrrhhpvdegvddrnhgvth X-ME-Proxy: Feedback-ID: i27f8409c:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id DF1A4A60078; Sat, 8 Jun 2024 01:51:18 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.11.0-alpha0-497-g97f96844c-fm-20240526.001-g97f96844 MIME-Version: 1.0 Message-Id: <3bc6f058-4394-4b64-bd2e-44f7efbd5688@app.fastmail.com> Date: Sat, 08 Jun 2024 06:51:16 +0100 From: "Martin Tournoij" To: zsh-workers@zsh.org Subject: [PATCH] add cdtohome setting Content-Type: text/plain X-Seq: 52943 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: A small patch to add a tcsh setting I miss. I'm not sure if I got the documentation right; I spent quite some time with the "yodl" tool, but it always seems to generate empty manpages on "make", and manually trying to use it gives me errors I don't really understand. I'm probably using it wrong, or something. I kind of gave up on that. Please CC me in replies, as I'm not subscribed to this list. Thanks, Martin --- patch --- commit 6f2c688fe Author: Martin Tournoij Date: Sat Jun 8 06:28:08 2024 +0100 add cdtohome setting So just "cd" without arguments won't go to ~; I accidentally type "cd" too often. The "cdtohome" name was taken from tcsh. Example: % pwd /home/martin/src/zsh % cd % pwd /home/martin % cd - % setopt no_cdtohome % pwd /home/martin/src/zsh % cd cd: argument required % pwd /home/martin/src/zsh % cd ~ % pwd /home/martin diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index 7a9684ac8..5bd11ef79 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -260,10 +260,11 @@ cindex(directories, changing) xitem(tt(cd) [ tt(-qsLP) ] [ var(arg) ]) xitem(tt(cd) [ tt(-qsLP) ] var(old) var(new)) item(tt(cd) [ tt(-qsLP) ] {tt(PLUS())|tt(-)}var(n))( -Change the current directory. In the first form, change the -current directory to var(arg), or to the value of tt($HOME) if -var(arg) is not specified. If var(arg) is `tt(-)', change to the -previous directory. +Change the current directory. In the first form, change the current +directory to var(arg), or to the value of tt($HOME) if var(arg) is not +specified unless the tt(CD_TO_HOME) option is not set, in which case +var(arg) is required. If var(arg) is `tt(-)', change to the previous +directory. Otherwise, if var(arg) begins with a slash, attempt to change to the directory given by var(arg). diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo index c3af8dd33..af830e62d 100644 --- a/Doc/Zsh/options.yo +++ b/Doc/Zsh/options.yo @@ -91,6 +91,13 @@ tt(AUTO_CD) option set) is not a directory, and does not begin with a slash, try to expand the expression as if it were preceded by a `tt(~)' (see noderef(Filename Expansion)). ) +pindex(CD_TO_HOME) +pindex(NO_CD_TO_HOME) +pindex(CDTOHOME) +pindex(NOCDTOHOME) +item(tt(CD_TO_HOME))( +Don't go to home when using tt(cd) without any arguments. +) pindex(CD_SILENT) pindex(NO_CD_SILENT) pindex(CDSILENT) diff --git a/Src/builtin.c b/Src/builtin.c index 7bfb1ce1d..e0811daa0 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -882,6 +882,10 @@ cd_get_dest(char *nam, char **argv, int hard, int func) if (dir) zinsertlinknode(dirstack, dir, getlinknode(dirstack)); else if (func != BIN_POPD) { + if (!isset(CDTOHOME)) { + zwarnnam(nam, "argument required"); + return NULL; + } if (!home) { zwarnnam(nam, "HOME not set"); return NULL; diff --git a/Src/options.c b/Src/options.c index a0e1aa024..bf8babed3 100644 --- a/Src/options.c +++ b/Src/options.c @@ -109,6 +109,7 @@ static struct optname optns[] = { {{NULL, "cbases", 0}, CBASES}, {{NULL, "cprecedences", OPT_EMULATE|OPT_NONZSH}, CPRECEDENCES}, {{NULL, "cdablevars", OPT_EMULATE}, CDABLEVARS}, +{{NULL, "cdtohome", OPT_ALL}, CDTOHOME}, {{NULL, "cdsilent", 0}, CDSILENT}, {{NULL, "chasedots", OPT_EMULATE}, CHASEDOTS}, {{NULL, "chaselinks", OPT_EMULATE}, CHASELINKS}, diff --git a/Src/zsh.h b/Src/zsh.h index 090abf8f5..52f80f055 100644 --- a/Src/zsh.h +++ b/Src/zsh.h @@ -2390,6 +2390,7 @@ enum { CASEPATHS, CBASES, CDABLEVARS, + CDTOHOME, CDSILENT, CHASEDOTS, CHASELINKS,