From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Matthias Pfeifer Newsgroups: gmane.emacs.help Subject: Function behaves differently when debugged Date: Tue, 15 May 2018 00:34:53 +0200 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1526337329 4726 195.159.176.226 (14 May 2018 22:35:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 14 May 2018 22:35:29 +0000 (UTC) To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 15 00:35:25 2018 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 1fIM3x-00018U-4P for geh-help-gnu-emacs@m.gmane.org; Tue, 15 May 2018 00:35:25 +0200 Original-Received: from localhost ([::1]:50614 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIM64-00040Y-6u for geh-help-gnu-emacs@m.gmane.org; Mon, 14 May 2018 18:37:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fIM3T-0002Tp-Tc for help-gnu-emacs@gnu.org; Mon, 14 May 2018 18:34:56 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fIM3T-0000hz-36 for help-gnu-emacs@gnu.org; Mon, 14 May 2018 18:34:55 -0400 Original-Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:50718) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fIM3S-0000f4-Rg for help-gnu-emacs@gnu.org; Mon, 14 May 2018 18:34:55 -0400 Original-Received: by mail-wm0-x22b.google.com with SMTP id t11-v6so16164260wmt.0 for ; Mon, 14 May 2018 15:34:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to; bh=JI/nLF6eCpcj8dYL1GzF5sKEL73FTT4MJjgfmO8pBJY=; b=jT5pIsgI/DE4aUrOTlgrlCiY1nAZSbkhW9B7j9VDqw0vpqFspe1p27xJqisizCTUjY p40wDFaoepCZpgYVOTTz4rtepBO5C7KGrvLSfO4Jich/3yjlqQnogJM6nrITKQ9nh6Hk M40aCbvsnHPxHqOq+J593Pw9zlNiD3HBzwzWpeVkDSUW+RIkApSUBmdwHd6MZHa8Z2aa GZA3yq6sveNY5BAgSm5i5G6xSRn78sHukSIxL8xnALBYKDi0WO5MEbH08DgOAZxHZ/rF OQkyqxsC6VUnETeqW4zL6vi7EQka62V2WTHSSPGESdWUhvBSj9224sRsN8FkMjx0LoCz +D+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=JI/nLF6eCpcj8dYL1GzF5sKEL73FTT4MJjgfmO8pBJY=; b=jRqfGTDsgkgc740DJcSxKTVhA2+Af7rlwEvQVMd3G1GfZ7iyxtVCCKIwb1lKEdG1GS VaID24DQMroPA0nVZXrXPtCO53SocWeGsGHqC8RUhD16jJRJPm1CKVhodB5y3tYPhoiW cQ1DrL7srAbL72qtndkPX1esLoyjUHRyF04BByD1zC52RXWw26uViqTdTgH6CCg8cQtP YZTYGJLxB1ufKA2rj4K4FxIiggb4xYXZNuyrzELv5xLcL9CpwLNlMgx2K+3JIjK4YrxF aeKUGf2mGoLM8w8WjqbtVQWTt6uPt3dgAFzDFvskOByYAcP9ZlLMuCY/ejx0oZGjpS+k F/AA== X-Gm-Message-State: ALKqPwfx6GKjgWVQddDdJoEOhuTdZqum8lQcVl12kTSaCkVP1po9RAVj YiAoiyzpd5VtwGhGxOF1E+GyBLEil62GjkoA3Olgf92m X-Google-Smtp-Source: AB8JxZpeTyuOdmDu1CHgHoXjI4aut+lxqHIcXbo8rJnlITfV20cSg3IjIwDzz30JZ9cZgCzSoYwxCD9vip2sSj24KDU= X-Received: by 2002:a1c:4518:: with SMTP id s24-v6mr6736380wma.50.1526337293387; Mon, 14 May 2018 15:34:53 -0700 (PDT) Original-Received: by 10.223.139.23 with HTTP; Mon, 14 May 2018 15:34:53 -0700 (PDT) X-Google-Sender-Auth: Yx4Bfind5m8StSj9tYgzBgJ0xMg X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::22b 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:116736 Archived-At: Hi everybody, I have this function (defun mp-ibuffer-show-file-path () (interactive) (let ((buf (ibuffer-current-buffer)) (lsoutput nil)) (if (not (null buf)) (when (file-exists-p (buffer-file-name buf)) (with-temp-buffer (let* ((filename (buffer-file-name buf)) (file-directory (file-name-directory filename)) (just-filename (file-name-nondirectory filename))) (setq lsoutput file-directory)))) (setq lsoutput "Buffer is not backed by a file")) (message lsoutput))) I bind it to some key in ibuffer-mode. it should print the path to a buffer's file. When point is on a line of a buffer that is not backed by a file (eg *Messages*) then i get this output: wrong type argument: strinp, nil However when I instantiated my defun for debugging and do the same again I get "Buffer is not backed by a file" The second behavior is actually what i had expected when i was writing the function. The first behavior is a bit unexpected. Also I do not understand why my function behaves differently when my defun is debugged and when it run without debugging. Thanks for your help. Matthias