From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Everton J. Carpes" Newsgroups: gmane.emacs.help Subject: Command line open does not use find-file anymore? Date: Mon, 18 Sep 2017 06:00:16 -0300 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1505748755 18265 195.159.176.226 (18 Sep 2017 15:32:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 18 Sep 2017 15:32:35 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 18 17:32:28 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dty25-0004MO-Qn for geh-help-gnu-emacs@m.gmane.org; Mon, 18 Sep 2017 17:32:25 +0200 Original-Received: from localhost ([::1]:37258 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dty2D-0006fg-8V for geh-help-gnu-emacs@m.gmane.org; Mon, 18 Sep 2017 11:32:33 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46958) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dtruk-000836-Qv for help-gnu-emacs@gnu.org; Mon, 18 Sep 2017 05:00:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dtrue-0004JG-SH for help-gnu-emacs@gnu.org; Mon, 18 Sep 2017 05:00:26 -0400 Original-Received: from mail-pg0-x234.google.com ([2607:f8b0:400e:c05::234]:45780) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dtrue-0004HG-Eu for help-gnu-emacs@gnu.org; Mon, 18 Sep 2017 05:00:20 -0400 Original-Received: by mail-pg0-x234.google.com with SMTP id 188so4631652pgb.2 for ; Mon, 18 Sep 2017 02:00:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=qODMm/Uq39daEJuMmZzNyajxRAmtfEorI/FgZmI+//Y=; b=KhIq8hNIaz6VlSKeIto1WSuLg9dnl1A6RZtcSWfEpJmoxk5Xr3XxtvSvIb7r75/VXf s1/WYcJxs/hMg3xormsu25D2EBz2J9kXeWMCqwazW4Ny8ZerG62cMyChiPRInnwAIT6N hvPN6qgeWTRyTX7fF4d1MUQ91cMktno/2NCv2R1dy03/TSWnbtS2eBIF3CV7B+CaBCtP ZrFAUdvgrGcH76cnsoEeJwPh47iBbNRxpvIjmo7R3PHiWgfc/OZA9OJ+OWSwok5IVqpY Voxc815GLmW4Vr2wOMTSjXqdO7pm5r/W+/C95+IqevRtV5ZfYMMstUc9Aocb1DNCkCtK X+Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=qODMm/Uq39daEJuMmZzNyajxRAmtfEorI/FgZmI+//Y=; b=t2z7UuZVoXE6mYl57R/7QtDjv+waEtehXggaG16MNx7OMj9vqeOQy5JptDi74ieiDi If82iE1POSBcPe17Ipe3m7jaPJW1z22NCR55scc1EGb+IRhcJ2WiExxH/Nc121J/3xre XixciUCjjy0TV7w9cVkcWm8jXYViMFaGpB+JE6WB9MIzBARLx4qY5jXGcjrTMUUNEfP2 GhF84NcY3iguNVnPBpsyjKWeV16zaGuFptrvAHuI/x82ThWOryL2Dr2QcVeELCHER1ys UtaB1JaPy7OoNdF7735dXsrqNX9+fZko90OPVpg8JvSNAsK2VES+QYQTGQK6wmISXR8X buSA== X-Gm-Message-State: AHPjjUjo3nMkuLtbwkqGunjf1CAG64vVv7gbY8qj8GNs4IrUwZIa/q1i EX0lw4l0vZ1zEArBgOU2YyOPfGjmvj5GLrQV6bUiNw== X-Google-Smtp-Source: ADKCNb7okV6d7+APMosAcNZ7qQwrVZrBJusNwphfRUtpwuhJ3tqH2/IsqjXktG1yLmRaiLwtaoLCoBBCmeCU8WDI5Gc= X-Received: by 10.159.207.132 with SMTP id z4mr35043324plo.95.1505725217380; Mon, 18 Sep 2017 02:00:17 -0700 (PDT) Original-Received: by 10.100.149.1 with HTTP; Mon, 18 Sep 2017 02:00:16 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::234 X-Mailman-Approved-At: Mon, 18 Sep 2017 11:32:03 -0400 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:114302 Archived-At: Until emacs 24 I was able to customize file opening using an "advice" around find-file. It was working for opening from inside emacs and also from command line. I use this to deal with common error reports, which are presented in "filename:lineno" syntax. The suggestion to do this can be found here: > https://stackoverflow.com/questions/3139970/open-a-file-at-line-with-filenameline-syntax After updating to version 25 (actually 25.2.2) and follow the instructions to update advice which I found here: > https://www.gnu.org/software/emacs/manual/html_node/elisp/Porting-old-advice.html The around is working when find-file is called from inside emacs, but not when emacs is called from command line. 1. Emacs 25 doesn't use find-file anymore when opening from command line? 2. Which function is called now? 3. Is this the best way to deal with this kind of customization? 4. How can I learn more about what emacs does when opened? I spect this is the proper mailing list to post this question. If not, really sorry and I appreciate instructions about where and how to post this. Thanks for your time. P.S.: Just for reference, the code I'm using (the same posted on SO), after update it into the new advice syntax is: (defun find-file--line-number (orig-fun filename &optional wildcards) "Turn files like file.cpp:14 into file.cpp and going to the 14-th line." (save-match-data (let* ((matched (string-match "^\\(.*\\):\\([0-9]+\\):?$" filename)) (line-number (and matched (match-string 2 filename) (string-to-number (match-string 2 filename)))) (filename (if matched (match-string 1 filename) filename))) (apply orig-fun (list filename wildcards)) (when line-number ;; goto-line is for interactive use (goto-char (point-min)) (forward-line (1- line-number)))))) (advice-add 'find-file :around #'find-file--line-number) -- Everton J. Carpes