From: Pierre Lorenzon <devel@pollock-nageoire.net>
To: 11585@debbugs.gnu.org
Subject: bug#11585: Acknowledgement (24.0.50; corrupted byte compiled files)
Date: Wed, 30 May 2012 10:49:17 +0200 (CEST) [thread overview]
Message-ID: <20120530.104917.276795662.devel@pollock-nageoire.net> (raw)
In-Reply-To: <20120530.100537.488385604.devel@pollock-nageoire.net>
[-- Attachment #1: Type: Text/Plain, Size: 95 bytes --]
OK here is how I suggest to rewrite the
`byte-compile-fix-header' function.
Regards
Pierre
[-- Attachment #2: bytcomp-fix-fix.el --]
[-- Type: Application/Octet-Stream, Size: 2147 bytes --]
(defun byte-compile-fix-header (filename)
"If the current buffer has any multibyte characters, insert a version test."
(when (< (point-max) (position-bytes (point-max)))
(goto-char (point-min))
;; Find the comment that describes the version condition.
(when (search-forward "\n;;; This file uses" nil t)
;; Maybe better to do nothing if this sttring is not
;; found.
(let ((beg (copy-marker (line-beginning-position))))
;; (narrow-to-region (line-beginning-position) (point-max))
;; ;; Find the first line of ballast semicolons.
(when (search-forward ";;;;;;;;;;" nil t)
;; As above if this string is not found header is
;; probably badly formated so better to do
;; nothing. Otherwise first killing the part of the
;; header we want to replace.
(kill-region beg (line-beginning-position))
;; Maybe not really necessary.
(goto-char beg)
;; (beginning-of-line)
;; (narrow-to-region (point-min) (point))
(let (;; (old-header-end (point))
(minimum-version "23")
;; delta
)
;; (delete-region (point-min) (point-max))
(insert
";;; This file contains utf-8 non-ASCII characters,\n"
";;; and so cannot be loaded into Emacs 22 or earlier.\n"
;; Have to check if emacs-version is bound so that this works
;; in files loaded early in loadup.el.
"(and (boundp 'emacs-version)\n"
;; If there is a name at the end of emacs-version,
;; don't try to check the version number.
" (< (aref emacs-version (1- (length emacs-version))) ?A)\n"
(format " (string-lessp emacs-version \"%s\")\n" minimum-version)
" (error \"`"
;; prin1-to-string is used to quote backslashes.
(substring (prin1-to-string (file-name-nondirectory filename))
1 -1)
(format "' was compiled for Emacs %s or later\"))\n\n"
minimum-version))
;; ;; Now compensate for any change in size, to make sure all
;; ;; positions in the file remain valid.
;; (setq delta (- (point-max) old-header-end))
;; (goto-char (point-max))
;; (widen)
;; (delete-char delta))))
))))))
next prev parent reply other threads:[~2012-05-30 8:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-30 6:57 bug#11585: 24.0.50; corrupted byte compiled files Pierre Lorenzon
[not found] ` <handler.11585.B.133836288230357.ack@debbugs.gnu.org>
2012-05-30 8:05 ` bug#11585: Acknowledgement (24.0.50; corrupted byte compiled files) Pierre Lorenzon
2012-05-30 8:49 ` Pierre Lorenzon [this message]
2012-05-30 14:45 ` bug#11585: 24.0.50; corrupted byte compiled files Chong Yidong
2012-05-30 15:28 ` Pierre Lorenzon
2012-05-30 15:24 ` Stefan Monnier
2012-05-30 15:31 ` Pierre Lorenzon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120530.104917.276795662.devel@pollock-nageoire.net \
--to=devel@pollock-nageoire.net \
--cc=11585@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).