nXhtml is not highlighting PHP code, gives errors on loading - emacs

I'm using the latest nXhtml checked out from the repo, and using GNU Emacs version 24.0.91.1. When I open a PHP file it shows as un-syntax-highlighted text, and I get a compile error:
Error: Wrong type argument: number-or-marker-p, nil
and a message in the log:
File mode specification error: (cl-assertion-failed (functionp byte-compiled-fun))
I'm avoiding my .emacs and .emacs.d by running emacs with this command:
emacs -Q --eval '(load "/path/to/nxhtml/autostart")' /path/to/nxhtml/tests/in/heredoc.php
Even if you don't have a fix, how can I go about debugging this issue?

There seem to be a fair amount of such wrong-type-argument errors lately with the development version of Emacs (24). This might represent an Emacs bug. Or it might represent an nXhtml bug.
I suggest starting by notifying Lennart, the nXhtml author, trying to give him a clear recipe, starting from emacs -Q.
If that doesn't help, consider filing an Emacs bug: M-x report-emacs-bug.
To try to debug it a bit yourself, be sure to load only source files (e.g. for nXhtml), i.e., *.el, not *.elc, starting preferably with emacs -Q (no init file). Do M-x set-variable debug-on-error t to see where the error is raised. Then perhaps use M-x debug-on-entry FUNCTION, where FUNCTION is the function where the error seems to have been raised. Then step through the Emacs debugger, hitting d to step and c to skip through a step.
But again, I suggest starting with Lennart.

Try the newest version of Emacs.
I had the same problem (on Windows 7):
Error: Wrong type argument: number-or-marker-p, nil
at line 1471 of nxhtml-loaddefs.el.
Nxhtml seems fine on Emacs 24.1.50.1 (23 April 2012).
http://alpha.gnu.org/gnu/emacs/windows/?C=M;O=D

Related

Emacs package management failure in Emacs 27.1

My ultimate goal is to get magit working again with Emacs 27.1 on openSUSE Tumbleweed, but the problem ahead of that is getting (melpa?) package management working - so that is really what this post is about. I run into these problems with other packages; magit is just the example, because want teh awesome. I had not installed any packages recently with Emacs 26.3, but my assumption is that it was OK. Magit was certainly working.
Attempt is to start from bare wood:
rm .emacs
rm -r .emacs.d
Need melpa to get magit, so I create a new .emacs with only this inside:
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
Restarting emacs, the package-list command shows a ton of melpa stuff in there (yay!). Including magit!
So I install that (version 20200820.227) by clicking on the Install button, then "Yes" when it asks for confirmation. Here is what happens at the end of the "Messages" buffer:
Wrote /home/tcarroll/.emacs.d/elpa/magit-20200820.227/magit-autoloads.el [2 times]
Loading async...done
Contacting host: melpa.org:80
error in process sentinel: async-handle-result: End of file during parsing
error in process sentinel: End of file during parsing
At this point magit is "installed" - and magit-status even works. But if I restart Emacs, running magit-status results in:
load-history-filename-element: Wrong type argument: stringp, (require . info)
...and I don't actually get any Git status.
Some output I get that I don't recall ever getting when starting Emacs 26.3:
Warning: game dir '/var/games/emacs': Permission denied
Loading loadup.el (source)...
dump mode: nil
Using load-path (/usr/share/emacs/27.1/site-lisp /usr/share/emacs/site-lisp /usr/share/emacs/27.1/lisp /usr/share/emacs/27.1/lisp/emacs-lisp /usr/share/emacs/27.1/lisp/progmodes /usr/share/emacs/27.1/lisp/language /usr/share/emacs/27.1/lisp/international /usr/share/emacs/27.1/lisp/textmodes /usr/share/emacs/27.1/lisp/vc)
Loading emacs-lisp/byte-run...
Loading emacs-lisp/byte-run...done
Loading emacs-lisp/backquote...
Several screenfuls of "Loading" this and that; I can include more if helpful. My speculation is that this has something to do with the new portable dumper?
There are a great many clean-shaven yaks in my vicinity (and the rest are scared). Trying to keep this from getting too long.
Adding new info at request:
openSUSE Tumbleweed update today to emacs. Still at version 27.1 but dated today:
GNU Emacs 27.1 (build 1, x86_64-suse-linux-gnu, GTK+ Version 3.24.22, cairo version 1.16.0) of 2020-08-25
Toggled on debugging via toggle-debug-on-error. Installation behavior nothing new, unfortunately; still
async-handle-result: End of file during parsing
Again, thanks for any help!
Turns out the /usr/bin/emacs is a script not a binary (old news to most of you, I'm sure) and it decides between different ways of invoking Emacs. For me, the key thing is that at the end it does this:
exec -a emacs /usr/bin/emacs-gtk
which causes Emacs to emit lots of messages about "Loading" this and that, including loadup.el, and finally not work properly with regard to packages (Org and Magit both affected, probably others).
When I invoke this instead:
/usr/bin/emacs-gtk
...I don't see any of those "Loading" messages. And Magit and Org both work fine.
From my limited understanding of this "exec -a" thng it seems that there "should" not be this difference in behavior, so maybe it is some dumb thing in my environment that I overlooked. But stuff works now.

Markdown-preview does't work in emacs markdown mode

Markdown preview command doesn't work.
I installed markdown-mode.el on emacs by using package-install.
Then I created test.md file as a trial. Syntax hi-lighting apparently works fine in the text.
When I used "C-c C-c p" command in order to show markdown preview, I got following error message in backtrace buffer. Even if I saved test.md file in current directory, it still said "No such file or directory". The file is located in "~/workspace/daily_log/test.md."
I tried "M-x markdown-preview" instead of shortcut key. But it doesn't work,too.
Do I make a mistake about usage of markdown-mode? Any help would be appreciated. Thanks in advance.
Error message in backtrace buffer
Debugger entered--Lisp error: (file-error "Searching for program" "No such file or directory" "bash.exe")
call-process-region(1 36 "bash.exe" "/tmp/emacsAxnXZ9" #<buffer *markdown-output*> nil "-c" "markdown")
shell-command-on-region(1 36 "markdown" "*markdown-output*")
markdown("*markdown-output*")
markdown-preview()
call-interactively(markdown-preview nil nil)
command-execute(markdown-preview)
my environment
OS: Ubuntu 14.10
emacs: 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.12.2)
markdown-mode: markdown-mode-20140914.1012/
If you inspect the backtrace you'll see that this has nothing to do with your Markdown file.
markdown-preview needs an external markdown command that can generate HTML. It looks like whatever Markdown processor you are using is trying to call bash.exe (not bash) when converting your file.
You might have installed some Windows-centric Markdown converter.
You might have customized markdown-command, directly or indirectly causing it to call bash.exe.
Since you are on Ubuntu, a simple apt-get install markdown should give you a decent Markdown that works with markdown-mode's markdown-preview function. After installing markdown at the system level, make sure that Emacs has markdown-command set to markdown (the default value).

Unable to evaluate form in nrepl + emacs

I have installed the nrepl, clojure-mode and starter-kit-lisp packages. I am able to start the nrepl by opening my .clj file and then M-x nrepl-jack-in.
However when I evaluate any form in my .clj file by C-x C-e, I get the following message:
inferior-lisp-proc: No Lisp subprocess; see variable `inferior-lisp-buffer'
How do I get it right?
I have had this problem a number of times. In all cases, it has been because while nrepl has started, the nrepl minor mode has not been enabled in the clj buffer. As a result, any evaluation attempts fail with this error.
There should be a "nrepl" menu item. If there isn't, this may be your problem. M-x nrepl-enable-on-existing-buffers should fix it.
I had this problem for a while, and now it appears to have gone away; you might want to try installing clojure-mode and nrepl afresh.
Are you sure M-x nrepl-jack-in worked? If it did, you should be prompted with a repl in emacs, like so:
nrepl requires leiningen 2, so make sure that you use the right version in your project and that the nrepl plugin is properly installed.
Also make sure that the major mode when editing your .clj file is clojure-mode.
You might want to post a screenshot to make it easier to spot the problem.

org mode refile error

Since some time (but I didn't change anything in .emacs), I have some errors with emacs's behaviour :
Remember mode will not kill the temporary buffer on "Ctl-C Ctl-C"
Orgmode will not refile any entry
Both operations complain with error "Not bookmark format"
I restored an old .emacs to make sure that I didn't mess it up but the error persists.
Where can I investigate to find out the problem ?
I have Emacs 24.2.1 since end of august.
The built in orgmode version is 7.8.11 (I see 7.9.2 is out ...)
It's always best to start debugging problems such as this by seeing if the problem still happens when you ignore your init file altogether - try starting emacs with --no-init-file and seeing if you still get the problem. If you don't then it's clearly something in your init file.
You can also get odd behaviour if you've got a local install of Org-mode in addition to the one bundled with Emacs itself - eg if you pull in a newer one through ELPA. If you have a local install through ELPA then you can try uninstalling the Org-mode package and trying again using the built-in Org-mode.
I have something similar to the following in my init file to make it switch to the ELPA-installed Org-mode to avoid such problems (this variant is untested so forgive me if it's not quite right):
(package-initialize) ; load and initialise ELPA-installed packages
(org-reload) ; restart Org-mode with the ELPA package
I filed a bug to the emacs team and they found out that the error comes from a corrupted bookmark file.
I removed my ~/.emacs.d/bookmark file (it was empty) and everything is fine now.

Emacs cache save error with cedet

Installed GNU Emacs 23.2.1 (i686-pc-linux-gnu) and I'm getting constant save errors. The following line is repeated over and over again with maybe 30sec intervals.
byte-code: Beginning of buffer [6 times]
Error Writing Table: #<semanticdb-table ctype.h>
Save Error: "\"Error in macro \\\"name\\\"\"": /home/user/.emacs.d/semanticdb/!usr!include!semantic.cache
Any useful tips as to why or maybe even a solution? Stripped my .emacs only to the following 2 lines but the problems still persists
(global-ede-mode 1)
(semantic-mode 1)
Tried deleting the cached files under the /sematicsdb/ folder but still the error pops up.
There is a macro somewhere in one of your header files that CEDET can't handle. Newer versions of CEDET (the one from the bzr repository on cedet.sf.net) work around the problem first by fixing some macro parsing problems, and secondarily by ignoring those problems during a save.
The newer version of CEDET that doesn't come with Emacs has a different install than what is in Emacs, but it should still work if you follow the installation instructions (which excludes 'semantic-mode').