[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Deleting the shell prompt in Shell Mode
From: |
Raffaele Ricciardi |
Subject: |
Deleting the shell prompt in Shell Mode |
Date: |
Tue, 7 Jul 2015 21:16:03 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 |
I am using the function `shell-snarf-envar' to read environment
variables in Shell Mode. However, `shell-snarf-envar' leaves trace of
its passage, whilst I would rather have it act invisibly. For instance,
calling:
(shell-snarf-envar "SHELL")
leaves the following output (the first line belongs to my custom
prompt):
~/Downloads
$ printenv "SHELL"
/bin/bash
Therefore I have written a wrapper function to delete the shell
interaction performed by `shell-snarf-envar':
(defun stealth-shell-snarf-envar/rr ($var)
"Like `shell-snarf-envar', but leaves no trace."
;; fixme: does not delete the prompt.
(lexical-let (($start (point)))
(prog1
(shell-snarf-envar "PS1")
(delete-region $start (point)))))
But as the comment says, the above function does not delete the prompt,
as I would like it to do.
I have read that Shell Mode keeps track of prompts with text properties,
therefore I have run `shell-snarf-envar' with Edebug to understand its
inner workings, but Edebug has hung each time, leaving me without a clue
about how to detect shell prompts.
Thank you.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Deleting the shell prompt in Shell Mode,
Raffaele Ricciardi <=