Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
PS1 under Emacs
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Off the Wall
View previous topic :: View next topic  
Author Message
slackline
Veteran
Veteran


Joined: 01 Apr 2005
Posts: 1404
Location: /uk/sheffield

PostPosted: Thu Aug 02, 2018 7:26 am    Post subject: PS1 under Emacs Reply with quote

Hi,

I've a problem with PS1 under emacs and have asked the following on Emacs Stackexcahnge a few weeks back but no answers, figured I'd ask here as there might be more a greater chance of someone knowing whats going on.


I find under both shells and terms in Emacs my prompt does not appear as I would expect based on my $PS1 appears as...

Code:

# Shell under Emacs
]0;slackline@583.datascience.work.com: /home/slackline@samba.sheffield.work.comslackline@583 ~ $ echo PS1
\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\]

# Terminal under Emacs
0;slackline@583.datascience.work.com: /home/slackline@samba.sheffield.work.comslackline@583 ~ $ echo PS1
\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\]

# GNOME or xfce4 Terminal
slackline@583 ~/ $ echo PS1
\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\]
I set $PS1 in ~/.bashrc so that its sourced each time a shell is started (rather than login)...

$ grep PS1 ~/.bashrc
export PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '


I found this thread which suggests its a down to differences between login and non-login shells and whether PS1 is being sourced from /etc/profile or a user-config, and suggests that under Emacs since its non-login its user configs that are used first. Checking /etc/profile to rule it out it has the following...

Code:

$ grep PS1 /etc/profile
if [ "$PS1" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
      PS1='# '
      PS1='$ '


...what is strange to me (if I've understood it correctly) is that \h:\w is commented out in this file and based on the above linked thread shouldn't be being sourced, yet it appears that this is what is being pre-pended to the prompt I would expect to see.


Anyone know whats going on here?

Thanks in advance.
_________________
"Science is what we understand well enough to explain to a computer.  Art is everything else we do." - Donald Knuth
Back to top
View user's profile Send private message
Bones McCracker
Veteran
Veteran


Joined: 14 Mar 2006
Posts: 1606
Location: U.S.A.

PostPosted: Wed Aug 08, 2018 8:30 am    Post subject: Reply with quote

What does the prompt look like after you
Code:
emerge --umerge emacs
emerge --depclean
delete all emacs config and scripts
eclean dist -d
emerge -e world

_________________
patrix_neo wrote:
The human thought: I cannot win.
The ratbrain in me : I can only go forward and that's it.
Back to top
View user's profile Send private message
Anon-E-moose
Advocate
Advocate


Joined: 23 May 2008
Posts: 3497
Location: Dallas area

PostPosted: Thu Aug 09, 2018 3:02 pm    Post subject: Reply with quote

Bones McCracker wrote:
What does the prompt look like after you
Code:
emerge --umerge emacs
emerge --depclean
delete all emacs config and scripts
eclean dist -d
emerge -e world


I'm not sure if the site will allow me to use ascii art to show you what it looks like.

:lol:
_________________
Asus m5a99fx, FX 8320 - nouveau & radeon, oss4
Acer laptop E5-575, i3-7100u - i965, alsa
---both---
4.14.62 kernel, profile 17.0 (no-pie) amd64-no-multilib
gcc 7.3.0, eudev, openrc, openbox, palemoon
Back to top
View user's profile Send private message
notageek
Tux's lil' helper
Tux's lil' helper


Joined: 05 Jun 2008
Posts: 131
Location: India

PostPosted: Thu Aug 09, 2018 4:10 pm    Post subject: Reply with quote

Yes it does. Use code tags, like this:

Code:

 _______________________
< This is not a donkey. >
 -----------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

_________________
"Defeat is a state of mind. No one is ever defeated, until defeat has been accepted as a reality." -- Bruce Lee
Back to top
View user's profile Send private message
slackline
Veteran
Veteran


Joined: 01 Apr 2005
Posts: 1404
Location: /uk/sheffield

PostPosted: Wed Aug 15, 2018 8:34 am    Post subject: Reply with quote

Finally found a solution to this problem and its down to how PROMPT_COMMAND is set.
_________________
"Science is what we understand well enough to explain to a computer.  Art is everything else we do." - Donald Knuth
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Off the Wall All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum