* lisp/arc-mode.el (archive-copy-file): New command, keystroke and
menu bar entry (bug#26192).
(archive-extract): Refactored out code from here...
(archive--extract-file): ... to here for use in archive-copy-file.
The commands now also now work on archive and tar mode parent buffers.
* doc/emacs/files.texi (Image Mode): Document it.
* lisp/arc-mode.el (archive-goto-file): New function (bug#38647).
(archive-next-file-displayer): Ditto.
* lisp/image-mode.el (image-next-file): Reimplement to work on
displayed dired buffers and the like. This means that `n' and `p'
now works on the displayed ordering in the dired buffer, so if
you've reversed the sorting, `n' picks the right "next" file.
(image-mode--directory-buffers): New function.
(image-mode--next-file): Ditto.
* lisp/tar-mode.el (tar-goto-file): New function.
(tar-next-file-displayer): Ditto.
Add a new function, file-modes-number-to-symbolic.
Make archive-int-to-mode and obsolete alias of it; use it
to define tar-grind-file-mode (Bug#27952).
* lisp/files.el (file-modes-number-to-symbolic): New defun.
* lisp/arc-mode.el (archive-int-to-mode): Make it an obsolete alias.
* lisp/tar-mode.el (tar-grind-file-mode):
Use file-modes-number-to-symbolic.
* test/lisp/arc-mode-tests.el (arc-mode-test-archive-int-to-mode)
* test/lisp/tar-mode-tests.el (tar-mode-test-tar-grind-file-mode):
Update test.
* test/lisp/files-tests.el (files-tests-file-modes-symbolic-to-number)
(files-tests-file-modes-number-to-symbolic): New tests.
* doc/lispref/files.texi (Changing Files): Document the new funtion.
* etc/NEWS (Lisp Changes in Emacs 28.1): Announce it.
Found by relint. See discussion at
https://lists.gnu.org/archive/html/emacs-devel/2020-04/msg00265.html
* lisp/org/org-table.el (org-table-finish-edit-field):
* lisp/arc-mode.el (archive-rar-summarize):
Avoid wrapped subsumption in repeated sequences.
* lisp/erc/erc-dcc.el (erc-dcc-ctcp-query-send-regexp): Replace
inefficient repeated empty-matching expression with a plain greedy
form.
(erc-dcc-handle-ctcp-send): Adjust group numbers.
* lisp/net/puny.el (puny-encode-domain): Fix fast-path shortcut
pattern so that it actually works as intended.
* lisp/progmodes/gdb-mi.el (gdb-control-commands-regexp):
* lisp/vc/diff-mode.el (diff-imenu-generic-expression):
Remove superfluous backslashes.
* lisp/progmodes/scheme.el (scheme-imenu-generic-expression):
Correct confused definition-matching pattern which would match more
than intended.
* lisp/textmodes/sgml-mode.el (sgml-tag-name-re): Avoid inefficient
matching by using the fact that the first character cannot match the
last char of sgml-name-re.
Completely rewrite the code that displayes the summaries, so all
backends share the same code.
(archive--summarize-descs): New function.
(archive-arc-summarize, archive-lzh-summarize, archive-zip-summarize)
(archive-zoo-summarize, archive-rar-summarize, archive-7z-summarize)
(archive-ar-summarize): Use it.
(archive-hidden-columns): New custom.
(archive-alternate-hidden-columns): New const.
(archive-mode-map): Always enable `archive-alternate-display`.
(archive-alternate-display): Set `archive-hidden-columns`.
(archive-hideshow-column): New command.
(archive--fit, archive--fit2, archive--enabled-p): New aux functions.
(archive-file-list-start, archive-file-list-end)
(archive-proper-file-start, archive-file-name-indent, archive-remote)
(archive-member-coding-system, archive-alternate-display)
(archive-file-name-coding-system, archive-files): Use `defvar-local`.
(archive-extract): Use `setq-local`.
(archive-get-descr): Use `user-error` when clicking on a directory.
Add fields `size`, `time` (used by all backends) as well as
`pos`, `ratio`, `uid`, and `gid` (used only be some backends).
(archive-arc--file-desc, archive-rar--file-desc, archive-ar--file-desc)
(archive-lzh--file-desc, archive-zip--file-desc, archive-7z--file-desc):
Remove defstructs.
(archive-arc-summarize): Record size and time in the descrs.
(archive-lzh-summarize): Record size, time, uid, and gid in the descrs.
(archive-zip-summarize): Record size and time in the descrs.
(archive-zoo-summarize): Record size and time in the descrs.
(archive-rar-summarize): Adjust to use of `archive--file-desc`.
(archive-7z-summarize): Adjust to new constructor.
(archive-ar-summarize): Adjust to use of `archive--file-desc`.
(archive-ar-write-file-member): Remove mode-to-int hack.
(archive-get-descr): Directory entries aren't regular members.
(archive--file-desc): Remove `case-fiddled`.
Change all subtypes's constructors as their callers accordingly.
(archive--file-desc-case-fiddled): New function.
(archive-int-to-mode): Accept a nil input.
Make all callers take advantage of it.
(archive-arc-rename-entry): Use `make-string`.
(archive-zip--file-desc): Change `pos+len` field into `pos` field.
(archive-zip-chmod-entry): Simplify accordingly.
(archive-zip-summarize): Don't bother with `lheader` which was not used.
(archive-zoo--file-desc): Delete struct; use archive--file-desc instead.
(archive-7z--file-desc): Remove `user` and `group` fields.
Adjust constructor and its caller.
(archive-ar-summarize): Use `archive-int-to-mode`.
(archive-ar--name): New funtion, extracted from `archive-ar-summarize`.
(archive-ar-extract): Use it.
(archive-ar-summarize): Use it. Put the extname in the slot 0 of the
desc vectors.
(arc-insert-unibyte): Simplify.
(archive--mode-revert): Rename from `archive-mode-revert` and adjust
for use as an :around advice.
(archive-mode): Use setq-local. Use `add-function` to hook into
`revert-buffer-function`.
(archive-summarize): Don't use `set` on a hook.
* lisp/arc-mode.el (archive-zip-case-fiddle): Change the
default to nil except on MS-DOS. Update the doc string to
make clear that a non-nil value also affects updating the
archive. (Bug#38260)
* lisp/arc-mode.el (arc-insert-unibyte): Rename from
insert-unibyte, make into a function, and remove the superfluous
string-to-multibyte. Change callers throughout the file.
* lisp/arc-mode.el (byte-after): Remove defsubst.
Replace all calls to byte-after with get-byte throughout the file,
because byte-after gave compilation warnings.
* lisp/tar-mode.el (tar--try-jka-compr): New function copied from
archive-try-jka-compr.
* lisp/arc-mode.el (archive-try-jka-compr): Set buffer-multibyte to t
instead of let-binding coding-system-for-read to 'no-conversion.
* test/data/decompress/tg.tar.gz:
* test/data/decompress/zg.zip: New fixtures.
* test/lisp/arc-mode-tests.el (arc-mode-test-zip-extract-gz):
* test/lisp/tar-mode-tests.el (tar-mode-test-tar-extract-gz): New tests.
* test/lisp/vc/diff-mode-tests.el (diff-mode-test-font-lock)
(diff-mode-test-font-lock-syntax-one-line): Skip unless shell and
diff executables are found.
* doc/lispintro/emacs-lisp-intro.texi (Files List): Simplify.
* doc/lispref/os.texi (Time of Day): Mention format-time-string
as an alternative to current-time-string.
* lisp/arc-mode.el (archive-unixdate, archive-unixtime):
Port better to future versions of Emacs where (COUNT . HZ)
will take precedence to (HI . LO).
* lisp/arc-mode.el (archive-unixtime):
* lisp/calendar/todo-mode.el (todo-insert-item--basic)
(todo-item-done, todo-read-time):
Prefer format-time-string to substringing current-time-string.
* lisp/calc/calc-forms.el (calc-time, calcFunc-now):
Prefer decode-time to parsing the output of current-time-string.
* lisp/emacs-lisp/cl-extra.el (cl--random-time):
Prefer encode-time to hashing the output of current-time-string.
* lisp/gnus/gnus-score.el (gnus-score-headers)
(gnus-score-adaptive):
Avoid stringifying and then reparsing timestamp.
* src/timefns.c (Fencode_time): Omit redundant assignment.
I looked through all instances of most-negative-fixnum
and most-positive-fixnum in the Lisp source code, and
when it was easy I removed assumptions that integers
fit in fixnums. The remaining instances are either
nontrivial to fix, or are inherent to the algorithm.
* lisp/arc-mode.el (archive-l-e): Do not convert to float,
since we have bignums now. All uses changed.
* lisp/calc/calc.el (math-bignum):
Don’t special-case most-negative-fixnum.
* lisp/calendar/parse-time.el (parse-time-string):
* lisp/emacs-lisp/edebug.el (edebug-read-special):
* lisp/emacs-lisp/package.el (package--remove-hidden):
* lisp/gnus/nnfolder.el (nnfolder-read-folder):
* lisp/international/mule-util.el (filepos-to-bufferpos--dos):
* lisp/menu-bar.el (menu-bar-update-buffers):
* lisp/net/rcirc.el (rcirc-handler-317):
* lisp/org/org-agenda.el (org-cmp-ts):
* lisp/window.el (window--resize-child-windows):
Avoid arbitrary limit to most-positive-fixnum or to
most-negative-fixnum.
* lisp/calendar/time-date.el (days-to-time):
* lisp/erc/erc-dcc.el (erc-unpack-int):
Don’t worry about integer overflow.
* lisp/cedet/semantic/wisent/comp.el (wisent-BITS-PER-WORD):
* lisp/gnus/message.el (message-unique-id):
* lisp/org/org-footnote.el (org-footnote-new):
Simplify.
* lisp/erc/erc-dcc.el (erc-most-positive-int-bytes)
(erc-most-positive-int-msb): Remove; no longer needed.
* lisp/net/imap.el (imap-string-to-integer): Remove; unused.
* lisp/org/org-element.el (org-element--cache-generate-key):
Document fixnum limitation.
I audited use of lsh in the Lisp source code, and fixed the
glitches that I found. While I was at it, I replaced uses of lsh
with ash when either will do. Replacement is OK when either
argument is known to be nonnegative, or when only the low-order
bits of the result matter, and is a (minor) win since ash is a bit
more solid than lsh nowadays, and is a bit faster.
* lisp/calc/calc-ext.el (math-check-fixnum):
Prefer most-positive-fixnum to (lsh -1 -1).
* lisp/vc/vc-hg.el (vc-hg-state-fast): When testing fixnum width,
prefer (zerop (ash most-positive-fixnum -32)) to (zerop (lsh -1
32)) (Bug#32485#11).
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode):
Tighten sanity-check for bytecode overflow, by checking that the
result of (ash pc -8) is nonnegative. Formerly this check was not
needed since lsh was used and the number overflowed differently.
* lisp/net/dns.el (dns-write): Fix some obvious sign typos in
shift counts. Evidently this part of the code has never been
exercised.
* lisp/progmodes/hideif.el (hif-shiftleft, hif-shiftright):
* lisp/term/common-win.el (x-setup-function-keys):
Simplify.
* admin/unidata/unidata-gen.el, admin/unidata/uvs.el:
* doc/lispref/keymaps.texi, doc/lispref/syntax.texi:
* doc/misc/calc.texi, doc/misc/cl.texi, etc/NEWS.19:
* lisp/arc-mode.el, lisp/calc/calc-bin.el, lisp/calc/calc-comb.el:
* lisp/calc/calc-ext.el, lisp/calc/calc-math.el:
* lisp/cedet/semantic/wisent/comp.el, lisp/composite.el:
* lisp/disp-table.el, lisp/dos-fns.el, lisp/edmacro.el:
* lisp/emacs-lisp/bindat.el, lisp/emacs-lisp/byte-opt.el:
* lisp/emacs-lisp/bytecomp.el, lisp/emacs-lisp/cl-extra.el:
* lisp/erc/erc-dcc.el, lisp/facemenu.el, lisp/gnus/message.el:
* lisp/gnus/nndoc.el, lisp/gnus/nnmaildir.el, lisp/image.el:
* lisp/international/ccl.el, lisp/international/fontset.el:
* lisp/international/mule-cmds.el, lisp/international/mule.el:
* lisp/json.el, lisp/mail/binhex.el, lisp/mail/rmail.el:
* lisp/mail/uudecode.el, lisp/md4.el, lisp/net/dns.el:
* lisp/net/ntlm.el, lisp/net/sasl.el, lisp/net/socks.el:
* lisp/net/tramp.el, lisp/obsolete/levents.el:
* lisp/obsolete/pgg-parse.el, lisp/org/org.el:
* lisp/org/ox-publish.el, lisp/progmodes/cc-defs.el:
* lisp/progmodes/ebnf2ps.el, lisp/progmodes/hideif.el:
* lisp/ps-bdf.el, lisp/ps-print.el, lisp/simple.el:
* lisp/tar-mode.el, lisp/term/common-win.el:
* lisp/term/tty-colors.el, lisp/term/xterm.el, lisp/vc/vc-git.el:
* lisp/vc/vc-hg.el, lisp/x-dnd.el, test/src/data-tests.el:
Prefer ash to lsh when either will do.
to prevent directory time modification by lock_file on visiting
a file from archive. (Bug#30215)
(archive-summarize): Let-bind `create-lockfiles' to nil
instead of `buffer-file-truename'.
* lisp/arc-mode.el (archive-rar-summarize): Adjust parsing to
be more permissive.
The previous code would stop parsing if we had a directory entry or a
negative ratio as seen from the output of lsar on Debian jessie:
0. D---- 16221659 ----- Nr20 2005-12-24 19:30 foo/
4. ----- 466509 -0.0% Nr20 2005-12-24 19:19 foo/bar.jpg
Most of this change is to boilerplate commentary such as license URLs.
This change was prompted by ftp://ftp.gnu.org's going-away party,
planned for November. Change these FTP URLs to https://ftp.gnu.org
instead. Make similar changes for URLs to other organizations moving
away from FTP. Also, change HTTP to HTTPS for URLs to gnu.org and
fsf.org when this works, as this will further help defend against
man-in-the-middle attacks (for this part I omitted the MS-DOS and
MS-Windows sources and the test tarballs to keep the workload down).
HTTPS is not fully working to lists.gnu.org so I left those URLs alone
for now.