Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Switched to profile 23.0, now can't open emacs in X[SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
sl70
Guru
Guru


Joined: 18 Jun 2002
Posts: 449
Location: Saitama, JP

PostPosted: Mon Mar 25, 2024 4:38 am    Post subject: Switched to profile 23.0, now can't open emacs in X[SOLVED] Reply with quote

Hi, after I messed up my whole system by ignoring the news item about grub-install, when the profile 23.0 news came out I was very careful to follow the excellent instructions to the letter. Everything seems OK but now I can't get emacs to open in an X frame, only a tty frame (which sucks very badly). I have been using emacs in X for 30 years or thereabouts and have never had this problem.
I tried
    re-emerging emacs
    removing the cairo USE flag (when I was running the giant emerge @world step I had to add cairo for some other package, but I guess that had nothing to do with this issue)
    tried running it with emacsclient -c
    ran emacs --debug-init .emacs


probably other things I can't remember now. Nothing works.

I depend on emacs for my work using dev-lang/R as an inferior process in emacs. Without it I'm lost.

I'd very much appreciate any help.


Last edited by sl70 on Tue Mar 26, 2024 4:36 am; edited 1 time in total
Back to top
View user's profile Send private message
kgdrenefort
Apprentice
Apprentice


Joined: 19 Sep 2023
Posts: 185
Location: Somewhere in the 77

PostPosted: Mon Mar 25, 2024 8:03 am    Post subject: Reply with quote

Hello,

Could you please provide an output, error message on anything to start debugging this behavior please ?

What error(s) do you see while attempting to run emacs into your X session ?

Maybe that link could help you out: https://wiki.gentoo.org/wiki/Gentoo_Cheat_Sheet#Package_troubleshooting

Also, you said:

sl70 wrote:
(…) after I messed up my whole system by ignoring the news item about grub-install, (…)


What did happens ? Did you solved that ?

Regards,
GASPARD DE RENEFORT Kévin
_________________
«Gentoo does not have problems, only learning opportunities.» - NeddySeagoon
«If your Gentoo installation isn't valuable to you, feel free to continue to ignore the instructions.» - figueroa
Back to top
View user's profile Send private message
sl70
Guru
Guru


Joined: 18 Jun 2002
Posts: 449
Location: Saitama, JP

PostPosted: Mon Mar 25, 2024 11:15 am    Post subject: Reply with quote

kgdrenefort wrote:
Hello,

Could you please provide an output, error message on anything to start debugging this behavior please ?

What error(s) do you see while attempting to run emacs into your X session ?


Nothing at all. There is nothing in .xsession-errors. Nothing when I run emacs --debug-init. When I run it, instead of opening an emacs window, it displays in the terminal window. That's it.

kgdrenefort wrote:

Maybe that link could help you out: https://wiki.gentoo.org/wiki/Gentoo_Cheat_Sheet#Package_troubleshooting

Also, you said:

sl70 wrote:
(…) after I messed up my whole system by ignoring the news item about grub-install, (…)


What did happens ? Did you solved that ?

Regards,
GASPARD DE RENEFORT Kévin


Yes, I booted from the Gentoo USB bootable installer, started a chroot, did grub-install, and it was fine. The big problem was when the computer did nothing but start the BIOS screen, I panicked and instead of backing stuff up, I deleted lots of stuff and deleted the backups, too. It took me a lot of time to repair my self-inflicted damage. Bluetooth and some other stuff are still not working.
Back to top
View user's profile Send private message
kgdrenefort
Apprentice
Apprentice


Joined: 19 Sep 2023
Posts: 185
Location: Somewhere in the 77

PostPosted: Mon Mar 25, 2024 12:52 pm    Post subject: Reply with quote

What does this command return:

Code:
emacs --version


As well as:

Code:
emacs --debug-init


Can you paste also your ~/.emacs or relevant configuration files too ?

Also, does it works with:

Code:
emacs -nw

(no window)

I never used emacs, so I'm trying to help from googling on my side.

Also please:

Code:
equery check emacs

(https://wiki.gentoo.org/wiki/Equery#Verifying_package_integrity_with_check_.28k.29)

To check if it's not corrupted or what ever.

Regards,
GASPARD DE RENEFORT Kévin
_________________
«Gentoo does not have problems, only learning opportunities.» - NeddySeagoon
«If your Gentoo installation isn't valuable to you, feel free to continue to ignore the instructions.» - figueroa
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21635

PostPosted: Mon Mar 25, 2024 2:49 pm    Post subject: Reply with quote

As an uninformed guess based on how gvim can get into a similar situation: is $DISPLAY set properly in the terminal from which you start emacs? Some programs, such as vim, will automatically fall back to rendering in the terminal if they fail to connect to X. If instead of emacs, you run xmessage Hello (or some other trivial X using program), what happens?

What is the output of emerge --pretend --verbose emacs? You may need to vary the package name, depending on whether /usr/bin/emacs is provided by app-editors/emacs or some other package, such as app-editors/xemacs. If in doubt, use equery belongs to find the package that owns the program emacs.
Back to top
View user's profile Send private message
sl70
Guru
Guru


Joined: 18 Jun 2002
Posts: 449
Location: Saitama, JP

PostPosted: Tue Mar 26, 2024 1:15 am    Post subject: Reply with quote

Hu wrote:
As an uninformed guess based on how gvim can get into a similar situation: is $DISPLAY set properly in the terminal from which you start emacs? Some programs, such as vim, will automatically fall back to rendering in the terminal if they fail to connect to X.


Right. Good idea. I get this:
Code:
echo ${DISPLAY}
:0.0


Looks OK to me. I tried two different terminal programs. Both give the same result.

Hu wrote:
If instead of emacs, you run xmessage Hello (or some other trivial X using program), what happens?


Yup. It opens in an X window. The problem is in emacs, not the environment.

Hu wrote:
What is the output of emerge --pretend --verbose emacs? You may need to vary the package name, depending on whether /usr/bin/emacs is provided by app-editors/emacs or some other package, such as app-editors/xemacs. If in doubt, use equery belongs to find the package that owns the program emacs.


I think this is OK.

Code:
ls -al `which emacs`
lrwxrwxrwx 1 root root 8 Sep 24  2023 /usr/bin/emacs -> emacs-29

 equery belongs /usr/bin/emacs-29
 * Searching for /usr/bin/emacs-29 ...
app-editors/emacs-29.2-r1 (/usr/bin/emacs-29)

emerge -pv =app-editors/emacs-29.2-r1
These are the packages that would be merged, in order:

Calculating dependencies... done!
Dependency resolution took 1.61 s (backtrack: 0/20).

[ebuild   R    ] app-editors/emacs-29.2-r1:29::gentoo  USE="X Xaw3d acl alsa cairo dbus gif gmp gpm gtk imagemagick inotify jpeg m17n-lib png ssl svg threads xpm zlib (-aqua) -athena -dynamic-loading -games -gfile -gsettings -gui -gzip-el -harfbuzz -jit -json -kerberos -lcms -libxml2 -livecd -mailutils -motif (-selinux) -sound -source -sqlite -systemd -tiff -toolkit-scroll-bars -tree-sitter -valgrind -webp -wide-int -xft -xwidgets" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB



This all looks OK to me. Why it's failing is a mystery to me.
Back to top
View user's profile Send private message
sl70
Guru
Guru


Joined: 18 Jun 2002
Posts: 449
Location: Saitama, JP

PostPosted: Tue Mar 26, 2024 1:21 am    Post subject: Reply with quote

kgdrenefort wrote:
Also please:

Code:
equery check emacs

(https://wiki.gentoo.org/wiki/Equery#Verifying_package_integrity_with_check_.28k.29)

To check if it's not corrupted or what ever.



Code:
 equery check emacs
* Checking app-editors/emacs-29.2-r1 ...
   4310 out of 4310 files passed


No problem here.
Back to top
View user's profile Send private message
spica
Apprentice
Apprentice


Joined: 04 Jun 2021
Posts: 287

PostPosted: Tue Mar 26, 2024 1:45 am    Post subject: Reply with quote

sl70 wrote:
Code:

[ebuild   R    ] app-editors/emacs-29.2-r1:29::gentoo  USE="X Xaw3d acl alsa cairo dbus gif gmp gpm gtk imagemagick inotify jpeg m17n-lib png ssl svg threads xpm zlib (-aqua) -athena -dynamic-loading -games -gfile -gsettings -gui -gzip-el -harfbuzz -jit -json -kerberos -lcms -libxml2 -livecd -mailutils -motif (-selinux) -sound -source -sqlite -systemd -tiff -toolkit-scroll-bars -tree-sitter -valgrind -webp -wide-int -xft -xwidgets" 0 KiB

It looks like you need the gui flag to be enabled.
Back to top
View user's profile Send private message
sl70
Guru
Guru


Joined: 18 Jun 2002
Posts: 449
Location: Saitama, JP

PostPosted: Tue Mar 26, 2024 4:34 am    Post subject: Reply with quote

spica wrote:
sl70 wrote:
Code:

[ebuild   R    ] app-editors/emacs-29.2-r1:29::gentoo  USE="X Xaw3d acl alsa cairo dbus gif gmp gpm gtk imagemagick inotify jpeg m17n-lib png ssl svg threads xpm zlib (-aqua) -athena -dynamic-loading -games -gfile -gsettings -gui -gzip-el -harfbuzz -jit -json -kerberos -lcms -libxml2 -livecd -mailutils -motif (-selinux) -sound -source -sqlite -systemd -tiff -toolkit-scroll-bars -tree-sitter -valgrind -webp -wide-int -xft -xwidgets" 0 KiB

It looks like you need the gui flag to be enabled.


@spica, you win the prize (my eternal gratitude)! I thought of changing the USE flag for gui, but I read somewhere that specifying the X USE flag automatically sets the gui flag. Perhaps I misunderstood but I think it should behave like that. If there's a conflict in USE flags (X and -gui is an obvious contradiction) shouldn't a red flag (no pun intended) go up?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21635

PostPosted: Tue Mar 26, 2024 2:15 pm    Post subject: Reply with quote

That depends on the application. Some programs, such as console vim, can connect to and use an X server, despite not creating an X window of their own. In the case of Vim, running vim with access to the X server allows it to natively interact with the X clipboard, but still render in a terminal. If emacs has a similar feature, then while unusual, USE="X -gui" is not a contradiction.

Personally, I think it would be nice if trying to force emacs into GUI mode while built with USE=-gui would generate a nice clear error message like "This emacs was built without GUI support. You cannot enable the GUI." and then exit, instead of showing the behavior you reported here. Vim does this:
Code:
$ /usr/bin/vim -g
E25: GUI cannot be used: Not enabled at compile time
Such an error would probably have led you quickly to "Why does this not have GUI support? Is it USE=-gui?"
Back to top
View user's profile Send private message
sl70
Guru
Guru


Joined: 18 Jun 2002
Posts: 449
Location: Saitama, JP

PostPosted: Wed Mar 27, 2024 1:01 am    Post subject: Reply with quote

Hu wrote:

Personally, I think it would be nice if trying to force emacs into GUI mode while built with USE=-gui would generate a nice clear error message like "This emacs was built without GUI support. You cannot enable the GUI." and then exit, instead of showing the behavior you reported here. Vim does this:
Code:
$ /usr/bin/vim -g
E25: GUI cannot be used: Not enabled at compile time
Such an error would probably have led you quickly to "Why does this not have GUI support? Is it USE=-gui?"


Oh, I didn't know that about vim. But, by all means, let's restart the vi vs. emacs war!

Seriously, thanks, @Hu, for the explanation.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21635

PostPosted: Wed Mar 27, 2024 1:18 am    Post subject: Reply with quote

Yes, I recognized that I was bringing up Vim in an Emacs thread, but it was the first program that came to mind that exhibited the special circumstances I wanted to suggest could explain why Emacs was behaving as it did. The opportunity to shame Emacs by showcasing Vim's superior error reporting was merely a happy accident. ;)
Back to top
View user's profile Send private message
sl70
Guru
Guru


Joined: 18 Jun 2002
Posts: 449
Location: Saitama, JP

PostPosted: Wed Mar 27, 2024 1:31 am    Post subject: Reply with quote

This was my first experience with the gui USE flag so I decided to set it globally and then do emerge -N @world. The only packages that got rebuilt were emacs, emacs-common, and cmake. Can't figure out why cmake would use gui but....
Back to top
View user's profile Send private message
wjb
l33t
l33t


Joined: 10 Jul 2005
Posts: 609
Location: Fife, Scotland

PostPosted: Wed Mar 27, 2024 12:34 pm    Post subject: Reply with quote

Hu wrote:
Personally, I think it would be nice if trying to force emacs into GUI mode while built with USE=-gui would generate a nice clear error message like "This emacs was built without GUI support. You cannot enable the GUI." and then exit, instead of showing the behavior you reported here.


It's reasonably explicit - from the app-editors/emacs ebuild:
Code:

...
        if ! use gui; then
                einfo "Configuring to build without window system support"
                myconf+=" --without-x --without-pgtk --without-ns"
       elif (various GUI options)
             ....
       else
            (pure X11)
...


However, at the beginning of the if statement, the gui flag is used to mean 'any gui' but by the end it's essentially assumed to be equivalent to X flag (X is not checked explicitly). This isn't ideal, and having gui as a use flag seems superfluous. Maybe a REQUIRED_USE to check the combinations?
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21635

PostPosted: Wed Mar 27, 2024 2:56 pm    Post subject: Reply with quote

That is different though. You cite a notice in the ebuild, which the administrator will only observe by reading the log messages from src_configure. If the administrator obtains a prebuilt emacs (and therefore does not run src_configure), or ignores ebuild log output, then this message will not be seen. The example I showed is that the installed Vim specifically recognizes that the user (who may or may not even be the person who installed vim) requested a GUI, and prints a diagnostic telling you that it lacks GUI support. The only ways the user can fail to see this message are by discarding stderr or by not explicitly invoking a GUI (and instead trusting the program to imply a GUI by default). In some fairness to emacs, it is not clear to me that any of the OP's attempts to get emacs into GUI mode were the equivalent of vim -g, so maybe there exists some emacs invocation that would force emacs to display a GUI or display an error. I see that emacs -nw was suggested, which I assume is an explicit request for a GUI, but it's not clear that OP tried that.
Back to top
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 370

PostPosted: Wed Mar 27, 2024 5:05 pm    Post subject: Reply with quote

You can build Emacs with GUI or without. If you build Emacs with a GUI you can choose between X11 and Wayland (pure GTK). And that makes it quite complicated to figure out the correct USE flag combination.
Back to top
View user's profile Send private message
wjb
l33t
l33t


Joined: 10 Jul 2005
Posts: 609
Location: Fife, Scotland

PostPosted: Thu Mar 28, 2024 6:35 pm    Post subject: Reply with quote

Code:
-nw, --no-window-system
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming 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