From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 04 01:58:07 2013 Received: (at submit) by debbugs.gnu.org; 4 Oct 2013 05:58:07 +0000 Received: from localhost ([127.0.0.1]:52980 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VRyOs-0004Il-4P for submit@debbugs.gnu.org; Fri, 04 Oct 2013 01:58:06 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49317) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VRyOp-0004Ib-K6 for submit@debbugs.gnu.org; Fri, 04 Oct 2013 01:58:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VRyOg-00032e-Sa for submit@debbugs.gnu.org; Fri, 04 Oct 2013 01:58:03 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:48069) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRyOg-00032a-PC for submit@debbugs.gnu.org; Fri, 04 Oct 2013 01:57:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50881) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRyOX-0003uV-5f for bug-gnu-emacs@gnu.org; Fri, 04 Oct 2013 01:57:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VRyOO-0002wd-M5 for bug-gnu-emacs@gnu.org; Fri, 04 Oct 2013 01:57:45 -0400 Received: from mail-pa0-x22c.google.com ([2607:f8b0:400e:c03::22c]:34237) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRyOO-0002wX-9p for bug-gnu-emacs@gnu.org; Fri, 04 Oct 2013 01:57:36 -0400 Received: by mail-pa0-f44.google.com with SMTP id lf10so3668217pab.17 for ; Thu, 03 Oct 2013 22:57:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type; bh=4LiYaUWtY0a9qQMzzzg78DwjwGFp4klCWwTfCPLO2Fs=; b=OzrsAtka5lAHXWoytSmJBauaMic9xUyYjmz29xMoEbLLqlUQ50uQJXhyZPgjHnF6n+ RsTCrZ7IfP3QqZxBJ02qPXJ6FirGcB1dU/YLoudpsBGJ0IlSWgp9wpjldcrgEPEvSId3 fFjcOGT0yKy7KrfMyiklYDDvvy0y7mN1oohfGKQcBOZyArPgjXUmMOIL70PAk0HUQ28R ZnEhWquhUssunBKmnn/lEbLGZeyNSm7sE2/mXewAnPMv9kMH6ISkQIF5OiIVEmbGdVVG szI4KeUE6xBNxJyyzSMCPfagq56zBxeJFG3VkNOMgB9eKX1MptUp0jxeIfPd3aei9N7M XaDw== X-Received: by 10.66.7.68 with SMTP id h4mr9879289paa.0.1380866254471; Thu, 03 Oct 2013 22:57:34 -0700 (PDT) Received: from localhost ([123.115.243.110]) by mx.google.com with ESMTPSA id vz4sm15359827pab.11.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 03 Oct 2013 22:57:33 -0700 (PDT) From: Leo Liu To: bug-gnu-emacs@gnu.org Subject: 24.3; register-read-with-preview X-Debbugs-CC: Stefan Monnier , =?iso-8859-1?Q?=D3scar?= Fuentes Date: Fri, 04 Oct 2013 13:57:26 +0800 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-=-= Content-Type: text/plain register-read-with-preview pops up a window showing existing registers and brief description. Any comments? --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=reg.diff Content-Description: reg.diff === modified file 'lisp/register.el' --- lisp/register.el 2013-08-09 00:30:24 +0000 +++ lisp/register.el 2013-10-04 05:48:34 +0000 @@ -89,6 +89,11 @@ :type '(choice (const :tag "None" nil) (character :tag "Use register" :value ?+))) +(defcustom register-preview-delay 0.5 + "Delay in seconds before popping up the preview window." + :type 'number + :group 'register) + (defun get-register (register) "Return contents of Emacs register named REGISTER, or nil if none." (cdr (assq register register-alist))) @@ -102,12 +107,54 @@ (push (cons register value) register-alist)) value)) +(defun register-describe-oneline (c) + (let ((d (replace-regexp-in-string + "\n[ \t]*" " " + (with-output-to-string (describe-register-1 c))))) + (if (string-match "Register.+? contains \\(?:an? \\|the \\)?" d) + (substring d (match-end 0)) + d))) + +(defvar register-preview-functions nil) + +(defun register-preview (buffer) + "Pop up a window to show register preview in BUFFER." + (when (consp register-alist) + (let ((split-height-threshold 0)) + (with-temp-buffer-window + buffer + (cons 'display-buffer-below-selected + '((window-height . fit-window-to-buffer))) + nil + (with-current-buffer standard-output + (setq cursor-in-non-selected-windows nil) + (mapc (lambda (r) + (insert + (format + "%s %s\n" + (concat (single-key-description (car r)) ":") + (or (run-hook-with-args 'register-preview-functions (cdr r)) + (register-describe-oneline (car r)))))) + register-alist)))))) + +(defun register-read-with-preview (prompt) + (let* ((buffer "*Register Preview*") + (timer (run-with-timer register-preview-delay nil + #'register-preview buffer))) + (unwind-protect + (read-event (propertize prompt 'face 'minibuffer-prompt)) + (and (timerp timer) (cancel-timer timer)) + (let ((w (get-buffer-window buffer))) + (and (window-live-p w) (delete-window w))) + (and (get-buffer buffer) (kill-buffer buffer))))) + (defun point-to-register (register &optional arg) "Store current location of point in register REGISTER. With prefix argument, store current frame configuration. Use \\[jump-to-register] to go to that location or restore that configuration. Argument is a character, naming the register." - (interactive "cPoint to register: \nP") + (interactive (list (register-read-with-preview "Point to register: ") + current-prefix-arg)) ;; Turn the marker into a file-ref if the buffer is killed. (add-hook 'kill-buffer-hook 'register-swap-out nil t) (set-register register @@ -118,7 +165,9 @@ "Store the window configuration of the selected frame in register REGISTER. Use \\[jump-to-register] to restore the configuration. Argument is a character, naming the register." - (interactive "cWindow configuration to register: \nP") + (interactive (list (register-read-with-preview + "Window configuration to register: ") + current-prefix-arg)) ;; current-window-configuration does not include the value ;; of point in the current buffer, so record that separately. (set-register register (list (current-window-configuration) (point-marker)))) @@ -127,7 +176,9 @@ "Store the window configuration of all frames in register REGISTER. Use \\[jump-to-register] to restore the configuration. Argument is a character, naming the register." - (interactive "cFrame configuration to register: \nP") + (interactive (list (register-read-with-preview + "Frame configuration to register: ") + current-prefix-arg)) ;; current-frame-configuration does not include the value ;; of point in the current buffer, so record that separately. (set-register register (list (current-frame-configuration) (point-marker)))) @@ -143,7 +194,8 @@ Optional second arg non-nil (interactively, prefix argument) says to delete any existing frames that the frameset doesn't mention. \(Otherwise, these frames are iconified.)" - (interactive "cJump to register: \nP") + (interactive (list (register-read-with-preview "Jump to register: ") + current-prefix-arg)) (let ((val (get-register register))) (cond ((registerv-p val) @@ -190,7 +242,8 @@ If NUMBER is nil, a decimal number is read from the buffer starting at point, and point moves to the end of that number. Interactively, NUMBER is the prefix arg (none means nil)." - (interactive "P\ncNumber to register: ") + (interactive (list current-prefix-arg + (register-read-with-preview "Number to register: "))) (set-register register (if number (prefix-numeric-value number) @@ -222,7 +275,7 @@ (defun view-register (register) "Display what is contained in register named REGISTER. The Lisp value REGISTER is a character." - (interactive "cView register: ") + (interactive (list (register-read-with-preview "View register: "))) (let ((val (get-register register))) (if (null val) (message "Register %s is empty" (single-key-description register)) @@ -323,7 +376,10 @@ Normally puts point before and mark after the inserted text. If optional second arg is non-nil, puts mark before and point after. Interactively, second arg is non-nil if prefix arg is supplied." - (interactive "*cInsert register: \nP") + (interactive (progn + (barf-if-buffer-read-only) + (register-read-with-preview "Insert register: ") + current-prefix-arg)) (push-mark) (let ((val (get-register register))) (cond @@ -349,7 +405,10 @@ With prefix arg, delete as well. Called from program, takes four args: REGISTER, START, END and DELETE-FLAG. START and END are buffer positions indicating what to copy." - (interactive "cCopy to register: \nr\nP") + (interactive (list (register-read-with-preview "Copy to register: ") + (region-beginning) + (region-end) + current-prefix-arg)) (set-register register (filter-buffer-substring start end)) (setq deactivate-mark t) (cond (delete-flag @@ -362,7 +421,10 @@ With prefix arg, delete as well. Called from program, takes four args: REGISTER, START, END and DELETE-FLAG. START and END are buffer positions indicating what to append." - (interactive "cAppend to register: \nr\nP") + (interactive (list (register-read-with-preview "Append to register: ") + (region-beginning) + (region-end) + current-prefix-arg)) (let ((reg (get-register register)) (text (filter-buffer-substring start end)) (separator (and register-separator (get-register register-separator)))) @@ -381,7 +443,10 @@ With prefix arg, delete as well. Called from program, takes four args: REGISTER, START, END and DELETE-FLAG. START and END are buffer positions indicating what to prepend." - (interactive "cPrepend to register: \nr\nP") + (interactive (list (register-read-with-preview "Prepend to register: ") + (region-beginning) + (region-end) + current-prefix-arg)) (let ((reg (get-register register)) (text (filter-buffer-substring start end)) (separator (and register-separator (get-register register-separator)))) @@ -402,7 +467,11 @@ Called from a program, takes four args: REGISTER, START, END and DELETE-FLAG. START and END are buffer positions giving two corners of rectangle." - (interactive "cCopy rectangle to register: \nr\nP") + (interactive (list (register-read-with-preview + "Copy rectangle to register: ") + (region-beginning) + (region-end) + current-prefix-arg)) (let ((rectangle (if delete-flag (delete-extract-rectangle start end) (extract-rectangle start end)))) @@ -412,6 +481,5 @@ (setq deactivate-mark t) (indicate-copied-region (length (car rectangle)))))) - (provide 'register) ;;; register.el ends here --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 04 09:57:25 2013 Received: (at 15525) by debbugs.gnu.org; 4 Oct 2013 13:57:25 +0000 Received: from localhost ([127.0.0.1]:53942 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VS5si-0000yZ-BO for submit@debbugs.gnu.org; Fri, 04 Oct 2013 09:57:24 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:6622) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VS5sf-0000yQ-29 for 15525@debbugs.gnu.org; Fri, 04 Oct 2013 09:57:22 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFLd/fx/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IPAS-Result: Av4EABK/CFFLd/fx/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="34744742" Received: from 75-119-247-241.dsl.teksavvy.com (HELO pastel.home) ([75.119.247.241]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 04 Oct 2013 09:53:53 -0400 Received: by pastel.home (Postfix, from userid 20848) id 8562C60314; Fri, 4 Oct 2013 09:57:19 -0400 (EDT) From: Stefan Monnier To: Leo Liu Subject: Re: bug#15525: 24.3; register-read-with-preview Message-ID: References: Date: Fri, 04 Oct 2013 09:57:19 -0400 In-Reply-To: (Leo Liu's message of "Fri, 04 Oct 2013 13:57:26 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 15525 Cc: =?windows-1252?Q?=D3scar?= Fuentes , 15525@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > register-read-with-preview pops up a window showing existing registers > and brief description. Any comments? I like the idea of displaying the available choices, but I'm not sure "0.5s delay" is a good enough trigger: it's probably a fine choice for some users, but usually Emacs doesn't like to use such time-dependent behavior too much. Could we offer, additionally to the delay, a different trigger (e.g. help-char and help-event-list)? Stefan PS: How does it compare to register-list? Could they be consolidated? From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 04 12:02:17 2013 Received: (at 15525) by debbugs.gnu.org; 4 Oct 2013 16:02:17 +0000 Received: from localhost ([127.0.0.1]:54148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VS7pY-0005Ax-GB for submit@debbugs.gnu.org; Fri, 04 Oct 2013 12:02:16 -0400 Received: from mail-wi0-f182.google.com ([209.85.212.182]:62481) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VS7pW-0005Ap-MN for 15525@debbugs.gnu.org; Fri, 04 Oct 2013 12:02:15 -0400 Received: by mail-wi0-f182.google.com with SMTP id ez12so1899922wid.15 for <15525@debbugs.gnu.org>; Fri, 04 Oct 2013 09:02:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type; bh=vMtd5WpGOuaTKqp7/zVaYWMQD+guxwHyxLIvu0qCFB8=; b=GOX5fASpW9zxEIFP//FymiT7pq1uvyBqR8gTrGFvqfDvf9Xam2M2AE3GTvbJMHjjdo d1oRtAJHSUbYtQEUBjmA2fTb8lV5Mh3m04DaoXdW9pIwe1Hr0zPaOCC1693/xoYc6X1v RiqlJKWLlrX/ACGOLFnVmH7/WUe8wrG9HzMbEB1bS2i8C6bFaNW9lsRMgs6UENii71JE JnVpYyw0TgB2UdLyPetmj9kUigrduFH51DiUKAeuz/vB0NLoe7+LZ4YmckwGJazJHiJr blCIHteoikW4sxsUBlAUySYM66tpgPWSWnWanOo4zZfI1ImMzbXwILxaSDZzQ610edj3 hWpA== X-Received: by 10.180.10.136 with SMTP id i8mr8144635wib.46.1380902533574; Fri, 04 Oct 2013 09:02:13 -0700 (PDT) Received: from bzg.localdomain (vol75-5-82-226-35-66.fbx.proxad.net. [82.226.35.66]) by mx.google.com with ESMTPSA id i8sm11292581wiy.6.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 04 Oct 2013 09:02:12 -0700 (PDT) Received: by bzg.localdomain (Postfix, from userid 1000) id 21ED71C2159E; Fri, 4 Oct 2013 18:02:10 +0200 (CEST) From: Bastien To: Stefan Monnier Subject: Re: bug#15525: 24.3; register-read-with-preview In-Reply-To: (Stefan Monnier's message of "Fri, 04 Oct 2013 09:57:19 -0400") References: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Date: Fri, 04 Oct 2013 18:02:10 +0200 Message-ID: <87a9ipdny5.fsf@bzg.ath.cx> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 15525 Cc: =?iso-8859-1?Q?=D3scar?= Fuentes , Leo Liu , 15525@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Stefan Monnier writes: > PS: How does it compare to register-list? Could they be > consolidated? I hope so. The Org merge is higher on my todo-list, but working on register-list.el comes right after. -- Bastien From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 04 23:20:33 2013 Received: (at 15525) by debbugs.gnu.org; 5 Oct 2013 03:20:33 +0000 Received: from localhost ([127.0.0.1]:55131 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSIPu-0004MX-BU for submit@debbugs.gnu.org; Fri, 04 Oct 2013 23:20:32 -0400 Received: from mail-pd0-f182.google.com ([209.85.192.182]:34278) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSIPp-0004MM-QI for 15525@debbugs.gnu.org; Fri, 04 Oct 2013 23:20:27 -0400 Received: by mail-pd0-f182.google.com with SMTP id r10so4793110pdi.13 for <15525@debbugs.gnu.org>; Fri, 04 Oct 2013 20:20:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=3bqj4u87P53QLKlvmAPuEC80yqZVV0xNufmCfmFi1YA=; b=jaADv0rnvZ2H4FZe/trIFOFH8P+MXv7em/k5QlWO/eFLh7dZnThgspg5iQUmQszFZM oAPhzi54igR1v4j5bqGYu/t1/6BPDRxOq2Z86GDGd6sPVxNZXP1zO5tH3YKWUNGyOmIK EluelkV9w+sWMsRwUsND6AlbuNNAqeZs/l7aLKWHqiV1kV+56iNcfK6wqEh+345vTOri dJdo3OSP5oOEl81xUe/LPJeZwVY1KsCwBYO+VPNL2VBt8bNp43fjUpkdaWw8CX27zDmC me62h6k7FDMr269QovZ217m8RmiI+nI6Pc3xLT2bzHSismJCmttxgDuWvdmGQXyfenl2 lTQA== X-Received: by 10.68.101.3 with SMTP id fc3mr9853127pbb.107.1380943224854; Fri, 04 Oct 2013 20:20:24 -0700 (PDT) Received: from localhost ([222.131.216.43]) by mx.google.com with ESMTPSA id dk3sm17986810pbc.32.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 04 Oct 2013 20:20:23 -0700 (PDT) From: Leo Liu To: Stefan Monnier Subject: Re: bug#15525: 24.3; register-read-with-preview References: Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAGFBMVEUKDAg1NjRWV1V9fnyg op/DxcLk5uP8/voi63ReAAAACXBIWXMAAAWJAAAFiQFtaJ36AAAAB3RJTUUH1goZAgAz00bgXgAA AeVJREFUKM9lk0Fz2jAQhQXJD3CCO70CmcC1YMtcWyTZ14Bl69xats4N9r6/3zWQBlodNKNPu/s0 b1cCQFuZGpfVVh3vAvBJolIXRkapSuoRUtIdFyo1Y5xSdlAj7OtvD1XnXxmWRi+eWgcxyCed1lVV B1CrKyujMoi+eLA5kU1SsjoHlW+nQjTtFxk4MXgrOxvIqzoTZR8XgPaLl419zgsMaSGFPiUOZCIh thsx5Xy9NsK8Kwf/JoQgMxcVJ301HKkcSWaT0O7FY056J4U9xcYfnmVXG4801lW6lqwu2nKFZoHC HuzvaTVndZ+LaRQgZdthXw1cpynEkLEwyFHXk/aIxNQ6QeooJuzPMB+wn+D7JJNsiCcVA13/A3h/ xE9J+WidpAwoYNmRFwyvSRhNVtsdaAewzZZP5uw82QL9+tyNfocyP0McAzICUr5Mk9RdIjWasUNx aIIt6NK4ZtXIMdfMQt3nuMAyWbLI4DqZ4xPq/ag8jPond4XU/cLuOgw6XCFX/YCUfcDAMMH58fD4 G9kDchwfqVefkBwup2uZM+Q4WhJt5jN3AxXCsaS2yXEDuWgS8VOzW0gFjhEPmLyFMKBFaLb1HRwc DiaKwx0EeTMRYnYPQRW3PP4HApvlMv0PttX5v/D6Aws3IOSEwzmLAAAAAElFTkSuQmCC Date: Sat, 05 Oct 2013 11:19:34 +0800 In-Reply-To: (Stefan Monnier's message of "Fri, 04 Oct 2013 09:57:19 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.5) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 15525 Cc: =?iso-8859-1?Q?=D3scar?= Fuentes , 15525@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) --=-=-= Content-Type: text/plain On 2013-10-04 21:57 +0800, Stefan Monnier wrote: [snipped 3 lines] > I like the idea of displaying the available choices, but I'm not sure > "0.5s delay" is a good enough trigger: it's probably a fine choice for > some users, but usually Emacs doesn't like to use such time-dependent > behavior too much. > > Could we offer, additionally to the delay, a different trigger > (e.g. help-char and help-event-list)? > > > Stefan Good idea. The attached patch implements this. i.e. if one sets register-preview-delay to t it means forever, i.e. the timer is never set. Users can customise register-read-help-char to nil if they don't want any help-char to bring up the preview window. BTW, the delay is so that if you can remember which register to choose within some time (0.5s) you shall never see the preview window. [snipped 10 lines] >> PS: How does it compare to register-list? Could they be >> consolidated? > > I hope so. The Org merge is higher on my todo-list, but working on > register-list.el comes right after. I leave a hook i.e. register-preview-functions for customising how the preview should be presented. I am not sure other ways to have integration with register-list. Comments welcome. Best wishes, Leo --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=reg2.diff Content-Description: reg2.diff === modified file 'lisp/register.el' --- lisp/register.el 2013-08-09 00:30:24 +0000 +++ lisp/register.el 2013-10-05 03:08:31 +0000 @@ -89,6 +89,16 @@ :type '(choice (const :tag "None" nil) (character :tag "Use register" :value ?+))) +(defcustom register-preview-delay 0.5 + "Delay in seconds before popping up the preview window." + :type '(choice number (const :tag "Indefinitely" t)) + :group 'register) + +(defcustom register-read-help-char help-char + "Character to recognize as meaning help." + :type '(choice character (const :tag "Never" nil)) + :group 'register) + (defun get-register (register) "Return contents of Emacs register named REGISTER, or nil if none." (cdr (assq register register-alist))) @@ -102,12 +112,60 @@ (push (cons register value) register-alist)) value)) +(defun register-describe-oneline (c) + (let ((d (replace-regexp-in-string + "\n[ \t]*" " " + (with-output-to-string (describe-register-1 c))))) + (if (string-match "Register.+? contains \\(?:an? \\|the \\)?" d) + (substring d (match-end 0)) + d))) + +(defvar register-preview-functions nil) + +(defun register-preview (buffer) + "Pop up a window to show register preview in BUFFER." + (when (consp register-alist) + (let ((split-height-threshold 0)) + (with-temp-buffer-window + buffer + (cons 'display-buffer-below-selected + '((window-height . fit-window-to-buffer))) + nil + (with-current-buffer standard-output + (setq cursor-in-non-selected-windows nil) + (mapc (lambda (r) + (insert + (format + "%s %s\n" + (concat (single-key-description (car r)) ":") + (or (run-hook-with-args 'register-preview-functions (cdr r)) + (register-describe-oneline (car r)))))) + register-alist)))))) + +(defun register-read-with-preview (prompt) + (let* ((buffer "*Register Preview*") + (timer (when (numberp register-preview-delay) + (run-with-timer register-preview-delay nil + #'register-preview buffer)))) + (unwind-protect + (progn + (while (eq (read-event (propertize prompt 'face 'minibuffer-prompt)) + register-read-help-char) + (unless (get-buffer-window buffer) + (register-preview buffer))) + last-input-event) + (and (timerp timer) (cancel-timer timer)) + (let ((w (get-buffer-window buffer))) + (and (window-live-p w) (delete-window w))) + (and (get-buffer buffer) (kill-buffer buffer))))) + (defun point-to-register (register &optional arg) "Store current location of point in register REGISTER. With prefix argument, store current frame configuration. Use \\[jump-to-register] to go to that location or restore that configuration. Argument is a character, naming the register." - (interactive "cPoint to register: \nP") + (interactive (list (register-read-with-preview "Point to register: ") + current-prefix-arg)) ;; Turn the marker into a file-ref if the buffer is killed. (add-hook 'kill-buffer-hook 'register-swap-out nil t) (set-register register @@ -118,7 +176,9 @@ "Store the window configuration of the selected frame in register REGISTER. Use \\[jump-to-register] to restore the configuration. Argument is a character, naming the register." - (interactive "cWindow configuration to register: \nP") + (interactive (list (register-read-with-preview + "Window configuration to register: ") + current-prefix-arg)) ;; current-window-configuration does not include the value ;; of point in the current buffer, so record that separately. (set-register register (list (current-window-configuration) (point-marker)))) @@ -127,7 +187,9 @@ "Store the window configuration of all frames in register REGISTER. Use \\[jump-to-register] to restore the configuration. Argument is a character, naming the register." - (interactive "cFrame configuration to register: \nP") + (interactive (list (register-read-with-preview + "Frame configuration to register: ") + current-prefix-arg)) ;; current-frame-configuration does not include the value ;; of point in the current buffer, so record that separately. (set-register register (list (current-frame-configuration) (point-marker)))) @@ -143,7 +205,8 @@ Optional second arg non-nil (interactively, prefix argument) says to delete any existing frames that the frameset doesn't mention. \(Otherwise, these frames are iconified.)" - (interactive "cJump to register: \nP") + (interactive (list (register-read-with-preview "Jump to register: ") + current-prefix-arg)) (let ((val (get-register register))) (cond ((registerv-p val) @@ -190,7 +253,8 @@ If NUMBER is nil, a decimal number is read from the buffer starting at point, and point moves to the end of that number. Interactively, NUMBER is the prefix arg (none means nil)." - (interactive "P\ncNumber to register: ") + (interactive (list current-prefix-arg + (register-read-with-preview "Number to register: "))) (set-register register (if number (prefix-numeric-value number) @@ -222,7 +286,7 @@ (defun view-register (register) "Display what is contained in register named REGISTER. The Lisp value REGISTER is a character." - (interactive "cView register: ") + (interactive (list (register-read-with-preview "View register: "))) (let ((val (get-register register))) (if (null val) (message "Register %s is empty" (single-key-description register)) @@ -323,7 +387,10 @@ Normally puts point before and mark after the inserted text. If optional second arg is non-nil, puts mark before and point after. Interactively, second arg is non-nil if prefix arg is supplied." - (interactive "*cInsert register: \nP") + (interactive (progn + (barf-if-buffer-read-only) + (register-read-with-preview "Insert register: ") + current-prefix-arg)) (push-mark) (let ((val (get-register register))) (cond @@ -349,7 +416,10 @@ With prefix arg, delete as well. Called from program, takes four args: REGISTER, START, END and DELETE-FLAG. START and END are buffer positions indicating what to copy." - (interactive "cCopy to register: \nr\nP") + (interactive (list (register-read-with-preview "Copy to register: ") + (region-beginning) + (region-end) + current-prefix-arg)) (set-register register (filter-buffer-substring start end)) (setq deactivate-mark t) (cond (delete-flag @@ -362,7 +432,10 @@ With prefix arg, delete as well. Called from program, takes four args: REGISTER, START, END and DELETE-FLAG. START and END are buffer positions indicating what to append." - (interactive "cAppend to register: \nr\nP") + (interactive (list (register-read-with-preview "Append to register: ") + (region-beginning) + (region-end) + current-prefix-arg)) (let ((reg (get-register register)) (text (filter-buffer-substring start end)) (separator (and register-separator (get-register register-separator)))) @@ -381,7 +454,10 @@ With prefix arg, delete as well. Called from program, takes four args: REGISTER, START, END and DELETE-FLAG. START and END are buffer positions indicating what to prepend." - (interactive "cPrepend to register: \nr\nP") + (interactive (list (register-read-with-preview "Prepend to register: ") + (region-beginning) + (region-end) + current-prefix-arg)) (let ((reg (get-register register)) (text (filter-buffer-substring start end)) (separator (and register-separator (get-register register-separator)))) @@ -402,7 +478,11 @@ Called from a program, takes four args: REGISTER, START, END and DELETE-FLAG. START and END are buffer positions giving two corners of rectangle." - (interactive "cCopy rectangle to register: \nr\nP") + (interactive (list (register-read-with-preview + "Copy rectangle to register: ") + (region-beginning) + (region-end) + current-prefix-arg)) (let ((rectangle (if delete-flag (delete-extract-rectangle start end) (extract-rectangle start end)))) @@ -412,6 +492,5 @@ (setq deactivate-mark t) (indicate-copied-region (length (car rectangle)))))) - (provide 'register) ;;; register.el ends here --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 05 12:30:17 2013 Received: (at 15525) by debbugs.gnu.org; 5 Oct 2013 16:30:17 +0000 Received: from localhost ([127.0.0.1]:56194 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSUkC-0007TU-HU for submit@debbugs.gnu.org; Sat, 05 Oct 2013 12:30:16 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:13956) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSUk8-0007TJ-Co for 15525@debbugs.gnu.org; Sat, 05 Oct 2013 12:30:13 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFMCoYf/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IPAS-Result: Av4EABK/CFFMCoYf/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="34827208" Received: from 76-10-134-31.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([76.10.134.31]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 05 Oct 2013 12:26:40 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 51ECEAE21D; Sat, 5 Oct 2013 12:30:10 -0400 (EDT) From: Stefan Monnier To: Leo Liu Subject: Re: bug#15525: 24.3; register-read-with-preview Message-ID: References: Date: Sat, 05 Oct 2013 12:30:10 -0400 In-Reply-To: (Leo Liu's message of "Sat, 05 Oct 2013 11:19:34 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 15525 Cc: =?windows-1252?Q?=D3scar?= Fuentes , 15525@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > Good idea. The attached patch implements this. i.e. if one sets > register-preview-delay to t it means forever, Good (I'd have used nil rather than t, but it doesn't matter). I wonder if the default shouldn't be "infinite delay", so as to preserve existing behavior? > Users can customise register-read-help-char to nil if they don't want > any help-char to bring up the preview window. I think the only valid reason to disable the help-char here is if it prevents access to an existing register. So we can get rid of this custom var and instead make sure we only obey help-char if there is no existing register by that name. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sat Oct 05 22:01:15 2013 Received: (at 15525) by debbugs.gnu.org; 6 Oct 2013 02:01:15 +0000 Received: from localhost ([127.0.0.1]:56916 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSdej-0004DJ-HK for submit@debbugs.gnu.org; Sat, 05 Oct 2013 22:01:14 -0400 Received: from mail-pd0-f171.google.com ([209.85.192.171]:47618) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSdef-0004D8-Ih for 15525@debbugs.gnu.org; Sat, 05 Oct 2013 22:01:10 -0400 Received: by mail-pd0-f171.google.com with SMTP id g10so5601597pdj.30 for <15525@debbugs.gnu.org>; Sat, 05 Oct 2013 19:01:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=4acWHe9DnMwgEGe8vAIcqCib8PCtuJSeGXMNPNDQq50=; b=JQ9HYfCFtgdQbSqVkxtrGUF97822TFe88mgbirampUewtYvTQUeYlPzlTFyZbPLLfH utfhJLToKhaZLmy94X/DQhPgiUs/1xlMhxSB9E4JXnz0CmQIjDGO91f6OCv8BmK6M1z4 MYchpP5+84Jd5pM7amFuXlUyjh58eUdMt8f+U+WnEp5Ligne3FAbtyy55jI7B1f0oLH5 S2fRYzKnu+eQ7iMgtd+qUJE2VVB34ucXnLHlCFNMQg1+AAkjSy+A8XexBeQ3URN00gBp Mw+wTteCzIx/L0BP053BVkWO6Qznjij80tl8+agu5rPL7pO/6e/szqB8BKAU+46I/GbY bONQ== X-Received: by 10.68.255.229 with SMTP id at5mr706952pbd.130.1381024868217; Sat, 05 Oct 2013 19:01:08 -0700 (PDT) Received: from localhost ([123.123.199.153]) by mx.google.com with ESMTPSA id 7sm28734884paf.22.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 05 Oct 2013 19:01:07 -0700 (PDT) From: Leo Liu To: Stefan Monnier Subject: Re: bug#15525: 24.3; register-read-with-preview References: Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAG1BMVEUAAAA9Cgm3Hx1WWFWA gn+WmJWsrqv4+vcCAwCRl2MkAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAYoA AAGKATOXMFgAAAAHdElNRQfXAQwDNR+ZJmElAAABIklEQVQoz22SPW+DQAyGWUq65qasd9PNUSX4 AZHK2C1rJy5jpDS4IwRVup9dn7GNafpKIPPgzztXFSujqq1eM2n8h22oMkvxI/i9C97kRfMRUN55 dS3BrsAwBXUtMLAO4lryh8kTjOxKpQNniNxAgZOEe4bZwsDTFhKdqZRLNII4OQNHhEuq/RMkm6Cj TnnEA/fk0BorcYn5qA3oaeAxbaBOLrX+9G48NZ2Fzc2tzDM8Q+tMypEOqYHh8mAWaaK3U/cDMOT5 aMZMABgPXc7zPMs1A8DXO756GFJ/4fMEq47hTsAdn5avoxZ4ywl0c2w4Flu2Ybeyb3S+EqxX2DYA H8veJGEDTnHnrXvRaPyt+2kSfK6rfBZ2tUtfP/mR+pR6sX8BUZ/cDV7tvkoAAAAASUVORK5CYII= Date: Sun, 06 Oct 2013 10:01:05 +0800 In-Reply-To: (Stefan Monnier's message of "Sat, 05 Oct 2013 12:30:10 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.5) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 15525 Cc: =?iso-8859-1?Q?=D3scar?= Fuentes , Bastien , 15525@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) --=-=-= Content-Type: text/plain On 2013-10-06 00:30 +0800, Stefan Monnier wrote: > Good (I'd have used nil rather than t, but it doesn't matter). Done. > I wonder if the default shouldn't be "infinite delay", so as to preserve > existing behavior? Done. (If it is OK I like to turn it on for a month or two for some testing and then turn it off eventually) > I think the only valid reason to disable the help-char here is if it > prevents access to an existing register. So we can get rid of this > custom var and instead make sure we only obey help-char if there is no > existing register by that name. The trouble is when you create new registers. But I remove that custom variable anyway since it won't be used much. It is unlikely C-h be used as a register. If no one objects I would like to install the attached patch. Thanks, Leo --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=reg3.diff Content-Description: reg3.diff === modified file 'lisp/register.el' --- lisp/register.el 2013-08-09 00:30:24 +0000 +++ lisp/register.el 2013-10-06 01:56:29 +0000 @@ -1,4 +1,4 @@ -;;; register.el --- register commands for Emacs +;;; register.el --- register commands for Emacs -*- lexical-binding: t; -*- ;; Copyright (C) 1985, 1993-1994, 2001-2013 Free Software Foundation, ;; Inc. @@ -89,6 +89,11 @@ :type '(choice (const :tag "None" nil) (character :tag "Use register" :value ?+))) +(defcustom register-preview-delay nil + "If non-nil delay in seconds to pop up the preview window." + :type '(choice number (const :tag "Indefinitely" nil)) + :group 'register) + (defun get-register (register) "Return contents of Emacs register named REGISTER, or nil if none." (cdr (assq register register-alist))) @@ -102,12 +107,66 @@ (push (cons register value) register-alist)) value)) +(defun register-describe-oneline (c) + "One-line description of register C." + (let ((d (replace-regexp-in-string + "\n[ \t]*" " " + (with-output-to-string (describe-register-1 c))))) + (if (string-match "Register.+? contains \\(?:an? \\|the \\)?" d) + (substring d (match-end 0)) + d))) + +(defvar register-preview-functions nil) + +(defun register-preview (buffer) + "Pop up a window to show register preview in BUFFER." + (when (consp register-alist) + (let ((split-height-threshold 0)) + (with-temp-buffer-window + buffer + (cons 'display-buffer-below-selected + '((window-height . fit-window-to-buffer))) + nil + (with-current-buffer standard-output + (setq cursor-in-non-selected-windows nil) + (mapc + (lambda (r) + (insert (or (run-hook-with-args-until-success + 'register-preview-functions r) + (format "%s %s\n" + (concat (single-key-description (car r)) ":") + (register-describe-oneline (car r)))))) + register-alist)))))) + +(defun register-read-with-preview (prompt) + "Read an event with register preview using PROMPT. +Pop up a register preview window if the input is help-char but is +not a register. Alternatively if `register-preview-delay' is a +number the preview window is popped up after some delay." + (let* ((buffer "*Register Preview*") + (timer (when (numberp register-preview-delay) + (run-with-timer register-preview-delay nil + #'register-preview buffer))) + (help-char (and (not (get-register help-char)) help-char))) + (unwind-protect + (progn + (while (eq (read-event (propertize prompt 'face 'minibuffer-prompt)) + help-char) + (unless (get-buffer-window buffer) + (register-preview buffer))) + last-input-event) + (and (timerp timer) (cancel-timer timer)) + (let ((w (get-buffer-window buffer))) + (and (window-live-p w) (delete-window w))) + (and (get-buffer buffer) (kill-buffer buffer))))) + (defun point-to-register (register &optional arg) "Store current location of point in register REGISTER. With prefix argument, store current frame configuration. Use \\[jump-to-register] to go to that location or restore that configuration. Argument is a character, naming the register." - (interactive "cPoint to register: \nP") + (interactive (list (register-read-with-preview "Point to register: ") + current-prefix-arg)) ;; Turn the marker into a file-ref if the buffer is killed. (add-hook 'kill-buffer-hook 'register-swap-out nil t) (set-register register @@ -118,7 +177,9 @@ "Store the window configuration of the selected frame in register REGISTER. Use \\[jump-to-register] to restore the configuration. Argument is a character, naming the register." - (interactive "cWindow configuration to register: \nP") + (interactive (list (register-read-with-preview + "Window configuration to register: ") + current-prefix-arg)) ;; current-window-configuration does not include the value ;; of point in the current buffer, so record that separately. (set-register register (list (current-window-configuration) (point-marker)))) @@ -127,7 +188,9 @@ "Store the window configuration of all frames in register REGISTER. Use \\[jump-to-register] to restore the configuration. Argument is a character, naming the register." - (interactive "cFrame configuration to register: \nP") + (interactive (list (register-read-with-preview + "Frame configuration to register: ") + current-prefix-arg)) ;; current-frame-configuration does not include the value ;; of point in the current buffer, so record that separately. (set-register register (list (current-frame-configuration) (point-marker)))) @@ -143,7 +206,8 @@ Optional second arg non-nil (interactively, prefix argument) says to delete any existing frames that the frameset doesn't mention. \(Otherwise, these frames are iconified.)" - (interactive "cJump to register: \nP") + (interactive (list (register-read-with-preview "Jump to register: ") + current-prefix-arg)) (let ((val (get-register register))) (cond ((registerv-p val) @@ -190,7 +254,8 @@ If NUMBER is nil, a decimal number is read from the buffer starting at point, and point moves to the end of that number. Interactively, NUMBER is the prefix arg (none means nil)." - (interactive "P\ncNumber to register: ") + (interactive (list current-prefix-arg + (register-read-with-preview "Number to register: "))) (set-register register (if number (prefix-numeric-value number) @@ -222,7 +287,7 @@ (defun view-register (register) "Display what is contained in register named REGISTER. The Lisp value REGISTER is a character." - (interactive "cView register: ") + (interactive (list (register-read-with-preview "View register: "))) (let ((val (get-register register))) (if (null val) (message "Register %s is empty" (single-key-description register)) @@ -323,7 +388,10 @@ Normally puts point before and mark after the inserted text. If optional second arg is non-nil, puts mark before and point after. Interactively, second arg is non-nil if prefix arg is supplied." - (interactive "*cInsert register: \nP") + (interactive (progn + (barf-if-buffer-read-only) + (register-read-with-preview "Insert register: ") + current-prefix-arg)) (push-mark) (let ((val (get-register register))) (cond @@ -349,7 +417,10 @@ With prefix arg, delete as well. Called from program, takes four args: REGISTER, START, END and DELETE-FLAG. START and END are buffer positions indicating what to copy." - (interactive "cCopy to register: \nr\nP") + (interactive (list (register-read-with-preview "Copy to register: ") + (region-beginning) + (region-end) + current-prefix-arg)) (set-register register (filter-buffer-substring start end)) (setq deactivate-mark t) (cond (delete-flag @@ -362,7 +433,10 @@ With prefix arg, delete as well. Called from program, takes four args: REGISTER, START, END and DELETE-FLAG. START and END are buffer positions indicating what to append." - (interactive "cAppend to register: \nr\nP") + (interactive (list (register-read-with-preview "Append to register: ") + (region-beginning) + (region-end) + current-prefix-arg)) (let ((reg (get-register register)) (text (filter-buffer-substring start end)) (separator (and register-separator (get-register register-separator)))) @@ -381,7 +455,10 @@ With prefix arg, delete as well. Called from program, takes four args: REGISTER, START, END and DELETE-FLAG. START and END are buffer positions indicating what to prepend." - (interactive "cPrepend to register: \nr\nP") + (interactive (list (register-read-with-preview "Prepend to register: ") + (region-beginning) + (region-end) + current-prefix-arg)) (let ((reg (get-register register)) (text (filter-buffer-substring start end)) (separator (and register-separator (get-register register-separator)))) @@ -402,7 +479,11 @@ Called from a program, takes four args: REGISTER, START, END and DELETE-FLAG. START and END are buffer positions giving two corners of rectangle." - (interactive "cCopy rectangle to register: \nr\nP") + (interactive (list (register-read-with-preview + "Copy rectangle to register: ") + (region-beginning) + (region-end) + current-prefix-arg)) (let ((rectangle (if delete-flag (delete-extract-rectangle start end) (extract-rectangle start end)))) @@ -412,6 +493,5 @@ (setq deactivate-mark t) (indicate-copied-region (length (car rectangle)))))) - (provide 'register) ;;; register.el ends here --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 06 12:59:49 2013 Received: (at 15525) by debbugs.gnu.org; 6 Oct 2013 16:59:50 +0000 Received: from localhost ([127.0.0.1]:57866 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSrgL-0001om-Ap for submit@debbugs.gnu.org; Sun, 06 Oct 2013 12:59:49 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:30238) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSrgJ-0001oe-I3 for 15525@debbugs.gnu.org; Sun, 06 Oct 2013 12:59:48 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFHO+K8t/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IPAS-Result: Av4EABK/CFHO+K8t/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLDiYSFBgNJIgeBsEtkQoDpHqBXoMT X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="34873413" Received: from 206-248-175-45.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([206.248.175.45]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 06 Oct 2013 12:56:11 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id CBB54AE4CB; Sun, 6 Oct 2013 12:59:41 -0400 (EDT) From: Stefan Monnier To: Leo Liu Subject: Re: bug#15525: 24.3; register-read-with-preview Message-ID: References: Date: Sun, 06 Oct 2013 12:59:41 -0400 In-Reply-To: (Leo Liu's message of "Sun, 06 Oct 2013 10:01:05 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 15525 Cc: =?windows-1252?Q?=D3scar?= Fuentes , Bastien , 15525@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) >> I wonder if the default shouldn't be "infinite delay", so as to preserve >> existing behavior? > Done. (If it is OK I like to turn it on for a month or two for some > testing and then turn it off eventually) I'm OK with enabling it tentatively, and see if people complain. You might like to use a slightly longer delay, tho. For me, 0.5s makes it pop up the list pretty much all the time (I guess I'm slow). >> I think the only valid reason to disable the help-char here is if it >> prevents access to an existing register. So we can get rid of this >> custom var and instead make sure we only obey help-char if there is no >> existing register by that name. > The trouble is when you create new registers. The code should not let you create new registers that match help-char. > But I remove that custom variable anyway since it won't be used > much. It is unlikely C-h be used as a register. BTW, we could/should also accept help-event-list events. > If no one objects I would like to install the attached patch. Go ahead, Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 06 22:35:29 2013 Received: (at 15525) by debbugs.gnu.org; 7 Oct 2013 02:35:29 +0000 Received: from localhost ([127.0.0.1]:58764 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VT0fM-0005l2-D4 for submit@debbugs.gnu.org; Sun, 06 Oct 2013 22:35:29 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:51381) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VT0fC-0005k2-2M for 15525@debbugs.gnu.org; Sun, 06 Oct 2013 22:35:19 -0400 Received: by mail-pa0-f47.google.com with SMTP id kp14so6684286pab.34 for <15525@debbugs.gnu.org>; Sun, 06 Oct 2013 19:35:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:face:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=PIZJeI5uy0Oj1hUixjv5h1KkTtrXzW6f8R8cCP1QnkI=; b=NqmiMYho5t77YTFZULItEyPefiW/kKJgTBJvapRSs7EmgUJpwwdvmFzngimYah+8X8 vvex9XJqAe3LCg0navYNyEjASLP2JEbp/WU+IJ4R4qEA5rrPMEs+x9xq7j2qKfdzNPmY lDiBarCsGLe8YhLuhQKI+duQ+dlKKxawYgF/YjXBJGtNeOeH/i/TqD3p21ypTY6rmcXE +8VkKPhJ2RACZfw4B0UF+1bWjWoOw2qbBL8HI3Yp064WStcFz83y2NZV6bYoat2o1bkT yuFu5AFyKhmSWS3bi9fbrJIkknXN19d3oTSxZIc7irdIXaFX7cpTRDpG03KO3NutgchO pClA== X-Received: by 10.66.216.234 with SMTP id ot10mr29750873pac.122.1381113313246; Sun, 06 Oct 2013 19:35:13 -0700 (PDT) Received: from localhost ([111.195.94.232]) by mx.google.com with ESMTPSA id qf7sm35616714pac.14.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 06 Oct 2013 19:35:12 -0700 (PDT) From: Leo Liu To: Stefan Monnier Subject: Re: bug#15525: 24.3; register-read-with-preview References: Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAG1BMVEUAAAA9Cgm3Hx1WWFWA gn+WmJWsrqv4+vcCAwCRl2MkAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAAAYoA AAGKATOXMFgAAAAHdElNRQfXAQwDNR+ZJmElAAABIklEQVQoz22SPW+DQAyGWUq65qasd9PNUSX4 AZHK2C1rJy5jpDS4IwRVup9dn7GNafpKIPPgzztXFSujqq1eM2n8h22oMkvxI/i9C97kRfMRUN55 dS3BrsAwBXUtMLAO4lryh8kTjOxKpQNniNxAgZOEe4bZwsDTFhKdqZRLNII4OQNHhEuq/RMkm6Cj TnnEA/fk0BorcYn5qA3oaeAxbaBOLrX+9G48NZ2Fzc2tzDM8Q+tMypEOqYHh8mAWaaK3U/cDMOT5 aMZMABgPXc7zPMs1A8DXO756GFJ/4fMEq47hTsAdn5avoxZ4ywl0c2w4Flu2Ybeyb3S+EqxX2DYA H8veJGEDTnHnrXvRaPyt+2kSfK6rfBZ2tUtfP/mR+pR6sX8BUZ/cDV7tvkoAAAAASUVORK5CYII= Date: Mon, 07 Oct 2013 10:35:16 +0800 In-Reply-To: (Stefan Monnier's message of "Sun, 06 Oct 2013 12:59:41 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.5) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 15525 Cc: =?iso-8859-1?Q?=D3scar?= Fuentes , Bastien , 15525@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 2013-10-07 00:59 +0800, Stefan Monnier wrote: > I'm OK with enabling it tentatively, and see if people complain. > You might like to use a slightly longer delay, tho. For me, 0.5s makes > it pop up the list pretty much all the time (I guess I'm slow). I have set it to 1s for now and will set it to nil after 60 days. [snipped 5 lines] > The code should not let you create new registers that match help-char. > BTW, we could/should also accept help-event-list events. OK, though ? is in help-event-list. > Go ahead, Installed. Leo From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 07 00:13:50 2013 Received: (at 15525) by debbugs.gnu.org; 7 Oct 2013 04:13:50 +0000 Received: from localhost ([127.0.0.1]:58900 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VT2Cb-0001It-M1 for submit@debbugs.gnu.org; Mon, 07 Oct 2013 00:13:49 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:32830) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VT2CZ-0001Il-Dj for 15525@debbugs.gnu.org; Mon, 07 Oct 2013 00:13:47 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFHO+K8t/2dsb2JhbABEvw4Xc4IeAQEEAVYjEAsOJhIUGA0kiB4GwS2RCgOkeoFegxM X-IPAS-Result: Av4EABK/CFHO+K8t/2dsb2JhbABEvw4Xc4IeAQEEAVYjEAsOJhIUGA0kiB4GwS2RCgOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="34902764" Received: from 206-248-175-45.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([206.248.175.45]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 07 Oct 2013 00:10:10 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 40F0AAE4CB; Mon, 7 Oct 2013 00:13:46 -0400 (EDT) From: Stefan Monnier To: Leo Liu Subject: Re: bug#15525: 24.3; register-read-with-preview Message-ID: References: Date: Mon, 07 Oct 2013 00:13:46 -0400 In-Reply-To: (Leo Liu's message of "Mon, 07 Oct 2013 10:35:16 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 15525 Cc: =?windows-1252?Q?=D3scar?= Fuentes , Bastien , 15525@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) >> I'm OK with enabling it tentatively, and see if people complain. >> You might like to use a slightly longer delay, tho. For me, 0.5s makes >> it pop up the list pretty much all the time (I guess I'm slow). > I have set it to 1s for now and will set it to nil after 60 days. Not sure why you'd want to set it back to nil if noone complains. >> The code should not let you create new registers that match help-char. >> BTW, we could/should also accept help-event-list events. > OK, though ? is in help-event-list. I know, and I think it's an important trigger key since it's the one used in completion (i.e. it's the one I'd try instinctively). Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 07 02:16:37 2013 Received: (at control) by debbugs.gnu.org; 7 Oct 2013 06:16:37 +0000 Received: from localhost ([127.0.0.1]:59065 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VT47Q-0004Qz-QJ for submit@debbugs.gnu.org; Mon, 07 Oct 2013 02:16:37 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:58347) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VT47O-0004Qq-H7 for control@debbugs.gnu.org; Mon, 07 Oct 2013 02:16:35 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1VT47O-0007jx-0t for control@debbugs.gnu.org; Mon, 07 Oct 2013 02:16:34 -0400 Date: Mon, 07 Oct 2013 02:16:34 -0400 Message-Id: Subject: control message for bug 15525 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) close 15525 24.4 From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 10 08:57:01 2013 Received: (at 15525-done) by debbugs.gnu.org; 10 Oct 2013 12:57:01 +0000 Received: from localhost ([127.0.0.1]:40037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VUFnY-0004lf-Tc for submit@debbugs.gnu.org; Thu, 10 Oct 2013 08:57:01 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:63178) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VUFnW-0004lR-9K for 15525-done@debbugs.gnu.org; Thu, 10 Oct 2013 08:56:58 -0400 Received: by mail-pa0-f51.google.com with SMTP id kp14so2692215pab.10 for <15525-done@debbugs.gnu.org>; Thu, 10 Oct 2013 05:56:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:face:reply-to:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=KxaGOnTQN37XqYnDG2mz9qsaFkusxUgzmQ9x1JwPo4E=; b=G2ZvERn2DPueUjSzBiR5bTuL9uvZk9DWtrCj9e9eVmPqa8ykGJqHtMgQfNwdHBoNRL tP/AKStEbpPA+s8gz1HTycTK8DwTlqs15NJyy5vKQjv0p+CEousV7auasIWrmLIsfxA6 auSZrGCC1897PKBzX/9SbClc7zzDEB003KlZkLWYw/PlK1/UXj8/uEGRkhl3WatZjV70 R57j7AJenRXxZq40qCFtlWDw86g6dTXTU7t/8Ez8DCyGOXPkUgKNKG7MuKTvT/TDjqFl baZ4jfp51X+3ZyGNPHrFrM1GTqEHf35OKHSKXiG4OmxCaTNIycrQjOXQLvlo+hHKP3Bw rs+g== X-Received: by 10.66.231.42 with SMTP id td10mr15115289pac.144.1381409817206; Thu, 10 Oct 2013 05:56:57 -0700 (PDT) Received: from localhost ([124.64.87.249]) by mx.google.com with ESMTPSA id iu7sm53025060pbc.45.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 10 Oct 2013 05:56:56 -0700 (PDT) From: Leo Liu To: Stefan Monnier Subject: Re: bug#15525: 24.3; register-read-with-preview References: Face: iVBORw0KGgoAAAANSUhEUgAAACgAAAAoBAMAAAB+0KVeAAAAGFBMVEUKDAg1NjRWV1V9fnyg op/DxcLk5uP8/voi63ReAAAACXBIWXMAAAWJAAAFiQFtaJ36AAAAB3RJTUUH1goZAgAz00bgXgAA AeVJREFUKM9lk0Fz2jAQhQXJD3CCO70CmcC1YMtcWyTZ14Bl69xats4N9r6/3zWQBlodNKNPu/s0 b1cCQFuZGpfVVh3vAvBJolIXRkapSuoRUtIdFyo1Y5xSdlAj7OtvD1XnXxmWRi+eWgcxyCed1lVV B1CrKyujMoi+eLA5kU1SsjoHlW+nQjTtFxk4MXgrOxvIqzoTZR8XgPaLl419zgsMaSGFPiUOZCIh thsx5Xy9NsK8Kwf/JoQgMxcVJ301HKkcSWaT0O7FY056J4U9xcYfnmVXG4801lW6lqwu2nKFZoHC HuzvaTVndZ+LaRQgZdthXw1cpynEkLEwyFHXk/aIxNQ6QeooJuzPMB+wn+D7JJNsiCcVA13/A3h/ xE9J+WidpAwoYNmRFwyvSRhNVtsdaAewzZZP5uw82QL9+tyNfocyP0McAzICUr5Mk9RdIjWasUNx aIIt6NK4ZtXIMdfMQt3nuMAyWbLI4DqZ4xPq/ag8jPond4XU/cLuOgw6XCFX/YCUfcDAMMH58fD4 G9kDchwfqVefkBwup2uZM+Q4WhJt5jN3AxXCsaS2yXEDuWgS8VOzW0gFjhEPmLyFMKBFaLb1HRwc DiaKwx0EeTMRYnYPQRW3PP4HApvlMv0PttX5v/D6Aws3IOSEwzmLAAAAAElFTkSuQmCC Date: Thu, 10 Oct 2013 20:56:44 +0800 In-Reply-To: (Stefan Monnier's message of "Mon, 07 Oct 2013 00:13:46 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (OS X 10.8.5) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 15525-done Cc: 15525-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: 15525@debbugs.gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Fixed in 24.4 On 2013-10-07 12:13 +0800, Stefan Monnier wrote: > Not sure why you'd want to set it back to nil if noone complains. OK, I'll DTRT. >> OK, though ? is in help-event-list. > > I know, and I think it's an important trigger key since it's the one > used in completion (i.e. it's the one I'd try instinctively). OK. Leo From unknown Tue Jun 24 19:09:29 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 08 Nov 2013 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator