From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Uwe Brauer Newsgroups: gmane.emacs.devel Subject: feature proposal: occur-read-primary-args: (from Xemacs) Date: Sun, 27 Dec 2015 16:42:19 +0000 Message-ID: <87lh8fkfmc.fsf@mat.ucm.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1451234630 5229 80.91.229.3 (27 Dec 2015 16:43:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 27 Dec 2015 16:43:50 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 27 17:43:42 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aDEQ2-0001Gq-5g for ged-emacs-devel@m.gmane.org; Sun, 27 Dec 2015 17:43:42 +0100 Original-Received: from localhost ([::1]:42071 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDEQ1-0007fQ-Lw for ged-emacs-devel@m.gmane.org; Sun, 27 Dec 2015 11:43:41 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48688) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDEOv-0006Gv-Mi for emacs-devel@gnu.org; Sun, 27 Dec 2015 11:42:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aDEOq-0006Vv-FR for emacs-devel@gnu.org; Sun, 27 Dec 2015 11:42:33 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:39433) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDEOq-0006Vq-0d for emacs-devel@gnu.org; Sun, 27 Dec 2015 11:42:28 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aDEOn-0008Gn-U8 for emacs-devel@gnu.org; Sun, 27 Dec 2015 17:42:26 +0100 Original-Received: from 2.161.85.253 ([2.161.85.253]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 27 Dec 2015 17:42:25 +0100 Original-Received: from oub by 2.161.85.253 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 27 Dec 2015 17:42:25 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Original-Lines: 70 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 2.161.85.253 Mail-Copies-To: never User-Agent: Gnus/5.13001 (Ma Gnus v0.10) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:ylOrIXiBbzgNIlLRm/Aw//iWs6Q= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:196979 Archived-At: hello Coming form Xemacs, there is one feature I miss. In Xemacs when I use occur, the minibuffers offer me the word (symbol) the cursor is on. Now looking at the code, I found out that there is *no* difference in the definition of occur. (defun occur (regexp &optional nlines) (interactive (occur-read-primary-args)) (occur-1 regexp nlines (list (current-buffer)))) But in the function (occur-read-primary-args) Which is defined for Xemacs as follows: (defun occur-read-primary-args () (list (let* ((default (or (symbol-near-point) (and regexp-history (car regexp-history)))) (minibuffer-history-minimum-string-length 0) (input (if default ;; XEmacs: rewritten for I18N3 snarfing (read-from-minibuffer (format "List lines matching regexp (default `%s'): " default) nil nil nil 'regexp-history nil default) (read-from-minibuffer "List lines matching regexp: " nil nil nil 'regexp-history)))) (if (equal input "") default input)) (when current-prefix-arg (prefix-numeric-value current-prefix-arg)))) The essential point seems to be the let* which defines default, which needs the function symbol-near-point which in turn is given: (defun symbol-near-point () "Return the first textual item to the nearest point." (interactive) ;alg stolen from etag.el (save-excursion (if (or (bobp) (not (memq (char-syntax (char-before)) '(?w ?_)))) (while (not (looking-at "\\sw\\|\\s_\\|\\'")) (forward-char 1))) (while (looking-at "\\sw\\|\\s_") (forward-char 1)) (if (re-search-backward "\\sw\\|\\s_" nil t) (regexp-quote (progn (forward-char 1) (buffer-substring (point) (progn (forward-sexp -1) (while (looking-at "\\s'") (forward-char 1)) (point))))) nil))) So the question boils down to this, could this feature be implemented in GNU emacs, either by directly using symbol-near-point or a different implementation? Thanks Uwe Brauer