Giter Site home page Giter Site logo

Comments (4)

dwrz avatar dwrz commented on July 23, 2024 1

@prasoon2211 Sorry, I no longer use shell-pop. I vaguely recall this issue wasn't just due to shell-pop, but I'm not very sure.

from shell-pop-el.

prasoon2211 avatar prasoon2211 commented on July 23, 2024

Sorry to revive the dead thread. @dwrz did you find a fix for this perhaps?

from shell-pop-el.

SirVolta avatar SirVolta commented on July 23, 2024

@prasoon2211 I've had this issue too. It seems to be fixable by advising #'shell-pop--cd-to-cwd-eshell to only run in eshell buffers and only auto-cd when necessary. I've also had to work around another, possibly related, bug involving the buffer directory not being detected properly. Taking the directory part of buffer-file-name seems to work much better then default-directory.
With these workarounds shell-pop works well for me using Emacs 27.1 on Debian.

(defun sv/fixed-shell-pop--cd-to-cwd-eshell (cwd)
  (if (string= major-mode "eshell-mode")
      t
    (message "Trying to set eshell CWD (%s) outside of eshell!" cwd)
    nil))

(advice-add 'shell-pop--cd-to-cwd-eshell :before-while #'sv/fixed-shell-pop--cd-to-cwd-eshell)

(defun sv/shell-pop (arg)
  (interactive "P")
  (let ((default-directory
          (or (file-name-directory (or (buffer-file-name) "")) default-directory))
        (shell-pop-autocd-to-working-dir (stringp (buffer-file-name))))
    (shell-pop arg)))

(define-key xah-fly-leader-key-map (kbd "z") #'sv/shell-pop)

config:

(setq shell-pop-default-directory (expand-file-name "~")
      shell-pop-shell-type  '("eshell" "*eshell*" (lambda () (eshell)))
      shell-pop-universal-key nil
      shell-pop-window-size 30
      shell-pop-full-span t
      shell-pop-autocd-to-working-dir t
      shell-pop-window-position "bottom")

from shell-pop-el.

senkowo avatar senkowo commented on July 23, 2024

I found the issue to be problematic when running shell-pop while in an org file with code blocks. If a code block tangles to a relative path, for example #+begin_src :tangle ./setup, and it intends to tangle to /home/user/code/project1/setup, after running shell-pop, it would try to tangle to /home/user/setup instead, as the default-directory would've changed from /home/user/code/project1/ to /home/user/.

I haven't tried @SirVolta's solution yet, but i might just use popper.el instead, which can turn any buffer into a pop-up window, so i'll use that and script together a makeshift pop-up terminal instead.

Update: the package multi-term provides a command to create a dedicated pop-up terminal window (multi-term-dedicated-toggle), just like shell-pop does. There's another called multi-vterm, which only supports vterm (I'm assuming this had to be created because of compatibility issues between vterm and multi-term). I've tried multi-vterm and it works great, but multi-term, the original, doesn't work as well as shell-pop, nor does it support eshell...

from shell-pop-el.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.