From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Marc Coquand Newsgroups: gmane.emacs.help Subject: Auto add register when leaving buffer? Date: Tue, 05 Nov 2024 11:29:55 +0200 Message-ID: <874j4m2fl8.fsf@mccd.space> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40196"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 05 10:30:35 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t8FtP-000A6a-EU for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 05 Nov 2024 10:30:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8Ft1-0000eh-BM; Tue, 05 Nov 2024 04:30:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t8Fsy-0000eT-QB for help-gnu-emacs@gnu.org; Tue, 05 Nov 2024 04:30:04 -0500 Original-Received: from fhigh-a2-smtp.messagingengine.com ([103.168.172.153]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t8Fsw-0004a4-J7 for help-gnu-emacs@gnu.org; Tue, 05 Nov 2024 04:30:04 -0500 Original-Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id CC01C1140171 for ; Tue, 5 Nov 2024 04:29:59 -0500 (EST) Original-Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-10.internal (MEProxy); Tue, 05 Nov 2024 04:29:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mccd.space; h=cc :content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm2; t=1730798999; x=1730885399; bh=L+2TvpBNlXMGdQGBooY3z886NYosx/vk Q32kY/2MSts=; b=XEhu6rLwHe/CoPDq6Q+vEYh6kAv/IkAny3CXhhkK//kkF7h8 /Zz7NsUmJCA1lmd4BgfV1+mscIJAGhFAi95nTQScDVNtrHDKTg7bNjKqTnTIj4mQ lkp4psMA71fNXkPXKMheInEyYOqJUOV+/U/QdLsMN3MalgWO8Xhfuooqnzwnn/8V kWdezWM6KFxyKhil11hC38Nn1fSuxQw9dcxaTEpQWCGVC2ptzWUyB5TajV4B6Bi8 zi+cfEpW1s8Y/rw3ToPiTjV5Iyp1QBodBInbOM3mfrD0wI1+s0aCHA0KRlfEDzPQ uKuA9VA/wIEn7vBGXfgeU/AgwnJ/fxP0B70nOA== 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-sender:x-me-sender:x-sasl-enc; s=fm3; t=1730798999; x= 1730885399; bh=L+2TvpBNlXMGdQGBooY3z886NYosx/vkQ32kY/2MSts=; b=U 9rKQinNyWFe4dcGquUMWbr0k4MvAvzXAN8TVA/IzTGboDWB6L0FOHZPfZ/d3orcJ 3gGXkXa+Fbohj+vHE+A4bVyecv+uiedQSST94OfHQasse6msPXW5o5Dxt72eVceL oRhB5FPZYDHtsgYG7w9HIoebPR/vSs6qcmzAbhd2cMTc4TeGqyNNqsmPmdLvntE5 ZYr3XG+Ez44vVHoKix/APaB9Ya6/qFg8AnNqxusWLljeU21tcFX5XQAq3CPif8os Pm4eZy9OKASO4t58mSXKQxDpT4Imc1BIxtqboNCdQZYO3bYNtSLNQKCxFB5emfMH xyJsF9taalqWgyUZmIixQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdelkedgtdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuff fkgggtsehttdertddttddtnecuhfhrohhmpeforghrtgcuvehoqhhurghnugcuoehmrghr tgesmhgttggurdhsphgrtggvqeenucggtffrrghtthgvrhhnpeeiteffffevfefhvefghe dvheetjeeivdduheeltdehueeuieevleejleeiheegfeenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrghrtggtsehfrghsthhmrghilhdrfh hrpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehh vghlphdqghhnuhdqvghmrggtshesghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: ia2d149fd:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 5 Nov 2024 04:29:59 -0500 (EST) Received-SPF: pass client-ip=103.168.172.153; envelope-from=marcc@fastmail.fr; helo=fhigh-a2-smtp.messagingengine.com X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:148277 Archived-At: Heya, In vim I used to have a nifty setup where I would auto register marks when leaving a buffer. For example, I'd auto assign 'c to be last open css file, 'h to be last open html file etc. I'm trying to setup something similar in emacs, and tried the following hook: (use-package sgml-mode :hook (css-mode . (lambda () (interactive) (add-hook 'window-buffer-change-functions (lambda () (interactive) (point-to-register ?c)) 0 't)))) I think I'm on the right track, but it seems to not be working. The following function (defun me/point-to-c () (interactive) (point-to-register ?c)) Seems to work, but the hook that should trigger on buffer change does not work. What am I missing? -- mccd