From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: Key binding M-g should really be goto-line autolearn=noversion=3.0.2 autolearn=no version=3.0.2 Date: Thu, 3 Mar 2005 14:24:41 -0800 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1109893547 30379 80.91.229.2 (3 Mar 2005 23:45:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 3 Mar 2005 23:45:47 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 04 00:45:47 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D6zzq-0008Qa-AO for ged-emacs-devel@m.gmane.org; Fri, 04 Mar 2005 00:44:48 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D70It-00053p-K3 for ged-emacs-devel@m.gmane.org; Thu, 03 Mar 2005 19:04:27 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D70EH-0002uI-Jv for emacs-devel@gnu.org; Thu, 03 Mar 2005 18:59:41 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D70EG-0002tZ-A7 for emacs-devel@gnu.org; Thu, 03 Mar 2005 18:59:40 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D70CF-0001sy-K7 for emacs-devel@gnu.org; Thu, 03 Mar 2005 18:57:35 -0500 Original-Received: from [141.146.126.228] (helo=agminet01.oracle.com) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1D6zos-0005HO-DE for emacs-devel@gnu.org; Thu, 03 Mar 2005 18:33:26 -0500 Original-Received: from agminet01.oracle.com (localhost [127.0.0.1]) by agminet01.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id j23NWMI7013284 for ; Thu, 3 Mar 2005 15:32:23 -0800 Original-Received: from rgmsgw301.us.oracle.com (rgmsgw301.us.oracle.com [138.1.191.50]) by agminet01.oracle.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id j23NK21N000691 for ; Thu, 3 Mar 2005 15:28:48 -0800 Original-Received: from rgmsgw301.us.oracle.com (localhost [127.0.0.1]) by rgmsgw301.us.oracle.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id j23MOh3L015410 for ; Thu, 3 Mar 2005 15:24:43 -0700 Original-Received: from dradamslap (dradams-lap.us.oracle.com [130.35.177.126]) by rgmsgw301.us.oracle.com (Switch-3.1.4/Switch-3.1.0) with SMTP id j23MOg2J015402 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Thu, 3 Mar 2005 15:24:42 -0700 Original-To: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-Whitelist: TRUE X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org X-MailScanner-To: ged-emacs-devel@m.gmane.org Xref: main.gmane.org gmane.emacs.devel:34155 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:34155 > What I suggested was a simple command to pick up a numeral > from any buffer, > regardless of what the numeral might mean in that buffer. It would be > rudimentary, but would do at least what people are doing with > `goto-line', > without requiring them to key in the line number. Is this what you have in mind? (defun goto-line-at-point (&optional buffer) "Go to the line whose number is given at point, counting like \ \\[goto-line]. With a prefix arg, prompt for a BUFFER and select it before moving." (interactive (list (if current-prefix-arg (read-buffer "Goto buffer: " (other-buffer (current-buffer) t) t)))) (when buffer (pop-to-buffer buffer)) (goto-line (number-at-point))) I was thinking more like the following. You don't want to have to input the buffer each time (even hitting RET to get the default). And it's unlikely that you would want to go to a line in the same buffer in which the line number appears. (defun goto-line-at-point (buffer) "In another buffer, go to the line whose number is at point. With prefix argument, you are prompted for the buffer. Without it, `other-buffer' is used." (interactive (list (if current-prefix-arg (read-buffer "Buffer: " (other-buffer (current-buffer) t) t) (other-buffer (current-buffer) t)))) (let ((lineno (or (number-at-point) (error "No number near cursor")))) (unless (wholenump lineno) (setq lineno (abs (truncate lineno)))) (message "Line %s in buffer `%s'" lineno buffer) (pop-to-buffer buffer) (goto-line lineno))) If so, maybe a mouse- version would be useful, too. Yes, that's what I was suggesting. I don't have a need for such commands, but it sounded like they might be useful for the use case cited.