Pop-Up Thingie
Sidebar
Too Lazy BBS
Home
Forum
Files
Chat
Bulletins
Top doors
MOTD
BBS Stats
Radio
Dark
Register
Log in
Username
Password
Sidebar
Forum
USENET
gnu.emacs.help
Really strange problem with arc-mode.el
From
Jens Thiele
@karme@karme.de to
gnu.emacs.help
on Sat Oct 4 09:59:07 2025
From Newsgroup: gnu.emacs.help
Hi,
I want to add an archive format to emacs. It would work if the magic
bytes wouldn't start with "M" :-)
Now I tried to track down the problem and made up a fake archive format.
I have a test script that should complete without error:
;; testing a problem with archive-mode where the archive has a M as
;; first magic byte
(require 'arc-mode)
(defun archive-mv-summarize (&optional file)
(unless file
(setq file buffer-file-name))
(let ((copy (file-local-copy file))
(files ()))
(with-temp-buffer
(insert-file (or file copy))
(when copy (delete-file copy))
(goto-char (point-min))
(search-forward-regexp "^(")
(beginning-of-line)
(let ((alist (read (current-buffer))))
(mapc (lambda(x)
(let ((fname (symbol-name (car x)))
(fsize (string-width (cdr x))))
(push (archive--file-desc fname fname nil fsize
"1984-01-01 00:00")
files)))
alist)))
(archive--summarize-descs (nreverse files))))
;; unfortunately there is no hook => use advice-add
(defun archive-find-type-mv-around (oldfun)
(widen)
(goto-char (point-min))
;; NOTE: the problem only occurs if the magic bytes start with M
(cond ((looking-at "MV") 'mv)
(t (funcall oldfun))))
(advice-add 'archive-find-type :around #'archive-find-type-mv-around)
(add-to-list 'auto-mode-alist '("\\.mv$" . archive-mode))
(add-to-list 'auto-coding-alist '("\\.mv$" . no-conversion))
(with-temp-buffer
(insert "MV\n")
(insert "((a . \"foo\") (b . \"bar\"))\n")
(write-file "/tmp/test.mv"))
(with-current-buffer (find-file-noselect "/tmp/test.mv" nil nil nil)
(revert-buffer))
But running it like this:
$ emacs -nw -Q --no-init --script ./arc-mv.el
It fails with:
Buffer format not recognized
NOTE!: if you change the magic bytes from "MV" to something like "EV" it
works as expected.
I would really appreciate some help there, thanks!
Jens Thiele
--- Synchronet 3.21a-Linux NewsLink 1.2
From
Jens Thiele
@karme@karme.de to
gnu.emacs.help
on Mon Oct 6 09:18:10 2025
From Newsgroup: gnu.emacs.help
this has been covered in bug#79574
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=79574
thanks!
Jens
--- Synchronet 3.21a-Linux NewsLink 1.2
Who's Online
System Info
Sysop:
Amessyroom
Location:
Fayetteville, NC
Users:
59
Nodes:
6 (
0
/
6
)
Uptime:
00:11:43
Calls:
810
Files:
1,287
Messages:
196,936