Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tramp support #1229

Closed
jeberger opened this Issue Oct 9, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@jeberger
Copy link
Contributor

jeberger commented Oct 9, 2017

Several issues related to tramp were reported (e.g #778), some of them in plugins, and some have had an ad-hoc fix applied (e.g #669). I think these should be fixed globally by making counsel--async-command work on remote buffers. For example, the following seems to work for me (note the call to generate-new-buffer and the replacement of start-process-shell-command with start-file-process-shell-command):

(defun counsel--async-command (cmd &optional process-sentinel process-filter)
  "Start new counsel process by calling CMD.
If a counsel process is already running, kill it and its associated buffer
before starting a new one.  If non-nil, use PROCESS-SENTINEL as the sentinel
function instead of `counsel--async-sentinel'.  If non-nil, use PROCESS-FILTER
for handling the output of the process instead of `counsel--async-filter'."
  (message "Running %s" cmd)
  (let* ((counsel--process " *counsel*")
         (proc (get-process counsel--process))
         (buff (get-buffer counsel--process)))
    (when proc
      (delete-process proc))
    (when buff
      (kill-buffer buff))
    (setq buff (generate-new-buffer counsel--process))
    (setq proc (start-file-process-shell-command
                counsel--process
                counsel--process
                cmd))
    (setq counsel--async-start
          (setq counsel--async-time (current-time)))
    (set-process-sentinel proc (or process-sentinel #'counsel--async-sentinel))
    (set-process-filter proc (or process-filter #'counsel--async-filter))))
@abo-abo

This comment has been minimized.

Copy link
Owner

abo-abo commented Oct 9, 2017

After a short test, your code works better than the current code. Please open a PR with this chage.

@manuel-uberti

This comment has been minimized.

Copy link
Contributor

manuel-uberti commented Oct 10, 2017

Yes please. Heavy user of TRAMP here, I'll greatly appreciate the improvement instead of relying on quick fixes.

jeberger added a commit to jeberger/swiper that referenced this issue Oct 10, 2017

counsel.el: Allow async commands on Tramp buffers
Makes `counsel--async-command` work on remote buffers. This removes
the need for the workaround introduced in `counsel-ag-function` with
abo-abo#669 and should fix similar issues in other commands or plugins.

Fixes abo-abo#1229
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.