LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-02-2021, 04:24 PM   #1
rdsherman
Member
 
Registered: Aug 2009
Location: Santa Monica CA
Distribution: Slackware, Fedora, Debian
Posts: 114

Rep: Reputation: 21
Emacsclient Instability Woes


I have been using the latest emacs (27.2) as a server for a few months & encountered repeated sporadic annoyances. What follows is somewhat vague because I cannot give a precise repeatable sequence of operations which lead to a particular fault. Nevertheless, what I describe has occurred on dozens of instances. Few emacsclient sessions are seamless.

On boot, emacs --daemon is launched. All subsequent usage involves emacsclient only, mostly in a terminal (-t switch), sometimes in new frame (-c switch). Initially everything behaves as advertised in console & X. Then on time scales ranging from minutes to hours with various emacsclients in use doing all sorts of operations that made emacs famous, two nuisances inevitably appear:

1) A buffer has a bash or elisp script with font-lock-mode enabled (syntax highlighting). It looks just fine. Then, I switch to another buffer & when I return, part of the file is not visible. Close inspection shows that only text encoded as strings is rendered black-on-black or white-on-white. Disabling font-lock-mode shows nothing is missing! Again enabling font-lock-mode & the same text is missing. Killing the buffer & reloading does not fix the problem. At this point opening any new bash or elisp file with strings is futile. The only way to correct all is a restart of the daemon! Of course, any setup of screens / consoles is lost. However, no data is ever lost or damaged.

2) All is humming along just as it should. I invoke yet another emacsclient & am greeted by error messages notifying that no valid server socket can be found. Checking htop or ps says the daemon is up & running. And /run/user/UID/emacs/server socket is where it should be. Again, only escape route is a reboot of the emacs daemon.

Either one of the above can occur first.

Has anyone else seen these aberrations?
 
Old 09-02-2021, 05:36 PM   #2
slac-in-the-box
Member
 
Registered: Mar 2010
Location: oregon
Distribution: slackware64-15.0 / slarm64-current
Posts: 780
Blog Entries: 1

Rep: Reputation: 432Reputation: 432Reputation: 432Reputation: 432Reputation: 432
I'm interested in emacs, and I tried its http server before, and was impressed -- it was easier to authenticate a user than with hunchentoot / hunchentoot auth. But I wasn't connecting emacs clients to it, I was connecting web browsers... so many modes--someone's made a mode to control vibrators--

I do remember reading this, which seems relevant from the info-emacs-manual:
Quote:
Fontifying large buffers can take a long time. To avoid large delays
when a file is visited, Emacs initially fontifies only the visible
portion of a buffer. As you scroll through the buffer, each portion
that becomes visible is fontified as soon as it is displayed; this type
of Font Lock is called “Just-In-Time” (or “JIT”) Lock. You can control
how JIT Lock behaves, including telling it to perform fontification
while idle, by customizing variables in the customization group
‘jit-lock’
Perhaps customizing jit-lock could improve fontification over a network.
 
Old 09-02-2021, 05:43 PM   #3
rdsherman
Member
 
Registered: Aug 2009
Location: Santa Monica CA
Distribution: Slackware, Fedora, Debian
Posts: 114

Original Poster
Rep: Reputation: 21
Thanks "slac-in-the-box".

But, this easily occurs on tiny files, just a kB is enough.
 
Old 09-04-2021, 11:47 AM   #4
zakame
Member
 
Registered: Apr 2012
Location: Philippines
Distribution: Debian, Ubuntu, Slackware
Posts: 295

Rep: Reputation: 181Reputation: 181
Have you tried starting the daemon not with emacs --daemon but with emacsclient -c -n? I found there are nuances between these ways of starting the server that could affect where your server socket location is, for example.

Another thing you might watch out for is if your /dev/shm is piling up - Emacs likes to make a lot of tempfiles (or backups of vc buffers) over time and if you're only rebooting the daemon and not cleaning up /dev/shm, that might affect your setup.
 
Old 09-04-2021, 12:11 PM   #5
rdsherman
Member
 
Registered: Aug 2009
Location: Santa Monica CA
Distribution: Slackware, Fedora, Debian
Posts: 114

Original Poster
Rep: Reputation: 21
Quote:
Originally Posted by zakame View Post
... emacsclient -c -n ... /dev/shm/
emacsclient start fails, can't find socket (console or X)

My /dev/shm is empty
 
Old 09-04-2021, 12:16 PM   #6
zakame
Member
 
Registered: Apr 2012
Location: Philippines
Distribution: Debian, Ubuntu, Slackware
Posts: 295

Rep: Reputation: 181Reputation: 181
Quote:
Originally Posted by rdsherman View Post
emacsclient start fails, can't find socket (console or X)

My /dev/shm is empty
I forget you probably need to set an empty $ALTERNATE_EDITOR in the environment where you call emacsclient -c -n - that should auto start a server if it can't find an existing socket.

Good to know your /dev/shm is empty - it should normally be for most use cases.
 
Old 09-04-2021, 12:22 PM   #7
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,911

Rep: Reputation: 5027Reputation: 5027Reputation: 5027Reputation: 5027Reputation: 5027Reputation: 5027Reputation: 5027Reputation: 5027Reputation: 5027Reputation: 5027Reputation: 5027
I made a point of using emacsclient instead of just plain emacs last night while working on one of my projects. I didn't notice anything untoward — though for full disclosure, I do rebuild emacs with the lucid widgets rather than using gtk.
 
Old 09-04-2021, 12:35 PM   #8
rdsherman
Member
 
Registered: Aug 2009
Location: Santa Monica CA
Distribution: Slackware, Fedora, Debian
Posts: 114

Original Poster
Rep: Reputation: 21
Quote:
Originally Posted by GazL View Post
I made a point of using emacsclient instead of just plain emacs last night while working on one of my projects. I didn't notice anything untoward — though for full disclosure, I do rebuild emacs with the lucid widgets rather than using gtk.
I always build a Lucid / Athena version. GTK3 has well known bug; it fails immediately on switch between console & X.

As I noted in my original post, it's sporadic. Can take minutes to hours to days for problems to appear. That is what makes this hard to solve.

I'll ask another question as a paraphrase of all. Can anyone find a key chord combo that might induce the syntax highlight failure on strings only?
 
Old 09-04-2021, 12:37 PM   #9
rdsherman
Member
 
Registered: Aug 2009
Location: Santa Monica CA
Distribution: Slackware, Fedora, Debian
Posts: 114

Original Poster
Rep: Reputation: 21
Quote:
Originally Posted by zakame View Post
I forget you probably need to set an empty $ALTERNATE_EDITOR in the environment where you call emacsclient -c -n - that should auto start a server if it can't find an existing socket.

Good to know your /dev/shm is empty - it should normally be for most use cases.
-a option starts it. Now the hard part; will it help? Thanks. Stay tuned.
 
Old 09-04-2021, 03:04 PM   #10
rdsherman
Member
 
Registered: Aug 2009
Location: Santa Monica CA
Distribution: Slackware, Fedora, Debian
Posts: 114

Original Poster
Rep: Reputation: 21
Quote:
Originally Posted by zakame View Post
I forget you probably need to set an empty $ALTERNATE_EDITOR in the environment where you call emacsclient -c -n - that should auto start a server if it can't find an existing socket.

Good to know your /dev/shm is empty - it should normally be for most use cases.
Got it all working. Several minutes later... failure. All strings in a bash script were "highlighted" as black-on-black while in console. All just as I describe in original posting.

I'll ask my initial question this way: What kind of fault could cause font-lock-mode to syntax highlight all words properly except one (strings)?
 
Old 09-04-2021, 10:30 PM   #11
zakame
Member
 
Registered: Apr 2012
Location: Philippines
Distribution: Debian, Ubuntu, Slackware
Posts: 295

Rep: Reputation: 181Reputation: 181
Quote:
Originally Posted by rdsherman View Post
Got it all working. Several minutes later... failure. All strings in a bash script were "highlighted" as black-on-black while in console. All just as I describe in original posting.

I'll ask my initial question this way: What kind of fault could cause font-lock-mode to syntax highlight all words properly except one (strings)?
At this point it is probably worth a screenshot or two (and maybe a snippet or so of your ~/.emacs.d/init.el, if any) for anyone here to help understand what you're experiencing

Are you also experiencing this on a running daemon without any ~/.emacs.d customizations (e.g. emacs -Q --daemon ?) If you can and experience no font-lock weirdness on strings anymore (you can speed it up via M-x font-lock-debug-fontify on buffers,) I'd suggest slowly reintegrate pieces of your customizations until you find what's breaking it.
 
Old 09-05-2021, 03:59 PM   #12
rdsherman
Member
 
Registered: Aug 2009
Location: Santa Monica CA
Distribution: Slackware, Fedora, Debian
Posts: 114

Original Poster
Rep: Reputation: 21
Quote:
Originally Posted by zakame View Post
At this point it is probably worth a screenshot or two (and maybe a snippet or so of your ~/.emacs.d/init.el, if any) for anyone here to help understand what you're experiencing
Attached is a screenshot of .bashrc file edited in emacsclient. 0.jpg = normal; 1.jpg = after syntax highlight fails on strings; init.el.

The misbehavior here is in xterm; but, the identical error happens in console, too!
Attached Thumbnails
Click image for larger version

Name:	0.jpg
Views:	16
Size:	152.7 KB
ID:	37143   Click image for larger version

Name:	1.jpg
Views:	15
Size:	126.0 KB
ID:	37144  
Attached Files
File Type: txt init.el.txt (8.3 KB, 5 views)

Last edited by rdsherman; 09-05-2021 at 06:56 PM. Reason: clarification
 
Old 09-06-2021, 01:24 AM   #13
zakame
Member
 
Registered: Apr 2012
Location: Philippines
Distribution: Debian, Ubuntu, Slackware
Posts: 295

Rep: Reputation: 181Reputation: 181
Quote:
Originally Posted by rdsherman View Post
Attached is a screenshot of .bashrc file edited in emacsclient. 0.jpg = normal; 1.jpg = after syntax highlight fails on strings; init.el.

The misbehavior here is in xterm; but, the identical error happens in console, too!
Thanks - that does look odd indeed. I take your xterm doesn't have any custom color resources other than the defaults?

I've seen a similar issue but that one is between Emacs under xterm vs GTK (or on iTerm2 vs NS/Cocoa on macOS,) where when you start the daemon on either xterm or headless (e.g. plain emacs --daemon without using (server-start) in your config) and frequently switching/calling Emacs frames across console/xterm/GUI. The xterm/GUI difference stems from certain xterms not having 256 color support - in my case, that was easily resolved by using a modern xterm like kitty. Not sure if this would work on your case though, since you mention using Emacs on the console (which IIRC only supports 8.)
 
Old 09-06-2021, 11:45 AM   #14
rdsherman
Member
 
Registered: Aug 2009
Location: Santa Monica CA
Distribution: Slackware, Fedora, Debian
Posts: 114

Original Poster
Rep: Reputation: 21
Quote:
Originally Posted by zakame View Post
Thanks - that does look odd indeed. I take your xterm doesn't have any custom color resources other than the defaults?

I've seen a similar issue but that one is between Emacs under xterm vs GTK (or on iTerm2 vs NS/Cocoa on macOS,) where when you start the daemon on either xterm or headless (e.g. plain emacs --daemon without using (server-start) in your config) and frequently switching/calling Emacs frames across console/xterm/GUI. The xterm/GUI difference stems from certain xterms not having 256 color support - in my case, that was easily resolved by using a modern xterm like kitty. Not sure if this would work on your case though, since you mention using Emacs on the console (which IIRC only supports 8.)
It's certainly not xterm since it occurs just as frequently in a console. But, your comment about frequent switching seems apropos. If I remain in a single instance of emacsclient, there are no problems (so far). Maybe it's a termcap flaw? I use the "Linux" entry from all available.

And, it would useful if someone else could see this errant phenom, too!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
emacsclient under KDE desktop usr345 Linux - Desktop 0 06-28-2012 04:06 AM
emacsclient opens emacs22 instead of emacs-snapshot-gtk evaristegalois Linux - Newbie 5 06-30-2010 04:28 AM
Strange Instability.. dj_relentless Linux - General 5 06-24-2006 05:34 PM
strange instability problem shiatsu Linux - Hardware 9 06-29-2002 11:34 PM
Instability in OpenGL apps SilentStrike Linux - General 12 05-24-2002 05:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 12:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration