emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fixing org-store-link for eshell
@ 2019-08-21  6:20 Abhishek Chandratre
  2019-08-22 17:12 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Abhishek Chandratre @ 2019-08-21  6:20 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 719 bytes --]

Hello all,
Thank you for supporting and maintaining org mode.

I wanted to use org-store-link for eshell, but it failed.
Looked like dired-directory was nil, I fixed it by calling (eshell/pwd) to
get pwd.
I tested with and without TRAMP, works like a charm.

The patch did not create new test case failures, but for master branch on
my machine I saw 6 test case failure (not related to patch).

6 unexpected results:
   FAILED  ob-sed-test/cmd-line-header-argument
   FAILED  ob-shell/bash-uses-assoc-arrays
   FAILED  ob-tangle/jump-to-org
   FAILED  test-ob-shell/session
   FAILED  test-org-attach/dir
   FAILED  test-org-table/sort-lines

I will try investigate and address them in another patch.
Thanks,
-Abhishek

[-- Attachment #1.2: Type: text/html, Size: 1009 bytes --]

[-- Attachment #2: 0001-ol-eshell.el-Fix-org-store-link-for-eshell.patch --]
[-- Type: application/octet-stream, Size: 1132 bytes --]

From 37c77d8e563428dcc44c69fa4cd377639730734f Mon Sep 17 00:00:00 2001
From: Abhishek Chandratre <abhishek.chandratre@gmail.com>
Date: Tue, 20 Aug 2019 22:26:30 -0700
Subject: [PATCH] ol-eshell.el: Fix org-store-link for eshell

lisp/ol-eshell.el (org-eshell-store-link): Replace `dired-directory'
variable with `eshell/pwd' function to find current directory.

During org-store-link `dired-directory' variable returns nil.
Thus replacing it with (eshell/pwd), which returns pwd.

TINYCHANGE
---
 lisp/ol-eshell.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ol-eshell.el b/lisp/ol-eshell.el
index 4de657461..a9a72a534 100644
--- a/lisp/ol-eshell.el
+++ b/lisp/ol-eshell.el
@@ -55,7 +55,7 @@
   "Store a link that, when opened, switches back to the current eshell buffer
    and the current working directory."
   (when (eq major-mode 'eshell-mode)
-    (let* ((command (concat "cd " dired-directory))
+    (let* ((command (concat "cd " (eshell/pwd)))
            (link  (concat (buffer-name) ":" command)))
       (org-link-store-props
        :link (concat "eshell:" link)
-- 
2.20.1 (Apple Git-117)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fixing org-store-link for eshell
  2019-08-21  6:20 [PATCH] Fixing org-store-link for eshell Abhishek Chandratre
@ 2019-08-22 17:12 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2019-08-22 17:12 UTC (permalink / raw)
  To: Abhishek Chandratre; +Cc: emacs-orgmode

Hello,

Abhishek Chandratre <abhishek.chandratre@gmail.com> writes:

> I wanted to use org-store-link for eshell, but it failed.
> Looked like dired-directory was nil, I fixed it by calling (eshell/pwd) to
> get pwd.
> I tested with and without TRAMP, works like a charm.

Applied. I added a `declare-function' to silence compilation warning.

Thank you!

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-22 17:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-21  6:20 [PATCH] Fixing org-store-link for eshell Abhishek Chandratre
2019-08-22 17:12 ` Nicolas Goaziou

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).