commit 394f1269d106d6ed641b8491101e18aa225beb1a (HEAD, refs/remotes/origin/master) Author: Werner Lemberg Date: Thu Oct 22 07:27:45 2020 +0200 Update TUTORIAL.de This also includes the minor fix for bug #44123. diff --git a/etc/tutorials/TUTORIAL.de b/etc/tutorials/TUTORIAL.de index 75c03a18e4..f1461563c1 100644 --- a/etc/tutorials/TUTORIAL.de +++ b/etc/tutorials/TUTORIAL.de @@ -19,15 +19,22 @@ EDIT oder ALT genannt). Folgende Abkürzungen werden verwendet: <> [Leerzeilen befinden sich hier aus didaktischen Gründen. Fortsetzung unten.] >> Drücken Sie C-v, um zur nächsten Bildschirmseite vorzublättern. - Ab jetzt sollten Sie das stets tun, wenn Sie eine Seite fertig - gelesen haben. + Ab jetzt sollten Sie das stets tun, wenn Sie das untere + Bildschirmende erreicht haben. Beachten Sie bitte, dass beim Blättern die untersten zwei Zeilen der vorigen Bildschirmseite als die zwei obersten Zeilen der neuen Seite erscheinen, um eine gewisse Kontinuität während des Lesens zu ermöglichen. +Was Sie gerade lesen, ist eine leicht angepasste Kopie der deutschen +Einführung. Später werden Sie aufgefordert, verschiedene Befehle +auszuführen, um den Text der Einführung zu ändern. Es spielt keine +Rolle, wenn Sie den Text schon vorher ändern sollten – man nennt das +»editieren«, und genau dafür ist ein Editor wie Emacs da. + Wichtig: Sie können Emacs mit der Befehlsfolge C-x C-c beenden. +Diese Einführung beenden Sie mit C-x k, gefolgt von der Eingabetaste. Im weiteren wird die ESC-Taste mit bezeichnet. @@ -41,7 +48,7 @@ Sie schon (C-v). Mit M-v blättern Sie eine Bildschirmseite zurück (halten Sie die META-Taste gedrückt und geben Sie v ein, oder drücken Sie zuerst und anschließend v). ->> Probieren Sie einige Male M-v und C-v aus. +>> Probieren Sie einige Male M-v und C-v aus. [Auf den meisten Tastaturen bewirkt die PgUp-Taste (»page up«, auch mit »Bild« und einem Aufwärtspfeil beschriftet) dasselbe wie M-v bzw. @@ -277,14 +284,14 @@ Wert, signalisiert dem Befehl, etwas anderes zu tun. C-v und M-v sind weitere Ausnahmen. Gibt man diesen Befehlen einen Parameter n, dann verschieben sie den Bildschirminhalt nicht um eine -ganze Bildschirmseite, sondern um n Zeilen. Beispiel: C-u 4 C-v -verschiebt den Bildschirminhalt um vier Zeilen. +ganze Bildschirmseite, sondern um n Zeilen. Beispiel: C-u 8 C-v +verschiebt den dargestellten Text um acht Zeilen. >> Versuchen Sie jetzt C-u 8 C-v auszuführen. -Der Bildschirminhalt sollte jetzt um acht Zeilen nach oben verschoben -sein. Wollen Sie ihn nach unten verschieben, dann geben Sie M-v mit -einem numerischen Argument ein. +Der Text sollte jetzt um acht Zeilen nach oben verschoben sein. +Wollen Sie ihn nach unten verschieben, dann geben Sie M-v mit einem +numerischen Argument ein. Wenn Sie eine graphische Oberfläche wie X oder MS-Windows verwenden, dann befindet sich ein schmaler, langgezogener rechteckiger Bereich @@ -411,12 +418,12 @@ Fortsetzungszeile. >> Geben Sie ein, um wieder ein Zeilenvorschubzeichen einzufügen. -Die -Taste ist insofern besonders, als dass sie mehr bewirken -kann, als einfach ein Zeilenvorschubszeichen einzufügen. Abhängig vom -umgebenden Text können zusätzliche Leerzeichen eingefügt werden, damit -der neue Zeilenanfang bündig zur vorherigen Zeile ist. Wir nennen -dieses Verhalten (wenn das Drücken einer Taste mehr bewirkt, als nur -das entsprechende Zeichen einzufügen) »electric«. +Die -Taste ist besonders, da sie mehr bewirken kann als +einfach ein Zeilenvorschubzeichen einfügen. Abhängig vom umgebenden +Text können zusätzliche Leerzeichen eingefügt werden, damit der neue +Zeilenanfang bündig zur vorherigen Zeile ist. Wir nennen dieses +Verhalten (wenn das Drücken einer Taste mehr bewirkt, als nur das +entsprechende Zeichen einzufügen) »electric«. >> Ein Beispiel für dieses Verhalten von . Drücken Sie am Ende dieser Zeile. @@ -468,7 +475,7 @@ gelöschten Text, damit Sie ihn bei Bedarf wieder zurückholen können. Einfügen von bereits gelöschtem Text wird im englischen Dokumentation von Emacs als »yanking« (wörtlich »herausreißen«) bezeichnet. Sie können den gelöschten Text an einer beliebigen Stelle wieder -einzufügen. Solange Sie nichts neues löschen, steht Ihnen dieser +einfügen. Solange Sie nichts neues löschen, steht Ihnen dieser gelöschte Textteil immer wieder zu Verfügung. Der Befehl dazu ist C-y (das Ypsilon steht für »yank«). @@ -584,9 +591,11 @@ Anzahl der notwendigen C-/-Befehle zu reduzieren. >> Löschen Sie diese Zeilen mit C-k und drücken Sie anschließend mehrmals C-/, und die Zeilen erscheinen wieder. -Alternative Tastenkombinationen für C-/ sind C-_ und C-x u. Ein -numerisches Argument für C-/, C-_ oder C-x u wird als -Wiederholungszähler interpretiert. +Alternative Tastenkombinationen für C-/ sind C-_ und C-x u (in manchen +Terminals funktioniert C-_ auch ohne SHIFT-Taste). Wählen Sie das +aus, was am bequemsten für Sie zu tippen ist. Ein numerisches +Argument für C-/, C-_ oder C-x u wird als Wiederholungszähler +interpretiert. Der Unterschied zwischen der Undo-Funktion und dem oben erklärten C-y ist, dass erstere gelöschten Text an exakt der gleichen Position wie @@ -668,10 +677,7 @@ Name besteht aus dem Originalnamen plus einer angehängten Tilde »~« Namenserweiterung durch ».bak« ersetzt]. Emacs schreibt den Namen der gesicherten Datei in die unterste Zeile, -sobald C-x C-s fertig ausgeführt ist. Sie sollten den editierten Text -oft speichern, damit nicht allzuviel bei einem etwaigen Systemabsturz -verloren geht (siehe auch den Abschnitt »AUTOMATISCHES SPEICHERN« -weiter unten). +sobald C-x C-s fertig ausgeführt ist. >> Geben Sie @@ -715,12 +721,11 @@ ein. >> Probieren Sie jetzt C-x C-b. -Beachten Sie, dass jeder Puffer einen Namen hat und manche auch mit -dem Namen einer Datei assoziiert sind, dessen Inhalt sie enthalten. -Manche Puffer aber haben keinen zugehörige Datei, z.B. der mit dem -Namen »*Buffer List*«. Er wurde von dem Befehl C-x C-b erzeugt, um -die Pufferliste darzustellen. JEDER Text, den Sie innerhalb Emacs in -einem Fenster sehen, ist immer ein Ausschnitt eines Puffers. +Beachten Sie, dass manche Puffer keine zugehörige Datei haben, +z.B. der mit dem Namen »*Buffer List*«. Er wurde von dem Befehl C-x +C-b erzeugt, um die Pufferliste darzustellen. JEDER Text, den Sie +innerhalb Emacs in einem Fenster sehen, ist immer ein Ausschnitt eines +Puffers. >> Geben Sie jetzt C-x 1 ein, um die Pufferliste wieder verschwinden zu lassen. @@ -748,13 +753,11 @@ den Verzeichnispräfix), jedoch nicht immer. Die von C-x C-b erzeugte Pufferliste zeigt stets die Namen aller Puffer mit den korrespondierenden Dateinamen. -JEDER Text in Emacs ist Teil eines Puffers, aber nicht jeder Puffer -entspricht einer Datei. So ist z.B. der Puffer »*Buffer List*« mit -keiner Datei assoziiert -- er wurde direkt von dem Befehl C-x C-b -erzeugt. Auch dieser »TUTORIAL.de«-Puffer war anfangs keiner Datei -zugeordnet, jetzt allerdings schon, denn Sie haben im letzten -Abschnitt den Befehl C-x C-s eingegeben und so den Pufferinhalt als -Datei gespeichert. +Wie schon erwähnt, ist JEDER Text in Emacs Teil eines Puffers, aber +nicht jeder Puffer entspricht einer Datei. Auch dieser +»TUTORIAL.de«-Puffer war anfangs keiner Datei zugeordnet, jetzt +allerdings schon, denn Sie haben im letzten Abschnitt den Befehl C-x +C-s eingegeben und so den Pufferinhalt als Datei gespeichert. Der Puffer »*Messages*« hat ebenfalls keine Entsprechung als Datei; er enthält alle Mitteilungen, die in der untersten Zeile während des @@ -774,10 +777,10 @@ Datei permanent abzuspeichern. Es wäre äußerst umständlich, müsste man jedesmal C-x C-f eingeben, um den Puffer dann mit C-x C-s abzuspeichern. Daher gibt es den Befehl - C-x s (sichere mehrere Puffer) + C-x s (sichere mehrere Puffer in Dateien) -Dieser Befehl fragt Sie bei jedem Puffer, der Änderungen enthält, ob -Sie ihn speichern wollen. +Dieser Befehl fragt Sie bei jedem einer Datei zugeordneten Puffer, der +Änderungen enthält, ob Sie ihn in der Datei speichern wollen. >> Fügen Sie eine Textzeile ein und drücken Sie dann C-x s. Emacs fragt Sie jetzt, ob Sie einen Puffer mit dem Namen @@ -824,15 +827,15 @@ zu Emacs zurückzukehren. Der beste Zeitpunkt für C-x C-c ist, wenn Sie sich ausloggen (bzw. Ihren Computer ausschalten); Sie sollten Emacs ebenfalls -beenden, wenn Sie Emacs von einem anderen Programm aus aufgerufen -haben (z.B. einem Programm, das E-mails liest). +beenden, wenn Sie Emacs von einem anderen Programm aus kurzzeitig +aufgerufen haben (z.B. einem Programm, das E-Mails liest). Hier ist eine Liste aller C-x-Befehle, die Sie bereits kennengelernt haben: C-x C-f lade Datei - C-x C-s sichere Datei - C-x s sichere einige Puffer + C-x C-s sichere Puffer in Datei + C-x s sichere einige Puffer in zugehörige Dateien C-x C-b zeige Pufferliste an C-x b wechsle zu Puffer C-x C-c beende Emacs @@ -840,10 +843,10 @@ haben: C-x u widerrufen Ein Beispiel für einen Befehl mit langen Namen ist replace-string, der -global (also in der ganzen Datei bzw. Puffer) eine Zeichenkette durch -eine andere ersetzt. Wenn Sie M-x drücken, dann fragt Sie Emacs in -der untersten Bildschirmzeile nach dem Namen des Befehls (in diesem -Fall »replace-string«). Geben Sie jetzt »repl s« ein und Emacs +in der ganzen Datei bzw. Puffer eine Zeichenkette durch eine andere +ersetzt. Wenn Sie M-x drücken, dann fragt Sie Emacs in der untersten +Bildschirmzeile nach dem Namen des Befehls (in diesem Fall +»replace-string«). Geben Sie jetzt »repl s« ein und Emacs vervollständigt den Namen. Schließen Sie die Eingabe mit ab. [ bezeichnet die Tabulatortaste.] @@ -855,7 +858,7 @@ vervollständigt den Namen. Schließen Sie die Eingabe mit ab. ein und kehren Sie mit C-u C-SPC an diese Position zurück. Beachten Sie wie diese Bildschirmzeile jetzt aussieht: Sie haben - den Wortteil B-i-l-d-s-c-h-i-r-m durch »Text« ersetzt (und zwar im + den Wortteil »Bildschirm« durch »Text« ersetzt (und zwar im ganzen Dokument beginnend von der Cursorposition). >> Drücken Sie jetzt C-x u, um diese Änderungen auf einmal rückgängig @@ -878,8 +881,8 @@ Stürzt der Rechner einmal wirklich ab, können Sie die Änderungen, die beim letzten Auto-Save gespeichert worden sind, folgendermaßen wiederherstellen: Laden Sie die Datei auf normalem Wege (die Datei, die Sie bearbeitet haben, nicht die Auto-Save-Datei) und geben Sie -dann »M-x recover-file « ein. Wenn Emacs Sie um Bestätigung -fragt, antworten Sie mit »yes «, um den Inhalt der +dann »M-x recover-this-file « ein. Wenn Emacs Sie um +Bestätigung fragt, antworten Sie mit »yes «, um den Inhalt der Auto-Save-Datei zu übernehmen. @@ -979,6 +982,7 @@ jeweils ein bisschen anders. Dokumentation zum derzeit aktuellen Hauptmodus bekommen Sie mit C-h m. +>> Bewegen Sie den Cursor zur nächsten Zeile. >> Drücken Sie C-l C-l, um diese Zeile an den oberen Bildschirmrand zu bringen. >> Lesen Sie nun mittels C-h m die englische Dokumentation zum @@ -1129,13 +1133,13 @@ Rechteck dargestellt). Alle normalen Editierbefehle betreffen das Fenster, in dem sich der Cursor befindet. Wir nennen dieses Fenster »ausgewählt« (»selected window«). -Der Befehl M-C-v ist sehr nützlich, wenn man Text in einem Fenster +Der Befehl C-M-v ist sehr nützlich, wenn man Text in einem Fenster editiert und das andere Fenster als Referenz verwendet. Ohne das -momentante Arbeitsfenster verlassen zu müssen, kann man mit M-C-v im +momentante Arbeitsfenster verlassen zu müssen, kann man mit C-M-v im anderen Fenster bequem vorwärtsblättern. -M-C-v ist ein Beispiel eines CONTROL-META-Zeichens. Haben Sie eine -META-Taste, dann kann man M-C-v erzeugen, indem man CTRL und META +C-M-v ist ein Beispiel eines CONTROL-META-Zeichens. Haben Sie eine +META-Taste, dann kann man C-M-v erzeugen, indem man CTRL und META gleichzeitig niedergedrückt hält, während man v eintippt. Es ist egal, ob zuerst CTRL oder META niedergedrückt wird, da beide Tasten gleichberechtigt das jeweils einzugebende Zeichen modifizieren. @@ -1146,10 +1150,10 @@ gefolgt von CTRL-v. CTRL-ESC v funktioniert nicht! Der Grund dafür ist, dass ESC ein eigenes Zeichen ist und keine Modifizier-Taste wie META oder CTRL. -Der umgekehrte Befehl zu M-C-v ist M-C-S-v, um im anderen Fenster -rückwärts zu blättern (d.h., Sie müssen die META-Taste sowie die -CONTROL- und SHIFT-Taste zusammen mit »v« betätigen) -- jetzt werden -Sie wahrscheinlich verstehen, warum manche Kritiker das Wort Emacs als +Der umgekehrte Befehl zu C-M-v ist C-M-S-v, um im anderen Fenster +rückwärts zu blättern (d.h., Sie müssen die CONTROL-Taste sowie die +META- und SHIFT-Taste zusammen mit »v« betätigen) -- jetzt werden Sie +wahrscheinlich verstehen, warum manche Kritiker das Wort Emacs als Abkürzung von Escape-Meta-Alt-Control-Shift betrachten. Leider funktioniert diese Befehlsfolge normalerweise nur mit graphischen Oberflächen, da C-v von C-S-v auf den meisten Textterminals nicht @@ -1196,7 +1200,7 @@ Textterminal kann genau ein Rahmen dargestellt werden. >> Geben Sie - M-x make-frame + C-x 5 2 ein, um einen neuen Rahmen zu erzeugen. @@ -1206,7 +1210,7 @@ gleichwertig. >> Geben Sie - M-x delete-frame + C-x 5 0 ein, um den ausgewählten Rahmen zu entfernen. @@ -1343,7 +1347,7 @@ zwar für die Tastatur- und Bildschirmkodierung.] Wir haben uns bemüht, in dieser Einführung genau soviel Information zu geben, dass Sie beginnen können, mit Emacs zu arbeiten. Emacs ist jedoch so mächtig und umfangreich, dass es den Rahmen einer Einführung -spränge, an dieser Stelle mehr zu erklären. Um Sie im weiteren +sprengte, an dieser Stelle mehr zu erklären. Um Sie im weiteren Lernverlauf zu unterstützen, stellt Emacs eine Reihe von Hilfe-Funktionen zu Verfügung, die alle mit dem Präfix C-h (dem Hilfe-Zeichen, »Help character«) beginnen. @@ -1424,18 +1428,44 @@ zugehörigen langen Namen, find-file. >> Schließen Sie das Hilfefenster mit C-x 1. - C-h i Dieser Befehl öffnet einen speziellen Puffer, um - Handbücher zu lesen (im »Info«-Format), die auf dem + C-h i Dieser Befehl öffnet einen speziellen Puffer »*info*«, + um Handbücher zu lesen (im »Info«-Format), die auf dem verwendeten Computersystem installiert sind. Geben Sie z.B. m emacs ein, um das Emacs-Handbuch zu lesen. Haben Sie »Info« noch nie benutzt, tippen - Sie ?, und Emacs führt Sie Schritt für Schritt durch + Sie h, und Emacs führt Sie Schritt für Schritt durch die Möglichkeiten des Info-Modus. Wenn Sie diese Einführung fertiggelesen haben, sollten Sie das Info-Handbuch für Emacs als primäre Dokumentation benutzen. +* MEHR FEATURES +--------------- + +Sie können mehr über Emacs lernen, in dem Sie das Handbuch lesen, +entweder in der gedruckten Form oder innerhalb von Emacs (benützen Sie +dazu das Hilfe-Menu oder tippen Sie C-h r). Zwei besonders nützliche +Features sind Vervollständigung, um weniger tippen zu müssen, und +Dired, um das Laden von Dateien zu vereinfachen. + +Das Vervollständigungs-Feature ist eine Methode, um unnötiges Eingeben +von Zeichen zu vermeiden. Wenn Sie beispielsweise zum +»*Messages*«-Puffer umschalten wollen, genügt C-x b *M, und Emacs +ergänzt automatisch den Namen des Puffers, soweit das anhand der +bisherigen Eingabe möglich ist. Vervollständigung funktioniert auch +für Befehls- und Dateinamen. Eine genaue Beschreibung finden Sie im +Abschnitt »Completion« des Emacs-Handbuchs. + +Dired ermöglicht es, Dateien eines Verzeichnisses (auf Wunsch +inklusive seiner Unterverzeichnisse) aufzulisten, sich innerhalb der +Liste zu bewegen, Dateien zu besuchen, umzubenennen, zu löschen u.a. +Eine genaue Beschreibung finden Sie im Abschnitt »Dired« des +Emacs-Handbuchs. + +Viele weitere Features sind ebenfalls im Handbuch beschrieben. + + * SCHLUSSBEMERKUNG ------------------ commit 8dc8ab6b42b021f9796e59cfdb758b48aaf55ffc Author: Štěpán Němec Date: Mon Apr 6 17:05:33 2020 +0200 unload-feature: Correct doc string to match info manual and reality 'unload-feature' doesn't try to "undo any additions the library has made" to hooks, it tries to remove functions defined by the library from hooks, no matter how they got there. * lisp/loadhist.el (unload-feature): Correct the doc string. * doc/lispref/loading.texi (Unloading): Clarify, fix typo. diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi index aa6ef307b1..e5364152d5 100644 --- a/doc/lispref/loading.texi +++ b/doc/lispref/loading.texi @@ -1063,7 +1063,7 @@ It then restores any autoloads formerly associated with those symbols. (Loading saves these in the @code{autoload} property of the symbol.) Before restoring the previous definitions, @code{unload-feature} runs -@code{remove-hook} to remove functions in the library from certain +@code{remove-hook} to remove functions defined by the library from certain hooks. These hooks include variables whose names end in @samp{-hook} (or the deprecated suffix @samp{-hooks}), plus those listed in @code{unload-feature-special-hooks}, as well as @@ -1071,7 +1071,7 @@ hooks. These hooks include variables whose names end in @samp{-hook} function because important hooks refer to functions that are no longer defined. -Standard unloading activities also undoes ELP profiling of functions +Standard unloading activities also undo ELP profiling of functions in that library, unprovides any features provided by the library, and cancels timers held in variables defined by the library. diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 81576679c3..8ac575e8e3 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -234,11 +234,10 @@ If the feature is required by any other loaded code, and prefix arg FORCE is nil, raise an error. Standard unloading activities include restoring old autoloads for -functions defined by the library, undoing any additions that the -library has made to hook variables or to `auto-mode-alist', undoing -ELP profiling of functions in that library, unproviding any features -provided by the library, and canceling timers held in variables -defined by the library. +functions defined by the library, removing such functions from +hooks and `auto-mode-alist', undoing their ELP profiling, +unproviding any features provided by the library, and canceling +timers held in variables defined by the library. If a function `FEATURE-unload-function' is defined, this function calls it with no arguments, before doing anything else. That function commit 5c266a71c160ed823e9ef69d2ff44fb0bb81ff77 Author: Štěpán Němec Date: Mon Apr 6 13:30:11 2020 +0200 unload-feature: Handle local hooks (bug#5293) Buffer-local hooks were introduced in 1994-09-30T20:47:13+00:00!rms@gnu.org 0e4d378b32 (add-hook): Initialize default value and local value. but 'unload-feature' has not been updated to handle them. * lisp/loadhist.el (unload-feature): Handle local hooks (bug#5293). diff --git a/etc/NEWS b/etc/NEWS index f3e3d9a1b6..2aed575159 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1748,6 +1748,9 @@ to lexical binding, where dynamic (special) variables bound in one file can affect code in another. For details, see the manual section '(Elisp) Converting to Lexical Binding'. +--- +** 'unload-feature' now also tries to undo additions to buffer-local hooks. + * Changes in Emacs 28.1 on Non-Free Operating Systems diff --git a/lisp/loadhist.el b/lisp/loadhist.el index 60da00cceb..81576679c3 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -300,6 +300,15 @@ something strange, such as redefining an Emacs function." (memq x unload-feature-special-hooks))) (dolist (func removables) (remove-hook x func))))) + (save-current-buffer + (dolist (buffer (buffer-list)) + (pcase-dolist (`(,sym . ,val) (buffer-local-variables buffer)) + (when (or (and (consp val) + (string-match "-hooks?\\'" (symbol-name sym))) + (memq sym unload-feature-special-hooks)) + (set-buffer buffer) + (dolist (func removables) + (remove-hook sym func t)))))) ;; Remove any feature-symbols from auto-mode-alist as well. (dolist (func removables) (setq auto-mode-alist commit 0e9e36747f060a52ce4ecbf48eeb8421d4a19c68 Author: Štěpán Němec Date: Mon Apr 6 13:25:41 2020 +0200 unload-feature: Improve logic (don't repeat computation) * lisp/loadhist.el (unload-feature): Don't do the same computation twice. diff --git a/lisp/loadhist.el b/lisp/loadhist.el index a1ff2f6270..60da00cceb 100644 --- a/lisp/loadhist.el +++ b/lisp/loadhist.el @@ -287,22 +287,23 @@ something strange, such as redefining an Emacs function." ;; functions which the package might just have installed, and ;; there might be other important state, but this tactic ;; normally works. - (mapatoms - (lambda (x) - (when (and (boundp x) - (or (and (consp (symbol-value x)) ; Random hooks. - (string-match "-hooks?\\'" (symbol-name x))) - (memq x unload-feature-special-hooks))) ; Known abnormal hooks etc. - (dolist (y unload-function-defs-list) - (when (and (eq (car-safe y) 'defun) - (not (get (cdr y) 'autoload))) - (remove-hook x (cdr y))))))) - ;; Remove any feature-symbols from auto-mode-alist as well. - (dolist (y unload-function-defs-list) - (when (and (eq (car-safe y) 'defun) - (not (get (cdr y) 'autoload))) - (setq auto-mode-alist - (rassq-delete-all (cdr y) auto-mode-alist))))) + (let ((removables (cl-loop for def in unload-function-defs-list + when (and (eq (car-safe def) 'defun) + (not (get (cdr def) 'autoload))) + collect (cdr def)))) + (mapatoms + (lambda (x) + (when (and (boundp x) + (or (and (consp (symbol-value x)) ; Random hooks. + (string-match "-hooks?\\'" (symbol-name x))) + ;; Known abnormal hooks etc. + (memq x unload-feature-special-hooks))) + (dolist (func removables) + (remove-hook x func))))) + ;; Remove any feature-symbols from auto-mode-alist as well. + (dolist (func removables) + (setq auto-mode-alist + (rassq-delete-all func auto-mode-alist))))) ;; Change major mode in all buffers using one defined in the feature being unloaded. (unload--set-major-mode) commit 4bd8add2e3cc668c04b634e8d5a915c7d6803e17 Author: Mattias Engdegård Date: Wed Oct 21 18:15:14 2020 +0200 Convert artist.el to lexical binding * lisp/textmodes/artist.el (artist-system, (artist-flood-fill): Remove binding of the obsolete variables binary-process-input, binary-process-output and input-queue. (artist-down-mouse-1): Fix mistyped 'echo-keystrokes'; bind it to 0. (artist-fill-rect, artist-fill-square, artist-pen-set-arrow-points) (artist-spray-clear-circle, artist-spray-set-radius) (artist-draw-ellipse-with-0-height, artist-fill-ellipse) (artist-ff-is-topmost-line, artist-ff-is-bottommost-line) (artist-set-arrow-points-for-2points, artist-key-undraw-continously) (artist-key-undraw-poly, artist-key-undraw-1point) (artist-key-undraw-2points, artist-key-do-continously-1point) (artist-key-set-point-1point, artist-shift-has-changed) (artist-mouse-draw-continously, artist-mouse-draw-1point) (artist-submit-bug-report): Suppress warnings about unused parameters which are there for function signature commonality. Remove unused variables. diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el index e98072c11f..5ce9a90ea6 100644 --- a/lisp/textmodes/artist.el +++ b/lisp/textmodes/artist.el @@ -1,4 +1,4 @@ -;;; artist.el --- draw ascii graphics with your mouse +;;; artist.el --- draw ascii graphics with your mouse -*- lexical-binding: t -*- ;; Copyright (C) 2000-2020 Free Software Foundation, Inc. @@ -1844,9 +1844,7 @@ Return a list (RETURN-CODE STDOUT STDERR)." nil)) (tmp-stdout-buffer (get-buffer-create (concat "*artist-" program "*"))) - (tmp-stderr-file-name (make-temp-file "artist-stdout.")) - (binary-process-input nil) ; for msdos - (binary-process-output nil)) + (tmp-stderr-file-name (make-temp-file "artist-stdout."))) ;; Prepare stdin (if stdin (artist-string-to-file stdin tmp-stdin-file-name)) @@ -2721,7 +2719,7 @@ SHAPE-INFO is a list of four straight lines." ;; Filling rectangles and squares ;; -(defun artist-fill-rect (rect x1 y1 x2 y2) +(defun artist-fill-rect (_rect x1 y1 x2 y2) "Fill rectangle RECT from X1,Y1 to X2,Y2." (let ((x (1+ (min x1 x2))) (y (1+ (min y1 y2))) @@ -2733,7 +2731,7 @@ SHAPE-INFO is a list of four straight lines." (artist-replace-chars artist-fill-char w) (setq y (1+ y)))))) -(defun artist-fill-square (square x1 y1 x2 y2) +(defun artist-fill-square (_square x1 y1 x2 y2) "Fill a SQUARE from X1,Y1 to X2,Y2." (let* ((square-corners (artist-rect-corners-squarify x1 y1 x2 y2)) (new-x1 (elt square-corners 0)) @@ -2795,7 +2793,7 @@ to append to the end of the list, when doing free-hand drawing)." (setq artist-key-poly-point-list (list (cons x1 y1)))) -(defun artist-pen-set-arrow-points (x1 y1) +(defun artist-pen-set-arrow-points (_x1 _y1) "Set arrow points for pen drawing using X1, Y1. Also, the `artist-key-poly-point-list' is reversed." @@ -2996,11 +2994,11 @@ Returns a list of points. Each point is on the form (X1 . Y1)." ;; Step to next spray point (setq spray-points (cdr spray-points))))) -(defun artist-spray-clear-circle (circle x1 y1 x2 y2) +(defun artist-spray-clear-circle (circle _x1 _y1 _x2 _y2) "Clear circle CIRCLE at X1, Y1 through X2, Y2." (artist-undraw-circle circle)) -(defun artist-spray-set-radius (circle x1 y1 x2 y2) +(defun artist-spray-set-radius (_circle x1 y1 x2 y2) "Set spray radius from CIRCLE at X1, Y1 through X2, Y2." (let ((dx (- x2 x1)) (dy (- y2 y1))) @@ -3493,8 +3491,7 @@ POINT-LIST is a list of vectors on the form [X Y SAVED-CHAR NEW-CHAR]. FILL-INFO is a list of vectors on the form [X Y ELLIPSE-WIDTH-ON-THIS-LINE]. The Y-RADIUS must be 0, but the X-RADIUS must not be 0." - (let ((point-list nil) - (width (max (- (abs (* 2 x-radius)) 1))) + (let ((width (max (- (abs (* 2 x-radius)) 1))) (left-edge (1+ (- x1 (abs x-radius)))) (line-char (if artist-line-char-set artist-line-char ?-)) (i 0) @@ -3602,7 +3599,7 @@ FILL-INFO is a list of vectors on the form [X Y ELLIPSE-WIDTH-ON-THIS-LINE]." ; ; Filling ellipses ; -(defun artist-fill-ellipse (ellipse x y x-radius y-radius) +(defun artist-fill-ellipse (ellipse _x _y _x-radius _y-radius) "Fill an ELLIPSE centered at X,Y with radius X-RADIUS and Y-RADIUS." (let ((fill-info (aref (artist-2point-get-shapeinfo ellipse) 1))) (mapcar @@ -3722,11 +3719,11 @@ original contents of that area in the buffer." (setq x (1+ x))) last-x))) -(defun artist-ff-is-topmost-line (x y) +(defun artist-ff-is-topmost-line (_x y) "Determine whether the position X,Y is on the topmost line or not." (= y 0)) -(defun artist-ff-is-bottommost-line (x y) +(defun artist-ff-is-bottommost-line (_x y) "Determine whether the position X,Y is on the bottommost line or not." (save-excursion (goto-char (point-max)) @@ -3742,7 +3739,6 @@ original contents of that area in the buffer." (defun artist-flood-fill (x1 y1) "Flood-fill starting at X1, Y1. Fill with the char in `artist-fill-char'." (let ((stack nil) - (input-queue nil) ;; We are flood-filling the area that has this character. (c (artist-get-char-at-xy-conv x1 y1)) (artist-fill-char (if artist-fill-char-set @@ -3884,7 +3880,7 @@ Optional argument STATE can be used to set state (default is nil)." (setq artist-arrow-point-2 (artist-make-arrow-point xn yn dirn)))) -(defun artist-set-arrow-points-for-2points (shape x1 y1 x2 y2) +(defun artist-set-arrow-points-for-2points (shape _x1 _y1 _x2 _y2) "Generic function for setting arrow-points for 2-point shapes. The 2-point shape SHAPE is drawn from X1, Y1 to X2, Y2." (let* ((endpoint1 (artist-2point-get-endpoint1 shape)) @@ -3906,28 +3902,24 @@ The 2-point shape SHAPE is drawn from X1, Y1 to X2, Y2." ;; on the draw-how ;; -(defun artist-key-undraw-continously (x y) +(defun artist-key-undraw-continously (_x _y) "Undraw current continuous shape with point at X, Y." ;; No undraw-info for continuous shapes nil) -(defun artist-key-undraw-poly (x y) +(defun artist-key-undraw-poly (_x _y) "Undraw current poly shape with point at X, Y." - (let ((undraw-fn (artist-go-get-undraw-fn-from-symbol artist-curr-go)) - (x1 (artist-endpoint-get-x artist-key-endpoint1)) - (y1 (artist-endpoint-get-y artist-key-endpoint1))) + (let ((undraw-fn (artist-go-get-undraw-fn-from-symbol artist-curr-go))) (artist-funcall undraw-fn artist-key-shape))) -(defun artist-key-undraw-1point (x y) +(defun artist-key-undraw-1point (_x _y) "Undraw current 1-point shape at X, Y." ;; No undraw-info for 1-point shapes nil) -(defun artist-key-undraw-2points (x y) +(defun artist-key-undraw-2points (_x _y) "Undraw current 2-point shape at X, Y." - (let ((undraw-fn (artist-go-get-undraw-fn-from-symbol artist-curr-go)) - (x1 (artist-endpoint-get-x artist-key-endpoint1)) - (y1 (artist-endpoint-get-y artist-key-endpoint1))) + (let ((undraw-fn (artist-go-get-undraw-fn-from-symbol artist-curr-go))) (artist-funcall undraw-fn artist-key-shape))) (defun artist-key-undraw-common () @@ -4071,7 +4063,7 @@ Trimming here means removing white space at end of a line." (setq artist-key-shape (artist-funcall draw-fn x1 y1 x2 y2)))))) -(defun artist-key-do-continously-1point (x y) +(defun artist-key-do-continously-1point (_x _y) "Update current 1-point shape at X,Y." ;; Nothing to do continuously for operations ;; where we have only one input point @@ -4271,8 +4263,7 @@ If optional argument THIS-IS-LAST-POINT is non-nil, this point is the last." (defun artist-key-set-point-1point (x y) "Set point for current 1-point shape at X,Y." - (let ((draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go)) - (init-fn (artist-go-get-init-fn-from-symbol artist-curr-go)) + (let ((init-fn (artist-go-get-init-fn-from-symbol artist-curr-go)) (prep-fill-fn (artist-go-get-prep-fill-fn-from-symbol artist-curr-go)) (exit-fn (artist-go-get-exit-fn-from-symbol artist-curr-go)) (draw-fn (artist-go-get-draw-fn-from-symbol artist-curr-go)) @@ -4802,7 +4793,7 @@ If optional argument STATE is positive, turn borders on." (orig-draw-region-min-y artist-draw-region-min-y) (orig-draw-region-max-y artist-draw-region-max-y) (orig-pointer-shape (if (eq window-system 'x) x-pointer-shape nil)) - (echoq-keystrokes 10000) ; a lot of seconds + (echo-keystrokes 0) ; Don't echo unfinished commands. ;; Remember original binding for the button-up event to this ;; button-down event. (key (artist-compute-up-event-key ev)) @@ -4918,7 +4909,7 @@ If optional argument STATE is positive, turn borders on." ;; Mouse routines ;; -(defsubst artist-shift-has-changed (shift-state ev) +(defsubst artist-shift-has-changed (_shift-state _ev) "From the last SHIFT-STATE and EV, determine if the shift-state has changed." ;; This one simply doesn't work. ;; @@ -4972,8 +4963,7 @@ The event, EV, is the mouse event." (ev-start-pos (artist-coord-win-to-buf (posn-col-row ev-start))) (x1 (artist--adjust-x (car ev-start-pos))) (y1 (cdr ev-start-pos)) - (shape) - (timer)) + (timer nil)) (select-window (posn-window ev-start)) (artist-funcall init-fn x1 y1) (if (not artist-rubber-banding) @@ -5017,7 +5007,7 @@ The event, EV, is the mouse event." (setq draw-fn (artist-go-get-draw-fn-from-symbol op)))) ;; Draw the new shape - (setq shape (artist-funcall draw-fn x1 y1)) + (artist-funcall draw-fn x1 y1) (artist-move-to-xy x1 y1) ;; Start the timer to call `draw-fn' repeatedly every @@ -5262,7 +5252,6 @@ Operation is done once. The event, EV, is the mouse event." (shifted (artist-go-get-symbol-shift artist-curr-go t)) (shift-state (artist-event-is-shifted ev)) (op (if shift-state shifted unshifted)) - (draw-how (artist-go-get-draw-how-from-symbol op)) (init-fn (artist-go-get-init-fn-from-symbol op)) (prep-fill-fn (artist-go-get-prep-fill-fn-from-symbol op)) (exit-fn (artist-go-get-exit-fn-from-symbol op)) @@ -5394,8 +5383,7 @@ The event, EV, is the mouse event." (interactive) (require 'reporter) (if (y-or-n-p "Do you want to submit a bug report on Artist? ") - (let ((to artist-maintainer-address) - (vars '(window-system + (let ((vars '(window-system window-system-version ;; artist-rubber-banding commit 743bd40126af56ef2b388d05e53758237b77019b Author: Stefan Kangas Date: Wed Oct 21 17:31:47 2020 +0200 ; * lisp/emacs-lisp/bindat.el (bindat-unpack): Fix typo. diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el index f6f8b7c8cc..95581c40a4 100644 --- a/lisp/emacs-lisp/bindat.el +++ b/lisp/emacs-lisp/bindat.el @@ -341,7 +341,7 @@ "Return structured data according to SPEC for binary data in RAW. RAW is a unibyte string or vector. Optional third arg IDX specifies the starting offset in RAW." - (when (multibyte-string-p bindat-raw) + (when (multibyte-string-p raw) (error "String is multibyte")) (setq bindat-raw raw) (setq bindat-idx (or idx 0)) commit ffbea0d705a278b3c268b7cd44ed0484be8b89c1 Author: Stefan Kangas Date: Wed Oct 21 17:21:46 2020 +0200 Tweak two time.el tests * test/lisp/time-tests.el (time-tests-display-time-update--load) (time-tests-display-time-update): Tweak tests. diff --git a/test/lisp/time-tests.el b/test/lisp/time-tests.el index efb3f49146..1a62450cb3 100644 --- a/test/lisp/time-tests.el +++ b/test/lisp/time-tests.el @@ -33,7 +33,9 @@ (let ((display-time-load-average 1) (display-time-load-average-threshold 0)) (display-time-next-load-average) - (should (string-match (rx string-start " " (+ digit ".")) + (should (string-match (rx string-start " " + (+ (| digit ".")) + string-end) (display-time-update--load)))) (let (display-time-load-average) (should (equal (display-time-update--load) "")))) @@ -43,9 +45,11 @@ (display-time-load-average-threshold 0) display-time-string) (display-time-update) - (should (string-match (rx string-start (? digit) digit ":" digit digit + (should (string-match (rx string-start + (? digit) digit ":" digit digit (? (| "AM" "PM")) - " " (+ digit ".")) + " " (+ (| digit ".")) + string-end) display-time-string)))) (ert-deftest time-tests-display-time-file-nonempty-p () commit 06373c15248292f924925b6e7344e51ac6708d5f Author: Stefan Kangas Date: Wed Oct 21 17:00:11 2020 +0200 * lisp/time.el: Use lexical-binding. diff --git a/lisp/time.el b/lisp/time.el index 440f8ac9c6..63773d4204 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -1,4 +1,4 @@ -;;; time.el --- display time, load and mail indicator in mode line of Emacs +;;; time.el --- display time, load and mail indicator in mode line of Emacs -*- lexical-binding: t -*- ;; Copyright (C) 1985-1987, 1993-1994, 1996, 2000-2020 Free Software ;; Foundation, Inc. commit b69f363698b15775ddbffe873a1ddbb9eef73ce4 Author: Stefan Kangas Date: Wed Oct 21 16:59:50 2020 +0200 Add tests for time.el * lisp/time.el (display-time-update--load) (display-time-update--mail): Extract from... (display-time-update): ...here. * test/lisp/time-tests.el: New file. diff --git a/lisp/time.el b/lisp/time.el index cb3a8470ed..440f8ac9c6 100644 --- a/lisp/time.el +++ b/lisp/time.el @@ -284,6 +284,60 @@ Switches from the 1 to 5 to 15 minute load average, and then back to 1." (defvar month) (defvar dayname)) +(defun display-time-update--load () + (if (null display-time-load-average) + "" + (condition-case () + ;; Do not show values less than + ;; `display-time-load-average-threshold'. + (if (> (* display-time-load-average-threshold 100) + (nth display-time-load-average (load-average))) + "" + ;; The load average number is mysterious, so + ;; provide some help. + (let ((str (format " %03d" + (nth display-time-load-average + (load-average))))) + (propertize + (concat (substring str 0 -2) "." (substring str -2)) + 'local-map (make-mode-line-mouse-map + 'mouse-2 'display-time-next-load-average) + 'mouse-face 'mode-line-highlight + 'help-echo (concat + "System load average for past " + (if (= 0 display-time-load-average) + "1 minute" + (if (= 1 display-time-load-average) + "5 minutes" + "15 minutes")) + "; mouse-2: next")))) + (error "")))) + +(defun display-time-update--mail () + (let ((mail-spool-file (or display-time-mail-file + (getenv "MAIL") + (concat rmail-spool-directory + (user-login-name))))) + (cond + (display-time-mail-function + (funcall display-time-mail-function)) + (display-time-mail-directory + (display-time-mail-check-directory)) + ((and (stringp mail-spool-file) + (or (null display-time-server-down-time) + ;; If have been down for 20 min, try again. + (time-less-p 1200 (time-since + display-time-server-down-time)))) + (let ((start-time (current-time))) + (prog1 + (display-time-file-nonempty-p mail-spool-file) + ;; Record whether mail file is accessible. + (setq display-time-server-down-time + (let ((end-time (current-time))) + (and (time-less-p 20 (time-subtract + end-time start-time)) + (float-time end-time)))))))))) + (defun display-time-update () "Update the display-time info for the mode line. However, don't redisplay right now. @@ -291,57 +345,9 @@ However, don't redisplay right now. This is used for things like Rmail `g' that want to force an update which can wait for the next redisplay." (let* ((now (current-time)) - (time (current-time-string now)) - (load (if (null display-time-load-average) - "" - (condition-case () - ;; Do not show values less than - ;; `display-time-load-average-threshold'. - (if (> (* display-time-load-average-threshold 100) - (nth display-time-load-average (load-average))) - "" - ;; The load average number is mysterious, so - ;; provide some help. - (let ((str (format " %03d" - (nth display-time-load-average - (load-average))))) - (propertize - (concat (substring str 0 -2) "." (substring str -2)) - 'local-map (make-mode-line-mouse-map - 'mouse-2 'display-time-next-load-average) - 'mouse-face 'mode-line-highlight - 'help-echo (concat - "System load average for past " - (if (= 0 display-time-load-average) - "1 minute" - (if (= 1 display-time-load-average) - "5 minutes" - "15 minutes")) - "; mouse-2: next")))) - (error "")))) - (mail-spool-file (or display-time-mail-file - (getenv "MAIL") - (concat rmail-spool-directory - (user-login-name)))) - (mail (cond - (display-time-mail-function - (funcall display-time-mail-function)) - (display-time-mail-directory - (display-time-mail-check-directory)) - ((and (stringp mail-spool-file) - (or (null display-time-server-down-time) - ;; If have been down for 20 min, try again. - (time-less-p 1200 (time-since - display-time-server-down-time)))) - (let ((start-time (current-time))) - (prog1 - (display-time-file-nonempty-p mail-spool-file) - ;; Record whether mail file is accessible. - (setq display-time-server-down-time - (let ((end-time (current-time))) - (and (time-less-p 20 (time-subtract - end-time start-time)) - (float-time end-time))))))))) + (time (current-time-string now)) + (load (display-time-update--load)) + (mail (display-time-update--mail)) (24-hours (substring time 11 13)) (hour (string-to-number 24-hours)) (12-hours (int-to-string (1+ (% (+ hour 11) 12)))) diff --git a/test/lisp/time-tests.el b/test/lisp/time-tests.el new file mode 100644 index 0000000000..efb3f49146 --- /dev/null +++ b/test/lisp/time-tests.el @@ -0,0 +1,74 @@ +;;; time-tests.el --- Tests for time.el -*- lexical-binding: t; -*- + +;; Copyright (C) 2020 Free Software Foundation, Inc. + +;; Author: Stefan Kangas + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: + +(require 'ert) +(require 'ert-x) +(require 'time) + +(ert-deftest time-tests-display-time-mail-check-directory () + (let ((display-time-mail-directory (ert-resource-directory))) + (should (display-time-mail-check-directory)))) + +(ert-deftest time-tests-display-time-update--load () + (let ((display-time-load-average 1) + (display-time-load-average-threshold 0)) + (display-time-next-load-average) + (should (string-match (rx string-start " " (+ digit ".")) + (display-time-update--load)))) + (let (display-time-load-average) + (should (equal (display-time-update--load) "")))) + +(ert-deftest time-tests-display-time-update () + (let ((display-time-load-average 1) + (display-time-load-average-threshold 0) + display-time-string) + (display-time-update) + (should (string-match (rx string-start (? digit) digit ":" digit digit + (? (| "AM" "PM")) + " " (+ digit ".")) + display-time-string)))) + +(ert-deftest time-tests-display-time-file-nonempty-p () + (should (display-time-file-nonempty-p (ert-resource-file "non-empty"))) + (should-not (display-time-file-nonempty-p "/non/existent"))) + +(ert-deftest time-tests-world-clock () + (save-window-excursion + (world-clock) + (should (equal (buffer-name) world-clock-buffer-name)) + (should (string-match "New York" (buffer-string))))) + +(ert-deftest time-tests-world-clock/revert-buffer-works () + (save-window-excursion + (world-clock) + (revert-buffer) + (should (string-match "New York" (buffer-string))))) + +(ert-deftest time-tests-emacs-uptime () + (should (string-match "^[0-9.]+ seconds?$" (emacs-uptime "%S")))) + +(ert-deftest time-tests-emacs-init-time () + (should (string-match "^[0-9.]+ seconds?$" (emacs-init-time)))) + +(provide 'time-tests) +;;; time-tests.el ends here commit a497b8e4a41e3223089654da4b36d0fdd51ce555 Author: Stefan Kangas Date: Wed Oct 21 16:09:12 2020 +0200 Use lexical-binding in bindat.el * lisp/emacs-lisp/bindat.el: Use lexical-binding. (bindat-raw, bindat-idx, bindat-unpack, bindat-pack): Adjust for lexical-binding. (bindat--unpack-group, bindat--length-group): Fix byte-compiler warning about unused variables last and vlen. (bindat--unpack-group, bindat--length-group, bindat--pack-group) (bindat-format-vector): Quote function symbols as such. diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el index d168c25512..f6f8b7c8cc 100644 --- a/lisp/emacs-lisp/bindat.el +++ b/lisp/emacs-lisp/bindat.el @@ -1,4 +1,4 @@ -;;; bindat.el --- binary data structure packing and unpacking. +;;; bindat.el --- binary data structure packing and unpacking. -*- lexical-binding: t -*- ;; Copyright (C) 2002-2020 Free Software Foundation, Inc. @@ -193,8 +193,8 @@ ;; Helper functions for structure unpacking. ;; Relies on dynamic binding of BINDAT-RAW and BINDAT-IDX -(defvar bindat-raw) -(defvar bindat-idx) +(defvar bindat-raw nil) +(defvar bindat-idx nil) (defun bindat--unpack-u8 () (prog1 @@ -276,7 +276,7 @@ (t nil))) (defun bindat--unpack-group (spec) - (let (struct last) + (let (struct) (while spec (let* ((item (car spec)) (field (car item)) @@ -298,7 +298,7 @@ type field field nil)) (if (and (consp len) (not (eq type 'eval))) - (setq len (apply 'bindat-get-field struct len))) + (setq len (apply #'bindat-get-field struct len))) (if (not len) (setq len 1)) (cond @@ -330,21 +330,21 @@ (setq data (bindat--unpack-group (cdr case)) cases nil))))) (t - (setq data (bindat--unpack-item type len vectype) - last data))) + (setq data (bindat--unpack-item type len vectype)))) (if data (if field (setq struct (cons (cons field data) struct)) (setq struct (append data struct)))))) struct)) -(defun bindat-unpack (spec bindat-raw &optional bindat-idx) - "Return structured data according to SPEC for binary data in BINDAT-RAW. -BINDAT-RAW is a unibyte string or vector. -Optional third arg BINDAT-IDX specifies the starting offset in BINDAT-RAW." +(defun bindat-unpack (spec raw &optional idx) + "Return structured data according to SPEC for binary data in RAW. +RAW is a unibyte string or vector. +Optional third arg IDX specifies the starting offset in RAW." (when (multibyte-string-p bindat-raw) (error "String is multibyte")) - (unless bindat-idx (setq bindat-idx 0)) + (setq bindat-raw raw) + (setq bindat-idx (or idx 0)) (bindat--unpack-group spec)) (defun bindat-get-field (struct &rest field) @@ -373,74 +373,70 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (ip . 4))) (defun bindat--length-group (struct spec) - (let (last) - (while spec - (let* ((item (car spec)) - (field (car item)) - (type (nth 1 item)) - (len (nth 2 item)) - (vectype (and (eq type 'vec) (nth 3 item))) - (tail 3)) - (setq spec (cdr spec)) - (if (and (consp field) (eq (car field) 'eval)) - (setq field (eval (car (cdr field))))) - (if (and type (consp type) (eq (car type) 'eval)) - (setq type (eval (car (cdr type))))) - (if (and len (consp len) (eq (car len) 'eval)) - (setq len (eval (car (cdr len))))) - (if (memq field '(eval fill align struct union)) - (setq tail 2 - len type - type field - field nil)) - (if (and (consp len) (not (eq type 'eval))) - (setq len (apply 'bindat-get-field struct len))) - (if (not len) - (setq len 1)) - (while (eq type 'vec) - (let ((vlen 1)) - (if (consp vectype) - (setq len (* len (nth 1 vectype)) - type (nth 2 vectype)) - (setq type (or vectype 'u8) - vectype nil)))) - (cond - ((eq type 'eval) - (if field - (setq struct (cons (cons field (eval len)) struct)) - (eval len))) - ((eq type 'fill) - (setq bindat-idx (+ bindat-idx len))) - ((eq type 'align) - (while (/= (% bindat-idx len) 0) - (setq bindat-idx (1+ bindat-idx)))) - ((eq type 'struct) - (bindat--length-group - (if field (bindat-get-field struct field) struct) (eval len))) - ((eq type 'repeat) - (let ((index 0) (count len)) - (while (< index count) - (bindat--length-group - (nth index (bindat-get-field struct field)) - (nthcdr tail item)) - (setq index (1+ index))))) - ((eq type 'union) - (let ((tag len) (cases (nthcdr tail item)) case cc) - (while cases - (setq case (car cases) - cases (cdr cases) - cc (car case)) - (if (or (equal cc tag) (equal cc t) - (and (consp cc) (eval cc))) - (progn - (bindat--length-group struct (cdr case)) - (setq cases nil)))))) - (t - (if (setq type (assq type bindat--fixed-length-alist)) - (setq len (* len (cdr type)))) - (if field - (setq last (bindat-get-field struct field))) - (setq bindat-idx (+ bindat-idx len)))))))) + (while spec + (let* ((item (car spec)) + (field (car item)) + (type (nth 1 item)) + (len (nth 2 item)) + (vectype (and (eq type 'vec) (nth 3 item))) + (tail 3)) + (setq spec (cdr spec)) + (if (and (consp field) (eq (car field) 'eval)) + (setq field (eval (car (cdr field))))) + (if (and type (consp type) (eq (car type) 'eval)) + (setq type (eval (car (cdr type))))) + (if (and len (consp len) (eq (car len) 'eval)) + (setq len (eval (car (cdr len))))) + (if (memq field '(eval fill align struct union)) + (setq tail 2 + len type + type field + field nil)) + (if (and (consp len) (not (eq type 'eval))) + (setq len (apply #'bindat-get-field struct len))) + (if (not len) + (setq len 1)) + (while (eq type 'vec) + (if (consp vectype) + (setq len (* len (nth 1 vectype)) + type (nth 2 vectype)) + (setq type (or vectype 'u8) + vectype nil))) + (cond + ((eq type 'eval) + (if field + (setq struct (cons (cons field (eval len)) struct)) + (eval len))) + ((eq type 'fill) + (setq bindat-idx (+ bindat-idx len))) + ((eq type 'align) + (while (/= (% bindat-idx len) 0) + (setq bindat-idx (1+ bindat-idx)))) + ((eq type 'struct) + (bindat--length-group + (if field (bindat-get-field struct field) struct) (eval len))) + ((eq type 'repeat) + (let ((index 0) (count len)) + (while (< index count) + (bindat--length-group + (nth index (bindat-get-field struct field)) + (nthcdr tail item)) + (setq index (1+ index))))) + ((eq type 'union) + (let ((tag len) (cases (nthcdr tail item)) case cc) + (while cases + (setq case (car cases) + cases (cdr cases) + cc (car case)) + (if (or (equal cc tag) (equal cc t) + (and (consp cc) (eval cc))) + (progn + (bindat--length-group struct (cdr case)) + (setq cases nil)))))) + (t + (if (setq type (assq type bindat--fixed-length-alist)) + (setq len (* len (cdr type)))) + (setq bindat-idx (+ bindat-idx len))))))) (defun bindat-length (spec struct) "Calculate bindat-raw length for STRUCT according to bindat SPEC." @@ -557,7 +553,7 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." type field field nil)) (if (and (consp len) (not (eq type 'eval))) - (setq len (apply 'bindat-get-field struct len))) + (setq len (apply #'bindat-get-field struct len))) (if (not len) (setq len 1)) (cond @@ -596,17 +592,17 @@ e.g. corresponding to STRUCT.FIELD1[INDEX2].FIELD3..." (bindat--pack-item last type len vectype) )))))) -(defun bindat-pack (spec struct &optional bindat-raw bindat-idx) +(defun bindat-pack (spec struct &optional raw idx) "Return binary data packed according to SPEC for structured data STRUCT. -Optional third arg BINDAT-RAW is a pre-allocated unibyte string or vector to -pack into. -Optional fourth arg BINDAT-IDX is the starting offset into BINDAT-RAW." - (when (multibyte-string-p bindat-raw) +Optional third arg RAW is a pre-allocated unibyte string or +vector to pack into. +Optional fourth arg IDX is the starting offset into BINDAT-RAW." + (when (multibyte-string-p raw) (error "Pre-allocated string is multibyte")) - (let ((no-return bindat-raw)) - (unless bindat-idx (setq bindat-idx 0)) - (unless bindat-raw - (setq bindat-raw (make-string (+ bindat-idx (bindat-length spec struct)) 0))) + (let ((no-return raw)) + (setq bindat-idx (or idx 0)) + (setq bindat-raw (or raw + (make-string (+ bindat-idx (bindat-length spec struct)) 0))) (bindat--pack-group struct spec) (if no-return nil bindat-raw))) @@ -624,7 +620,7 @@ only that many elements from VECT." (while (> i 0) (setq i (1- i) s (cons (format (if (= i 0) fmt fmt2) (aref vect i)) s))) - (apply 'concat s))) + (apply #'concat s))) (defun bindat-vector-to-dec (vect &optional sep) "Format vector VECT in decimal format separated by dots. commit 234cf7491872155dbd9716dc4652febefbe3759f Author: Stefan Kangas Date: Wed Oct 21 15:37:13 2020 +0200 Remove some compat code from uudecode.el and binhex.el * lisp/mail/uudecode.el (uudecode-char-int): Make obsolete. (uudecode-decode-region-internal): Adjust callers. * lisp/mail/binhex.el (binhex-char-int): Make obsolete. (binhex-string-big-endian, binhex-string-little-endian) (binhex-header): Adjust callers. diff --git a/lisp/mail/binhex.el b/lisp/mail/binhex.el index 2c77f88f97..431c681be0 100644 --- a/lisp/mail/binhex.el +++ b/lisp/mail/binhex.el @@ -29,12 +29,6 @@ ;;; Code: -(eval-and-compile - (defalias 'binhex-char-int - (if (fboundp 'char-int) - 'char-int - 'identity))) - (defgroup binhex nil "Decoding of BinHex (binary-to-hexadecimal) data." :group 'mail @@ -150,14 +144,14 @@ input and write the converted data to its standard output." (defun binhex-string-big-endian (string) (let ((ret 0) (i 0) (len (length string))) (while (< i len) - (setq ret (+ (ash ret 8) (binhex-char-int (aref string i))) + (setq ret (+ (ash ret 8) (aref string i)) i (1+ i))) ret)) (defun binhex-string-little-endian (string) (let ((ret 0) (i 0) (shift 0) (len (length string))) (while (< i len) - (setq ret (+ ret (ash (binhex-char-int (aref string i)) shift)) + (setq ret (+ ret (ash (aref string i) shift)) i (1+ i) shift (+ shift 8))) ret)) @@ -167,11 +161,11 @@ input and write the converted data to its standard output." (let ((pos (point-min)) len) (vector (prog1 - (setq len (binhex-char-int (char-after pos))) + (setq len (char-after pos)) (setq pos (1+ pos))) (buffer-substring pos (setq pos (+ pos len))) (prog1 - (setq len (binhex-char-int (char-after pos))) + (setq len (char-after pos)) (setq pos (1+ pos))) (buffer-substring pos (setq pos (+ pos 4))) (buffer-substring pos (setq pos (+ pos 4))) @@ -323,6 +317,8 @@ If HEADER-ONLY is non-nil only decode header and return filename." (binhex-decode-region-external start end) (binhex-decode-region-internal start end))) +(define-obsolete-function-alias 'binhex-char-int #'identity) + (provide 'binhex) ;;; binhex.el ends here diff --git a/lisp/mail/uudecode.el b/lisp/mail/uudecode.el index 945bff35f7..bcbd571b53 100644 --- a/lisp/mail/uudecode.el +++ b/lisp/mail/uudecode.el @@ -24,11 +24,6 @@ ;;; Code: -(defalias 'uudecode-char-int - (if (fboundp 'char-int) - 'char-int - 'identity)) - (defgroup uudecode nil "Decoding of uuencoded data." :group 'mail @@ -140,7 +135,7 @@ If FILE-NAME is non-nil, save the result to FILE-NAME." ((> (skip-chars-forward uudecode-alphabet end) 0) (setq lim (point)) (setq remain - (logand (- (uudecode-char-int (char-after inputpos)) 32) + (logand (- (char-after inputpos) 32) 63)) (setq inputpos (1+ inputpos)) (if (= remain 0) (setq done t)) @@ -148,7 +143,7 @@ If FILE-NAME is non-nil, save the result to FILE-NAME." (setq bits (+ bits (logand (- - (uudecode-char-int (char-after inputpos)) 32) + (char-after inputpos) 32) 63))) (if (/= counter 0) (setq remain (1- remain))) (setq counter (1+ counter) @@ -201,6 +196,8 @@ If FILE-NAME is non-nil, save the result to FILE-NAME." (uudecode-decode-region-external start end file-name) (uudecode-decode-region-internal start end file-name))) +(define-obsolete-function-alias 'uudecode-char-int #'identity "28.1") + (provide 'uudecode) ;;; uudecode.el ends here commit 29cb2fdd0c09235a91282f54e81c9856e39bd3ca Author: Stefan Kangas Date: Wed Oct 21 15:25:45 2020 +0200 Declare old compat aliases in tcl.el obsolete * lisp/progmodes/tcl.el (tcl-uncomment-region) (tcl-indent-for-comment, add-log-tcl-defun, indent-tcl-exp) (calculate-tcl-indent, tcl-beginning-of-defun, tcl-end-of-defun) (tcl-mark-defun, tcl-mark): Make obsolete. diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el index 33aad2d39f..717008a0a2 100644 --- a/lisp/progmodes/tcl.el +++ b/lisp/progmodes/tcl.el @@ -1555,21 +1555,21 @@ The first line is assumed to look like \"#!.../program ...\"." (char-to-string char))) string "")) + + ;; -;; Bug reporting. +;; Obsolete. ;; - -;; These are relics kept "just in case". -(defalias 'tcl-uncomment-region 'uncomment-region) -(defalias 'tcl-indent-for-comment 'comment-indent) -(defalias 'add-log-tcl-defun 'tcl-add-log-defun) -(defalias 'indent-tcl-exp 'tcl-indent-exp) -(defalias 'calculate-tcl-indent 'tcl-calculate-indent) -(defalias 'tcl-beginning-of-defun 'beginning-of-defun) -(defalias 'tcl-end-of-defun 'end-of-defun) -(defalias 'tcl-mark-defun 'mark-defun) -(defun tcl-mark () (mark t)) +(define-obsolete-function-alias 'tcl-uncomment-region #'uncomment-region "28.1") +(define-obsolete-function-alias 'tcl-indent-for-comment #'comment-indent "28.1") +(define-obsolete-function-alias 'add-log-tcl-defun #'tcl-add-log-defun "28.1") +(define-obsolete-function-alias 'indent-tcl-exp #'tcl-indent-exp "28.1") +(define-obsolete-function-alias 'calculate-tcl-indent #'tcl-calculate-indent "28.1") +(define-obsolete-function-alias 'tcl-beginning-of-defun #'beginning-of-defun "28.1") +(define-obsolete-function-alias 'tcl-end-of-defun #'end-of-defun "28.1") +(define-obsolete-function-alias 'tcl-mark-defun #'mark-defun "28.1") +(defun tcl-mark () (declare (obsolete nil "28.1")) (mark t)) (provide 'tcl) commit d72696d3b12bebe6cfc8745ac9b0b8e0db03b686 Author: Stefan Kangas Date: Wed Oct 21 14:49:04 2020 +0200 Add some top level domains * lisp/mail/mail-extr.el (mail-extr-all-top-level-domains): Add some geographic domains. diff --git a/lisp/mail/mail-extr.el b/lisp/mail/mail-extr.el index bd9aef17a8..c296f29f9e 100644 --- a/lisp/mail/mail-extr.el +++ b/lisp/mail/mail-extr.el @@ -1856,6 +1856,11 @@ place. It affects how `mail-extract-address-components' works." ;; https://www.iana.org/cctld/cctld-whois.htm ;; Latest change: 2007/11/15 +;; FIXME: There are over 1500 top level domains, the vast majority of +;; which are not in the below list. Should they be? +;; https://data.iana.org/TLD/tlds-alpha-by-domain.txt +;; https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains + (defconst mail-extr-all-top-level-domains (let ((ob (make-vector 739 0))) (mapc @@ -2145,6 +2150,80 @@ place. It affects how `mail-extract-address-components' works." ("uucp" t "Unix to Unix CoPy") ;; Infrastructure Domains: ("arpa" t "Advanced Research Projects Agency (U.S. DoD)") + ;; Geographic Domains: + ("abudhabi" "Abu Dhabi") + ("africa" "Africa") + ("alsace" "Alsace, France") + ("amsterdam" "Amsterdam, The Netherlands") + ("arab" "League of Arab States") + ("asia" "Asia-Pacific region") + ("bar" "Bar, Montenegro") + ("barcelona" "Barcelona, Spain") + ("bayern" "Bavaria, Germany") + ("bcn" "Barcelona, Spain") + ("berlin" "Berlin, Germany") + ("boston" "Boston, Massachusetts") + ("brussels" "Brussels, Belgium") + ("budapest" "Budapest, Hungary") + ("bzh" "Brittany, France") + ("capetown" "Cape Town, South Africa") + ("cat" "Catalonia, Spain") + ("cologne" "Cologne, Germany") + ("corsica" "Corsica, France") + ("cymru" "Wales, United Kingdom") + ("doha" "Doha") + ("dubai" "Dubai") + ("durban" "Durban, South Africa") + ("eus" "Basque, Spain and France") + ("frl" "Friesland, Netherlands") + ("gal" "Galicia, Spain") + ("gent" "Ghent, Belgium") + ("hamburg" "Hamburg, Germany") + ("helsinki" "Helsinki, Finland") + ("irish" "Ireland") + ("ist" "İstanbul, Turkey") + ("istanbul" "İstanbul, Turkey") + ("joburg" "Johannesburg, South Africa") + ("kiwi" "New Zealanders") + ("koeln" "Cologne, Germany") + ("krd" "Kurdistan") + ("kyoto" "Kyoto, Japan") + ("lat" "Latin America") + ("london" "London, United Kingdom") + ("madrid" "Madrid, Spain") + ("melbourne" "Melbourne, Australia") + ("miami" "Miami, Florida") + ("nagoya" "Nagoya, Japan") + ("nrw" "North Rhine-Westphalia, Germany") + ("nyc" "New York City, New York") + ("okinawa" "Okinawa, Japan") + ("osaka" "Osaka, Japan") + ("paris" "Paris, France") + ("quebec" "Québec, Canada") + ("rio" "Rio de Janeiro, Brazil") + ("ruhr" "Ruhr, Germany") + ("ryukyu" "Ryukyu Islands, Japan") + ("saarland" "Saarland, Germany") + ("scot" "Scotland, United Kingdom") + ("stockholm" "Stockholm, Sweden") + ("swiss" "Switzerland") + ("sydney" "Sydney, Australia") + ("taipei" "Taipei, Taiwan") + ("tatar" "Tatars") + ("tirol" "Tyrol, Austria") + ("tokyo" "Tokyo, Japan") + ("vegas" "Las Vegas, Nevada") + ("wales" "Wales, United Kingdom") + ("wien" "Vienna, Austria") + ("yokohama" "Yokohama, Japan") + ("zuerich" "Zurich, Switzerland") + ;; Internationalized Geographic Domains: + ("xn--1qqw23a" "Foshan, China") + ("xn--xhq521b" "Guangdong, China") + ("xn--80adxhks" "Moscow, Russia") + ("xn--p1acf" "Russia") + ("xn--mgbca7dzdo" "Abu Dhabi") + ("xn--ngbrx" "Arab") )) ob)) commit 8532fa41bb46de2f01698caa70cd26bbdbef149c Author: Lars Ingebrigtsen Date: Wed Oct 21 14:10:58 2020 +0200 Revert "Add emoji to etc/HELLO" This reverts commit a1fcdeec25be87e8f97ac5c14e6fbf6a4d1eb2d4. There was already an emoji in there. diff --git a/etc/HELLO b/etc/HELLO index 79b08c2653..06c1c433b0 100644 --- a/etc/HELLO +++ b/etc/HELLO @@ -76,7 +76,6 @@ Khmer (ភាសាខ្មែរ) ជំរាបសួរ mule-unicode-0100-24ffSinhala (සිංහල) ආයුබෝවන් latin-iso8859-2Slovak (slovenčina) Dobrý deň Slovenian (slovenščina) Pozdravljeni! -Social Media 👋 Spanish (espalatin-iso8859-1ñol) ¡Hola! Swedish (svenska) Hej / Goddag / Hallå mule-unicode-0100-24ffTamil (தமிழ்) வணக்கம் commit e656600c965ede7754753800ecf76ad574e7220f Author: Stefan Kangas Date: Wed Oct 21 13:26:57 2020 +0200 * test/lisp/vc/vc-bzr-tests.el: Use lexical-binding. diff --git a/test/lisp/vc/vc-bzr-tests.el b/test/lisp/vc/vc-bzr-tests.el index 408d6e8e23..d922e98348 100644 --- a/test/lisp/vc/vc-bzr-tests.el +++ b/test/lisp/vc/vc-bzr-tests.el @@ -1,4 +1,4 @@ -;;; vc-bzr.el --- tests for vc/vc-bzr.el +;;; vc-bzr.el --- tests for vc/vc-bzr.el -*- lexical-binding: t -*- ;; Copyright (C) 2011-2020 Free Software Foundation, Inc. commit 95a458724dc9402cb35a6ed4a3eb571aada52348 Author: Stefan Kangas Date: Wed Oct 21 13:25:39 2020 +0200 Use lexical-binding in files-x-tests.el * test/lisp/files-x-tests.el: Use lexical-binding. (remote-null-device): Declare. diff --git a/test/lisp/files-x-tests.el b/test/lisp/files-x-tests.el index d3ed4b5312..9db198384d 100644 --- a/test/lisp/files-x-tests.el +++ b/test/lisp/files-x-tests.el @@ -1,4 +1,4 @@ -;;; files-x-tests.el --- tests for files-x.el. +;;; files-x-tests.el --- tests for files-x.el. -*- lexical-binding: t -*- ;; Copyright (C) 2016-2020 Free Software Foundation, Inc. @@ -35,6 +35,7 @@ '((remote-null-device . "/dev/null"))) (defconst files-x-test--variables4 '((remote-null-device . "null"))) +(defvar remote-null-device) (put 'remote-shell-file-name 'safe-local-variable #'identity) (put 'remote-shell-command-switch 'safe-local-variable #'identity) (put 'remote-shell-interactive-switch 'safe-local-variable #'identity) commit 0e6f1e4e80006b03bc85b50aa99b67b9d4c2dd9f Author: Stefan Kangas Date: Wed Oct 21 13:19:02 2020 +0200 Use lexical-binding in iso-ascii.el * lisp/international/iso-ascii.el: Use lexical-binding. Remove redundant :group args. diff --git a/lisp/international/iso-ascii.el b/lisp/international/iso-ascii.el index e86efe5827..0df07d6514 100644 --- a/lisp/international/iso-ascii.el +++ b/lisp/international/iso-ascii.el @@ -1,4 +1,4 @@ -;;; iso-ascii.el --- set up char tables for ISO 8859/1 on ASCII terminals +;;; iso-ascii.el --- set up char tables for ISO 8859/1 on ASCII terminals -*- lexical-binding: t -*- ;; Copyright (C) 1987, 1995, 1998, 2001-2020 Free Software Foundation, ;; Inc. @@ -41,8 +41,7 @@ (defcustom iso-ascii-convenient nil "Non-nil means `iso-ascii' should aim for convenience, not precision." - :type 'boolean - :group 'iso-ascii) + :type 'boolean) (defvar iso-ascii-display-table (make-display-table) "Display table used for ISO-ASCII mode.") commit 0aa881f231ef8593e3bc2031b59feb1254db8b55 Author: Stefan Kangas Date: Wed Oct 21 13:05:32 2020 +0200 Use lexical-binding in hfy-cmap.el and add tests * lisp/hfy-cmap.el: Use lexical-binding. (hfy-cmap--parse-buffer): Extract from... (htmlfontify-load-rgb-file): ...here. * test/lisp/hfy-cmap-resources/rgb.txt: * test/lisp/hfy-cmap-tests.el: New files. diff --git a/lisp/hfy-cmap.el b/lisp/hfy-cmap.el index 4cff2a4200..a3398f6e80 100644 --- a/lisp/hfy-cmap.el +++ b/lisp/hfy-cmap.el @@ -1,4 +1,4 @@ -;;; hfy-cmap.el --- Fallback color name -> rgb mapping for `htmlfontify' +;;; hfy-cmap.el --- Fallback color name -> rgb mapping for `htmlfontify' -*- lexical-binding:t -*- ;; Copyright (C) 2002-2003, 2009-2020 Free Software Foundation, Inc. @@ -809,6 +809,22 @@ (defconst hfy-rgb-regex "^\\s-*\\([0-9]+\\)\\s-+\\([0-9]+\\)\\s-+\\([0-9]+\\)\\s-+\\(.+\\)\\s-*$") +(defun hfy-cmap--parse-buffer (buffer) + (with-current-buffer buffer + (let ((end-of-rgb 0) + result) + (goto-char (point-min)) + (htmlfontify-unload-rgb-file) + (while (/= end-of-rgb 1) + (if (looking-at hfy-rgb-regex) + (push (list (match-string 4) + (string-to-number (match-string 1)) + (string-to-number (match-string 2)) + (string-to-number (match-string 3))) + result)) + (setq end-of-rgb (forward-line))) + result))) + ;;;###autoload (defun htmlfontify-load-rgb-file (&optional file) "Load an X11 style rgb.txt FILE. @@ -818,25 +834,14 @@ Loads the variable `hfy-rgb-txt-color-map', which is used by (interactive (list (read-file-name "rgb.txt (equivalent) file: " "" nil t (hfy-rgb-file)))) - (let ((rgb-buffer nil) - (end-of-rgb 0) - (rgb-txt nil)) - (if (and (setq rgb-txt (or file (hfy-rgb-file))) - (file-readable-p rgb-txt)) - (with-current-buffer - (setq rgb-buffer (find-file-noselect rgb-txt 'nowarn)) - (goto-char (point-min)) - (htmlfontify-unload-rgb-file) - (while (/= end-of-rgb 1) - (if (looking-at hfy-rgb-regex) - (setq hfy-rgb-txt-color-map - (cons (list (match-string 4) - (string-to-number (match-string 1)) - (string-to-number (match-string 2)) - (string-to-number (match-string 3))) - hfy-rgb-txt-color-map)) ) - (setq end-of-rgb (forward-line))) - (kill-buffer rgb-buffer))))) + (let ((rgb-buffer nil) + (rgb-txt (or file (hfy-rgb-file)))) + (when (and rgb-txt + (file-readable-p rgb-txt)) + (setq rgb-buffer (find-file-noselect rgb-txt 'nowarn)) + (when-let ((result (hfy-cmap--parse-buffer rgb-buffer))) + (setq hfy-rgb-txt-color-map result)) + (kill-buffer rgb-buffer)))) (defun htmlfontify-unload-rgb-file () "Unload the current color name -> rgb translation map." diff --git a/test/lisp/hfy-cmap-resources/rgb.txt b/test/lisp/hfy-cmap-resources/rgb.txt new file mode 100644 index 0000000000..86a0053990 --- /dev/null +++ b/test/lisp/hfy-cmap-resources/rgb.txt @@ -0,0 +1,3 @@ +255 250 250 snow +248 248 255 ghost white +248 248 255 GhostWhite diff --git a/test/lisp/hfy-cmap-tests.el b/test/lisp/hfy-cmap-tests.el new file mode 100644 index 0000000000..4cdc6ffc82 --- /dev/null +++ b/test/lisp/hfy-cmap-tests.el @@ -0,0 +1,55 @@ +;;; hfy-cmap-tests.el --- tests for hfy-cmap.el -*- lexical-binding: t -*- + +;; Copyright (C) 2020 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Code: + +(require 'ert) +(require 'ert-x) +(require 'hfy-cmap) + +(defconst hfy-cmap-tests--data + (concat "255 250 250 snow\n" + "248 248 255 ghost white\n" + "248 248 255 GhostWhite\n")) + +(defconst hfy-cmap-tests--parsed + '(("GhostWhite" 248 248 255) + ("ghost white" 248 248 255) + ("snow" 255 250 250))) + +(ert-deftest test-hfy-cmap--parse-buffer () + (with-temp-buffer + (insert hfy-cmap-tests--data) + (should (equal (hfy-cmap--parse-buffer (current-buffer)) + hfy-cmap-tests--parsed)))) + +(ert-deftest test-htmlfontify-load-rgb-file () + :tags '(:expensive-test) + (let (hfy-rgb-txt-color-map) + (htmlfontify-load-rgb-file (ert-resource-file "rgb.txt")) + (should (equal hfy-rgb-txt-color-map + hfy-cmap-tests--parsed)))) + +(ert-deftest test-htmlfontify-load-rgb-file/non-existent-file () + (let (hfy-rgb-txt-color-map) + (htmlfontify-load-rgb-file "/non/existent/file") + (should-not hfy-rgb-txt-color-map))) + +(provide 'hfy-cmap-tests) +;;; hfy-cmap-tests.el ends here commit a1fcdeec25be87e8f97ac5c14e6fbf6a4d1eb2d4 Author: Lars Ingebrigtsen Date: Wed Oct 21 12:31:12 2020 +0200 Add emoji to etc/HELLO diff --git a/etc/HELLO b/etc/HELLO index 06c1c433b0..79b08c2653 100644 --- a/etc/HELLO +++ b/etc/HELLO @@ -76,6 +76,7 @@ Khmer (ភាសាខ្មែរ) ជំរាបសួរ mule-unicode-0100-24ffSinhala (සිංහල) ආයුබෝවන් latin-iso8859-2Slovak (slovenčina) Dobrý deň Slovenian (slovenščina) Pozdravljeni! +Social Media 👋 Spanish (espalatin-iso8859-1ñol) ¡Hola! Swedish (svenska) Hej / Goddag / Hallå mule-unicode-0100-24ffTamil (தமிழ்) வணக்கம் commit e3229aff5485d35c4855dda71eb1ac29b4ef8ea9 Author: Michael Albinus Date: Wed Oct 21 12:24:46 2020 +0200 * etc/HELLO: Keep Javanese System.out.println(""); diff --git a/etc/HELLO b/etc/HELLO index 10c4e9e66c..06c1c433b0 100644 --- a/etc/HELLO +++ b/etc/HELLO @@ -59,7 +59,7 @@ Gujarati (ગુજરાતી) નમસ્તે unicodeInuktitut (ᐃᓄᒃᑎᑐᑦ) ᐊᐃ latin-iso8859-1Italian (italiano) Ciao / Buon giorno -unicodeJavanese (ꦧꦱꦗꦮ) ꦱꦸꦒꦼꦁꦱꦶꦪꦁ +unicodeJavanese (ꦧꦱꦗꦮ) System.out.println("ꦱꦸꦒꦼꦁꦱꦶꦪꦁ"); mule-unicode-0100-24ffKannada (ಕನ್ನಡ) ನಮಸ್ಕಾರ Khmer (ភាសាខ្មែរ) ជំរាបសួរ laoLao (ພາສາລາວ) ສະບາຍດີ / ຂໍໃຫ້ໂຊກດີ commit 8a91d055b289979a750b81c4ecfdbe44bdd68481 Author: Stefan Monnier Date: Tue Oct 20 19:00:52 2020 -0400 * lisp/outline.el: Use lexical-binding Remove redundant `group` arguments. (outline-level): Move before first use. (outline-mode): Use `setq-local`. (outline-isearch-open-invisible-function): Give it a non-nil default. diff --git a/lisp/outline.el b/lisp/outline.el index b9806bc187..47e6528859 100644 --- a/lisp/outline.el +++ b/lisp/outline.el @@ -1,4 +1,4 @@ -;;; outline.el --- outline mode commands for Emacs +;;; outline.el --- outline mode commands for Emacs -*- lexical-binding: t; -*- ;; Copyright (C) 1986, 1993-1995, 1997, 2000-2020 Free Software ;; Foundation, Inc. @@ -166,7 +166,7 @@ in the file it applies to.") ;; Remove extra separator (cdr ;; Flatten the major mode's menus into a single menu. - (apply 'append + (apply #'append (mapcar (lambda (x) (if (consp x) ;; Add a separator between each @@ -196,47 +196,45 @@ in the file it applies to.") (defface outline-1 '((t :inherit font-lock-function-name-face)) - "Level 1." - :group 'outlines) + "Level 1.") (defface outline-2 '((t :inherit font-lock-variable-name-face)) - "Level 2." - :group 'outlines) + "Level 2.") (defface outline-3 '((t :inherit font-lock-keyword-face)) - "Level 3." - :group 'outlines) + "Level 3.") (defface outline-4 '((t :inherit font-lock-comment-face)) - "Level 4." - :group 'outlines) + "Level 4.") (defface outline-5 '((t :inherit font-lock-type-face)) - "Level 5." - :group 'outlines) + "Level 5.") (defface outline-6 '((t :inherit font-lock-constant-face)) - "Level 6." - :group 'outlines) + "Level 6.") (defface outline-7 '((t :inherit font-lock-builtin-face)) - "Level 7." - :group 'outlines) + "Level 7.") (defface outline-8 '((t :inherit font-lock-string-face)) - "Level 8." - :group 'outlines) + "Level 8.") (defvar outline-font-lock-faces [outline-1 outline-2 outline-3 outline-4 outline-5 outline-6 outline-7 outline-8]) + +(defvar outline-level #'outline-level + "Function of no args to compute a header's nesting level in an outline. +It can assume point is at the beginning of a header line and that the match +data reflects the `outline-regexp'.") +;;;###autoload(put 'outline-level 'risky-local-variable t) (defun outline-font-lock-face () "Return one of `outline-font-lock-faces' for current level." @@ -279,21 +277,20 @@ beginning of the line. The longer the match, the deeper the level. Turning on outline mode calls the value of `text-mode-hook' and then of `outline-mode-hook', if they are non-nil." - (make-local-variable 'line-move-ignore-invisible) - (setq line-move-ignore-invisible t) + (setq-local line-move-ignore-invisible t) ;; Cause use of ellipses for invisible text. (add-to-invisibility-spec '(outline . t)) - (set (make-local-variable 'paragraph-start) - (concat paragraph-start "\\|\\(?:" outline-regexp "\\)")) + (setq-local paragraph-start + (concat paragraph-start "\\|\\(?:" outline-regexp "\\)")) ;; Inhibit auto-filling of header lines. - (set (make-local-variable 'auto-fill-inhibit-regexp) outline-regexp) - (set (make-local-variable 'paragraph-separate) - (concat paragraph-separate "\\|\\(?:" outline-regexp "\\)")) - (set (make-local-variable 'font-lock-defaults) - '(outline-font-lock-keywords t nil nil backward-paragraph)) - (setq imenu-generic-expression - (list (list nil (concat "^\\(?:" outline-regexp "\\).*$") 0))) - (add-hook 'change-major-mode-hook 'outline-show-all nil t)) + (setq-local auto-fill-inhibit-regexp outline-regexp) + (setq-local paragraph-separate + (concat paragraph-separate "\\|\\(?:" outline-regexp "\\)")) + (setq-local font-lock-defaults + '(outline-font-lock-keywords t nil nil backward-paragraph)) + (setq-local imenu-generic-expression + (list (list nil (concat "^\\(?:" outline-regexp "\\).*$") 0))) + (add-hook 'change-major-mode-hook #'outline-show-all nil t)) (defvar outline-minor-mode-map) @@ -302,7 +299,6 @@ Turning on outline mode calls the value of `text-mode-hook' and then of The value of this variable is checked as part of loading Outline mode. After that, changing the prefix key requires manipulating keymaps." :type 'key-sequence - :group 'outlines :initialize 'custom-initialize-default :set (lambda (sym val) (define-key outline-minor-mode-map outline-minor-mode-prefix nil) @@ -316,7 +312,6 @@ After that, changing the prefix key requires manipulating keymaps." See the command `outline-mode' for more information on this mode." nil " Outl" (list (cons [menu-bar] outline-minor-mode-menu-bar-map) (cons outline-minor-mode-prefix outline-mode-prefix-map)) - :group 'outlines (if outline-minor-mode (progn ;; Turn off this mode if we change major modes. @@ -331,14 +326,8 @@ See the command `outline-mode' for more information on this mode." (remove-from-invisibility-spec '(outline . t)) ;; When turning off outline mode, get rid of any outline hiding. (outline-show-all))) - -(defvar outline-level 'outline-level - "Function of no args to compute a header's nesting level in an outline. -It can assume point is at the beginning of a header line and that the match -data reflects the `outline-regexp'.") -;;;###autoload(put 'outline-level 'risky-local-variable t) -(defvar outline-heading-alist () +(defvar-local outline-heading-alist () "Alist associating a heading for every possible level. Each entry is of the form (HEADING . LEVEL). This alist is used two ways: to find the heading corresponding to @@ -357,7 +346,6 @@ within each set. For example in texinfo mode: Instead of sorting the entries in each set, you can also separate the sets with nil.") -(make-variable-buffer-local 'outline-heading-alist) ;; This used to count columns rather than characters, but that made ^L ;; appear to be at level 2 instead of 1. Columns would be better for @@ -479,9 +467,9 @@ nil for WHICH, or do not pass any argument)." (if current-prefix-arg nil 'subtree)))) (cond ((eq which 'region) - (outline-map-region 'outline-promote (region-beginning) (region-end))) + (outline-map-region #'outline-promote (region-beginning) (region-end))) (which - (outline-map-region 'outline-promote + (outline-map-region #'outline-promote (point) (save-excursion (outline-get-next-sibling) (point)))) (t @@ -518,9 +506,9 @@ nil for WHICH, or do not pass any argument)." (if current-prefix-arg nil 'subtree)))) (cond ((eq which 'region) - (outline-map-region 'outline-demote (region-beginning) (region-end))) + (outline-map-region #'outline-demote (region-beginning) (region-end))) (which - (outline-map-region 'outline-demote + (outline-map-region #'outline-demote (point) (save-excursion (outline-get-next-sibling) (point)))) (t @@ -700,12 +688,12 @@ This puts point at the start of the current subtree, and mark at the end." (goto-char beg))) -(defvar outline-isearch-open-invisible-function nil +(defvar outline-isearch-open-invisible-function + #'outline-isearch-open-invisible "Function called if `isearch' finishes in an invisible overlay. -The function is called with the overlay as its only argument. -If nil, `outline-show-entry' is called to reveal the invisible text.") +The function is called with the overlay as its only argument.") -(put 'outline 'reveal-toggle-invisible 'outline-reveal-toggle-invisible) +(put 'outline 'reveal-toggle-invisible #'outline-reveal-toggle-invisible) (defun outline-flag-region (from to flag) "Hide or show lines from FROM to TO, according to FLAG. If FLAG is nil then text is shown, while if FLAG is t the text is hidden." @@ -719,7 +707,7 @@ If FLAG is nil then text is shown, while if FLAG is t the text is hidden." (overlay-put o 'invisible 'outline) (overlay-put o 'isearch-open-invisible (or outline-isearch-open-invisible-function - 'outline-isearch-open-invisible)))) + #'outline-isearch-open-invisible)))) ;; Seems only used by lazy-lock. I.e. obsolete. (run-hooks 'outline-view-change-hook)) @@ -779,8 +767,7 @@ If FLAG is nil then text is shown, while if FLAG is t the text is hidden." (outline-end-of-heading) (outline-flag-region (point) (progn (outline-next-preface) (point)) t))) -(define-obsolete-function-alias - 'hide-entry 'outline-hide-entry "25.1") +(define-obsolete-function-alias 'hide-entry #'outline-hide-entry "25.1") (defun outline-show-entry () "Show the body directly following this heading. @@ -796,8 +783,7 @@ Show the heading too, if it is currently invisible." (point))) nil))) -(define-obsolete-function-alias - 'show-entry 'outline-show-entry "25.1") +(define-obsolete-function-alias 'show-entry #'outline-show-entry "25.1") (defun outline-hide-body () "Hide all body lines in buffer, leaving all headings visible. @@ -805,8 +791,7 @@ Note that this does not hide the lines preceding the first heading line." (interactive) (outline-hide-region-body (point-min) (point-max))) -(define-obsolete-function-alias - 'hide-body 'outline-hide-body "25.1") +(define-obsolete-function-alias 'hide-body #'outline-hide-body "25.1") (defun outline-hide-region-body (start end) "Hide all body lines between START and END, but not headings." @@ -830,23 +815,21 @@ Note that this does not hide the lines preceding the first heading line." (run-hooks 'outline-view-change-hook)) (define-obsolete-function-alias - 'hide-region-body 'outline-hide-region-body "25.1") + 'hide-region-body #'outline-hide-region-body "25.1") (defun outline-show-all () "Show all of the text in the buffer." (interactive) (outline-flag-region (point-min) (point-max) nil)) -(define-obsolete-function-alias - 'show-all 'outline-show-all "25.1") +(define-obsolete-function-alias 'show-all #'outline-show-all "25.1") (defun outline-hide-subtree () "Hide everything after this heading at deeper levels." (interactive) (outline-flag-subtree t)) -(define-obsolete-function-alias - 'hide-subtree 'outline-hide-subtree "25.1") +(define-obsolete-function-alias 'hide-subtree #'outline-hide-subtree "25.1") (defun outline-hide-leaves () "Hide the body after this heading and at deeper levels." @@ -859,16 +842,14 @@ Note that this does not hide the lines preceding the first heading line." (point) (progn (outline-end-of-subtree) (point))))) -(define-obsolete-function-alias - 'hide-leaves 'outline-hide-leaves "25.1") +(define-obsolete-function-alias 'hide-leaves #'outline-hide-leaves "25.1") (defun outline-show-subtree () "Show everything after this heading at deeper levels." (interactive) (outline-flag-subtree nil)) -(define-obsolete-function-alias - 'show-subtree 'outline-show-subtree "25.1") +(define-obsolete-function-alias 'show-subtree #'outline-show-subtree "25.1") (defun outline-show-heading () "Show the current heading and move to its end." @@ -923,8 +904,7 @@ of the current heading, or to 1 if the current line is not a heading." (outline-flag-region (1- (point)) (point) nil)))) (run-hooks 'outline-view-change-hook)) -(define-obsolete-function-alias - 'hide-sublevels 'outline-hide-sublevels "25.1") +(define-obsolete-function-alias 'hide-sublevels #'outline-hide-sublevels "25.1") (defun outline-hide-other () "Hide everything except current body and parent and top-level headings. @@ -942,8 +922,7 @@ This also unhides the top heading-less body, if any." nil)))) (run-hooks 'outline-view-change-hook)) -(define-obsolete-function-alias - 'hide-other 'outline-hide-other "25.1") +(define-obsolete-function-alias 'hide-other #'outline-hide-other "25.1") (defun outline-toggle-children () "Show or hide the current subtree depending on its current state." @@ -987,8 +966,7 @@ This also unhides the top heading-less body, if any." (interactive) (outline-show-children 1000)) -(define-obsolete-function-alias - 'show-branches 'outline-show-branches "25.1") +(define-obsolete-function-alias 'show-branches #'outline-show-branches "25.1") (defun outline-show-children (&optional level) "Show all direct subheadings of this heading. @@ -1017,8 +995,7 @@ Default is enough to cause the following heading to appear." (if (eobp) (point-max) (1+ (point))))))) (run-hooks 'outline-view-change-hook)) -(define-obsolete-function-alias - 'show-children 'outline-show-children "25.1") +(define-obsolete-function-alias 'show-children #'outline-show-children "25.1") commit 39271ed108380494667ab680fc71b800f9ea5097 Author: Basil L. Contovounesios Date: Tue Oct 20 20:02:29 2020 +0100 ; Fix last change to idlw-complete-structtag.el diff --git a/lisp/progmodes/idlw-complete-structtag.el b/lisp/progmodes/idlw-complete-structtag.el index 120cfcd12b..4cb82786ae 100644 --- a/lisp/progmodes/idlw-complete-structtag.el +++ b/lisp/progmodes/idlw-complete-structtag.el @@ -56,7 +56,7 @@ ;; Load it with the following line in your init file: ;; ;; (with-eval-after-load 'idlwave -;; (require 'idlw-complete-structtag)) +;; (require 'idlw-complete-structtag)) ;; ;; DESCRIPTION ;; =========== commit 39bf2160f3bb69c181f2ffcd54b7316fb0bf3145 Author: Stefan Kangas Date: Tue Oct 20 20:14:24 2020 +0200 Use lexical-binding in m4-mode.el * lisp/progmodes/m4-mode.el: Use lexical-binding. Remove redundant :group args. * lisp/progmodes/m4-mode.el (m4-m4-buffer, m4-m4-region): Quote function symbols as such. diff --git a/lisp/progmodes/m4-mode.el b/lisp/progmodes/m4-mode.el index 95fead9b37..ec0f425de9 100644 --- a/lisp/progmodes/m4-mode.el +++ b/lisp/progmodes/m4-mode.el @@ -1,4 +1,4 @@ -;;; m4-mode.el --- m4 code editing commands for Emacs +;;; m4-mode.el --- m4 code editing commands for Emacs -*- lexical-binding:t -*- ;; Copyright (C) 1996-1997, 2001-2020 Free Software Foundation, Inc. @@ -48,14 +48,12 @@ "File name of the m4 executable. If m4 is not in your PATH, set this to an absolute file name." :version "24.4" - :type 'file - :group 'm4) + :type 'file) ;;options to m4 (defcustom m4-program-options nil "Options to pass to `m4-program'." - :type '(repeat string) - :group 'm4) + :type '(repeat string)) ;;to use --prefix-builtins, you can use ;;(defconst m4-program-options '("-P")) @@ -72,8 +70,7 @@ If m4 is not in your PATH, set this to an absolute file name." (defcustom m4-mode-hook nil "Hook called by `m4-mode'." - :type 'hook - :group 'm4) + :type 'hook) ;;this may still need some work (defvar m4-mode-syntax-table @@ -125,7 +122,7 @@ If m4 is not in your PATH, set this to an absolute file name." (interactive) (shell-command-on-region (point-min) (point-max) - (mapconcat 'identity (cons m4-program m4-program-options) "\s") + (mapconcat #'identity (cons m4-program m4-program-options) "\s") "*m4-output*" nil) (switch-to-buffer-other-window "*m4-output*")) @@ -134,7 +131,7 @@ If m4 is not in your PATH, set this to an absolute file name." (interactive) (shell-command-on-region (point) (mark) - (mapconcat 'identity (cons m4-program m4-program-options) "\s") + (mapconcat #'identity (cons m4-program m4-program-options) "\s") "*m4-output*" nil) (switch-to-buffer-other-window "*m4-output*")) commit 6c58d900427e8195c5cfc37e7422bdb0bc73c047 Author: Stefan Kangas Date: Tue Oct 20 19:10:51 2020 +0200 Make more load-hooks obsolete (Bug#21563) * lisp/progmodes/dcl-mode.el (dcl-mode): * lisp/progmodes/idlw-complete-structtag.el: Recommend with-eval-after-load instead of load-hooks. * lisp/calc/calc-ext.el (calc-ext-load-hook): * lisp/emacs-lisp/bytecomp.el (bytecomp-load-hook): * lisp/emacs-lisp/cl-extra.el (cl-extra-load-hook): * lisp/emacs-lisp/cl-macs.el (cl-macs-load-hook): * lisp/emacs-lisp/cl-seq.el (cl-seq-load-hook): * lisp/gnus/message.el (message-load-hook): * lisp/gnus/nnheader.el (nnheader-load-hook): * lisp/gnus/nnmail.el (nnmail-load-hook): * lisp/progmodes/dcl-mode.el (dcl-mode-load-hook): * lisp/textmodes/tex-mode.el (tex-mode-load-hook): * lisp/whitespace.el (whitespace-load-hook): Obsolete for with-eval-after-load. Note that these variables are never declared, but the byte-compiler will still warn about them if used. diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el index c48d159582..23248ce1bd 100644 --- a/lisp/calc/calc-ext.el +++ b/lisp/calc/calc-ext.el @@ -3458,6 +3458,8 @@ A command spec is a command name symbol, a keyboard macro string, a list containing a numeric entry string, or nil. A key may contain additional specs for Inverse, Hyperbolic, and Inv+Hyp.") +(make-obsolete-variable 'calc-ext-load-hook + "use `with-eval-after-load' instead." "28.1") (run-hooks 'calc-ext-load-hook) (provide 'calc-ext) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index b63d06a584..a547b672b1 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -5259,6 +5259,8 @@ and corresponding effects." byte-compile-variable-ref)))) nil) +(make-obsolete-variable 'bytecomp-load-hook + "use `with-eval-after-load' instead." "28.1") (run-hooks 'bytecomp-load-hook) ;;; bytecomp.el ends here diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el index 5bf74792c0..23c784f9f8 100644 --- a/lisp/emacs-lisp/cl-extra.el +++ b/lisp/emacs-lisp/cl-extra.el @@ -910,6 +910,8 @@ Outputs to the current buffer." (mapc #'cl--describe-class-slot cslots)))) +(make-obsolete-variable 'cl-extra-load-hook + "use `with-eval-after-load' instead." "28.1") (run-hooks 'cl-extra-load-hook) ;; Local variables: diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 147a0a8f5a..1501ed4308 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -3430,6 +3430,8 @@ STRUCT and SLOT-NAME are symbols. INST is a structure instance." (nth (cl-struct-slot-offset ,struct-type ,slot-name) ,inst) (aref ,inst (cl-struct-slot-offset ,struct-type ,slot-name))))))) +(make-obsolete-variable 'cl-macs-load-hook + "use `with-eval-after-load' instead." "28.1") (run-hooks 'cl-macs-load-hook) ;; Local variables: diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el index f90cce9b47..d34d50172d 100644 --- a/lisp/emacs-lisp/cl-seq.el +++ b/lisp/emacs-lisp/cl-seq.el @@ -1042,6 +1042,8 @@ Atoms are compared by `eql'; cons cells are compared recursively. (and (not (consp cl-x)) (not (consp cl-y)) (cl--check-match cl-x cl-y))) +(make-obsolete-variable 'cl-seq-load-hook + "use `with-eval-after-load' instead." "28.1") (run-hooks 'cl-seq-load-hook) ;; Local variables: diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 7d89739197..150f70e240 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -8863,6 +8863,8 @@ will then start up Emacs ready to compose mail." (provide 'message) +(make-obsolete-variable 'message-load-hook + "use `with-eval-after-load' instead." "28.1") (run-hooks 'message-load-hook) ;; Local Variables: diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el index 67dc379ef8..2952e20928 100644 --- a/lisp/gnus/nnheader.el +++ b/lisp/gnus/nnheader.el @@ -1067,6 +1067,8 @@ See `find-file-noselect' for the arguments." (setq nnheader-last-message-time now) (apply 'nnheader-message args)))) +(make-obsolete-variable 'nnheader-load-hook + "use `with-eval-after-load' instead." "28.1") (run-hooks 'nnheader-load-hook) (provide 'nnheader) diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el index b6308140fc..57801d6f9e 100644 --- a/lisp/gnus/nnmail.el +++ b/lisp/gnus/nnmail.el @@ -2082,6 +2082,8 @@ Doesn't change point." (format "%S" split) "\n")))) +(make-obsolete-variable 'nnmail-load-hook + "use `with-eval-after-load' instead." "28.1") (run-hooks 'nnmail-load-hook) (provide 'nnmail) diff --git a/lisp/progmodes/dcl-mode.el b/lisp/progmodes/dcl-mode.el index ab3321f686..ca45795adc 100644 --- a/lisp/progmodes/dcl-mode.el +++ b/lisp/progmodes/dcl-mode.el @@ -557,8 +557,7 @@ Variables controlling indentation style and extra features: dcl-imenu-label-call Change the text that is used as sub-listing labels in imenu. -Loading this package calls the value of the variable -`dcl-mode-load-hook' with no args, if that value is non-nil. +To run code after DCL mode has loaded, use `with-eval-after-load'. Turning on DCL mode calls the value of the variable `dcl-mode-hook' with no args, if that value is non-nil. @@ -2192,6 +2191,8 @@ otherwise return nil." (provide 'dcl-mode) +(make-obsolete-variable 'dcl-mode-load-hook + "use `with-eval-after-load' instead." "28.1") (run-hooks 'dcl-mode-load-hook) ; for your customizations ;;; dcl-mode.el ends here diff --git a/lisp/progmodes/idlw-complete-structtag.el b/lisp/progmodes/idlw-complete-structtag.el index 3bc3971f5e..120cfcd12b 100644 --- a/lisp/progmodes/idlw-complete-structtag.el +++ b/lisp/progmodes/idlw-complete-structtag.el @@ -53,11 +53,10 @@ ;; ;; INSTALLATION ;; ============ -;; Put this file on the emacs load path and load it with the following -;; line in your init file: +;; Load it with the following line in your init file: ;; -;; (add-hook 'idlwave-load-hook -;; (lambda () (require 'idlw-complete-structtag))) +;; (with-eval-after-load 'idlwave +;; (require 'idlw-complete-structtag)) ;; ;; DESCRIPTION ;; =========== diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el index 11db25cb7a..37ab11ad89 100644 --- a/lisp/textmodes/tex-mode.el +++ b/lisp/textmodes/tex-mode.el @@ -3541,6 +3541,8 @@ There might be text before point." (process-send-region tex-chktex--process (point-min) (point-max)) (process-send-eof tex-chktex--process)))) +(make-obsolete-variable 'tex-mode-load-hook + "use `with-eval-after-load' instead." "28.1") (run-hooks 'tex-mode-load-hook) (provide 'tex-mode) diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 669057811a..94ed6dc47f 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -2473,7 +2473,8 @@ It should be added buffer-locally to `write-file-functions'." (provide 'whitespace) - +(make-obsolete-variable 'whitespace-load-hook + "use `with-eval-after-load' instead." "28.1") (run-hooks 'whitespace-load-hook) commit 4a575eb18cca3eed5019f2d2d2abeea1f0c07005 Author: Stefan Kangas Date: Tue Sep 22 00:16:22 2020 +0200 byte-compile-file: Make optional LOAD argument obsolete * lisp/emacs-lisp/bytecomp.el (byte-compile-file): Declare optional LOAD argument obsolete. Adjust callers. (Bug#38072) (byte-recompile-file): Declare optional LOAD argument obsolete. * doc/lispref/compile.texi (Compilation Functions): Update documentation to reflect above obsoletion. * etc/NEWS: Announce above obsoletion. diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi index e979fda41e..ad8afaae60 100644 --- a/doc/lispref/compile.texi +++ b/doc/lispref/compile.texi @@ -164,7 +164,7 @@ echo area, but if @var{arg} is non-@code{nil}, it inserts the result in the current buffer after the form it has compiled. @end deffn -@deffn Command byte-compile-file filename &optional load +@deffn Command byte-compile-file filename This function compiles a file of Lisp code named @var{filename} into a file of byte-code. The output file's name is made by changing the @samp{.el} suffix into @samp{.elc}; if @var{filename} does not end in @@ -180,9 +180,6 @@ input file is read. This command returns @code{t} if there were no errors and @code{nil} otherwise. When called interactively, it prompts for the file name. -If @var{load} is non-@code{nil}, this command loads the compiled file -after compiling it. Interactively, @var{load} is the prefix argument. - @example @group $ ls -l push* diff --git a/etc/NEWS b/etc/NEWS index c571fa95d1..f3e3d9a1b6 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1500,6 +1500,11 @@ This is no longer supported, and setting this variable has no effect. ** The macro 'with-displayed-buffer-window' is now obsolete. Use macro 'with-current-buffer-window' with action alist entry 'body-function'. ++++ +** `byte-compile-file' optional argument LOAD is now obsolete. +To load the file after byte-compiling, add a call to 'load' from Lisp +or use 'M-x emacs-lisp-byte-compile-and-load' interactively. + ** The metamail.el library is now marked obsolete. --- diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 90809a929b..b63d06a584 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -1845,10 +1845,9 @@ compile FILENAME. If optional argument ARG is 0, it compiles the input file even if the `.elc' file does not exist. Any other non-nil value of ARG means to ask the user. -If optional argument LOAD is non-nil, loads the file after compiling. - If compilation is needed, this functions returns the result of `byte-compile-file'; otherwise it returns `no-byte-compile'." + (declare (advertised-calling-convention (filename &optional force arg) "28.1")) (interactive (let ((file buffer-file-name) (file-name nil) @@ -1877,7 +1876,9 @@ If compilation is needed, this functions returns the result of (progn (if (and noninteractive (not byte-compile-verbose)) (message "Compiling %s..." filename)) - (byte-compile-file filename load)) + (byte-compile-file filename) + (when load + (load (if (file-exists-p dest) dest filename)))) (when load (load (if (file-exists-p dest) dest filename))) 'no-byte-compile))) @@ -1901,8 +1902,10 @@ If compilation is needed, this functions returns the result of "Compile a file of Lisp code named FILENAME into a file of byte code. The output file's name is generated by passing FILENAME to the function `byte-compile-dest-file' (which see). -With prefix arg (noninteractively: 2nd arg), LOAD the file after compiling. -The value is non-nil if there were no errors, nil if errors." +The value is non-nil if there were no errors, nil if errors. + +See also `emacs-lisp-byte-compile-and-load'." + (declare (advertised-calling-convention (filename) "28.1")) ;; (interactive "fByte compile file: \nP") (interactive (let ((file buffer-file-name) @@ -2068,7 +2071,7 @@ The value is non-nil if there were no errors, nil if errors." (insert (format "%S\n" (cons var filename)))) (write-region (point-min) (point-max) dynvar-file))))) (if load - (load target-file)) + (load target-file)) t)))) ;;; compiling a single function diff --git a/lisp/org/org.el b/lisp/org/org.el index 7733198c58..1ab8ab6888 100644 --- a/lisp/org/org.el +++ b/lisp/org/org.el @@ -223,7 +223,8 @@ byte-compiled before it is loaded." (org-babel-tangle-file file tangled-file "emacs-lisp")) (if compile (progn - (byte-compile-file tangled-file 'load) + (byte-compile-file tangled-file) + (load tangled-file) (message "Compiled and loaded %s" tangled-file)) (load-file tangled-file) (message "Loaded %s" tangled-file)))) diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el index dbbb1274fa..eed73f5791 100644 --- a/lisp/progmodes/elisp-mode.el +++ b/lisp/progmodes/elisp-mode.el @@ -196,7 +196,8 @@ All commands in `lisp-mode-shared-map' are inherited by this map.") (if (and (buffer-modified-p) (y-or-n-p (format "Save buffer %s first? " (buffer-name)))) (save-buffer)) - (byte-recompile-file buffer-file-name nil 0 t)) + (byte-recompile-file buffer-file-name nil 0) + (load buffer-file-name)) (defun emacs-lisp-macroexpand () "Macroexpand the form after point. diff --git a/lisp/speedbar.el b/lisp/speedbar.el index aab6a3a128..9c5f028e4a 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -1392,7 +1392,7 @@ Argument ARG represents to force a refresh past any caches that may exist." (if (and (file-exists-p f) (string-match "\\.el\\'" f)) (progn (dframe-select-attached-frame speedbar-frame) - (byte-compile-file f nil) + (byte-compile-file f) (select-frame sf) (speedbar-reset-scanners))) )) diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index a9dcf15261..ea5aacd791 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -444,8 +444,8 @@ Subtests signal errors if something goes wrong." (if compile (let ((byte-compile-dest-file-function (lambda (e) elcfile))) - (byte-compile-file elfile t)) - (load elfile nil 'nomessage))) + (byte-compile-file elfile))) + (load elfile nil 'nomessage)) (when elfile (delete-file elfile)) (when elcfile (delete-file elcfile))))) (put 'test-byte-comp-compile-and-load 'lisp-indent-function 1) @@ -646,7 +646,8 @@ literals (Bug#20852)." (setq bytecomp-tests--foobar (bytecomp-tests--foobar)))) (print form (current-buffer))) (write-region (point-min) (point-max) source nil 'silent) - (byte-compile-file source t) + (byte-compile-file source) + (load source) (should (equal bytecomp-tests--foobar (cons 1 2))))) (ert-deftest bytecomp-tests--test-no-warnings-with-advice () commit 1841b13282473b0ed8c591974e89bd781026180d Author: Basil L. Contovounesios Date: Tue Oct 20 17:35:29 2020 +0100 Simplify regexp in last change to woman.el * lisp/woman.el (woman-decode-region): Use simpler character alternative instead of alternation. diff --git a/lisp/woman.el b/lisp/woman.el index 52f610b569..96ae7fe579 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -2292,7 +2292,7 @@ Currently set only from \\='\\\" t in the first line of the source file.") ;; Ignore the \, and \/ kerning operators. See ;; https://www.gnu.org/software/groff/manual/groff.html#Ligatures-and-Kerning (goto-char (point-min)) - (while (re-search-forward "\\\\,\\|\\\\/" nil t) + (while (re-search-forward "\\\\[,/]" nil t) (replace-match "" t t)) ;; Hide unpaddable and digit-width spaces \(space) and \0: commit ec4f2723c13321f2abe6aa57035146d80b640db6 Author: Basil L. Contovounesios Date: Tue Oct 20 17:28:26 2020 +0100 Simplify syntax of shortdoc face specs * lisp/emacs-lisp/shortdoc.el: Remove unused dependency. (shortdoc-section, shortdoc-example): Use newer (DISPLAY . PLIST) face spec syntax. diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el index f6309c7652..7ae6d53a21 100644 --- a/lisp/emacs-lisp/shortdoc.el +++ b/lisp/emacs-lisp/shortdoc.el @@ -24,7 +24,6 @@ ;;; Code: -(require 'macroexp) (require 'seq) (eval-when-compile (require 'cl-lib)) @@ -34,18 +33,16 @@ (defface shortdoc-section '((((class color) (background dark)) - (:inherit variable-pitch - :background "#303030" :extend t)) + :inherit variable-pitch :background "#303030" :extend t) (((class color) (background light)) - (:inherit variable-pitch - :background "#f0f0f0" :extend t))) + :inherit variable-pitch :background "#f0f0f0" :extend t)) "Face used for a section.") (defface shortdoc-example '((((class color) (background dark)) - (:background "#202020" :extend t)) + :background "#202020" :extend t) (((class color) (background light)) - (:background "#e8e8e8" :extend t))) + :background "#e8e8e8" :extend t)) "Face used for examples.") (defvar shortdoc--groups nil) commit 6a946d29a119b9cf7d05c04d5751b18b6438ef4e Author: Stefan Kangas Date: Tue Oct 20 18:26:38 2020 +0200 Tweak test data for signed package installation * test/lisp/emacs-lisp/package-resources/signed/signed-bad-1.0.el: * test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el: Use lexical-binding. * test/lisp/emacs-lisp/package-resources/signed/update-signatures.sh: New file. * test/lisp/emacs-lisp/package-resources/key.pub: * test/lisp/emacs-lisp/package-resources/key.sec: Add new key. * test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el.sig: * test/lisp/emacs-lisp/package-resources/signed/archive-contents.sig: Update signatures using new key. diff --git a/test/lisp/emacs-lisp/package-resources/key.pub b/test/lisp/emacs-lisp/package-resources/key.pub index a326d34e54..5e2ebc55d3 100644 --- a/test/lisp/emacs-lisp/package-resources/key.pub +++ b/test/lisp/emacs-lisp/package-resources/key.pub @@ -1,18 +1,20 @@ -----BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.4.14 (GNU/Linux) -mQENBFJNB8gBCACfbtpvYrM8V1HM0KFlIwatcEJugHqwOHpr/Z9mrCW0fxyQAW/d -2L+3QVNsN9Tz/K9lLcBUgeR7rhVEzHNqhmhNj/HnikwGqXbIofhp+QbZmBKnAlCz -d77kg8K9lozHtfTkm1gX/7DdPzQKmgi7WOzzi2395wGubeqJLvYaEcqVbI0Eob+E -3CzRjNy/e/Tf3TJRW5etTcdZN6LVuIY7tNCHqlQZTwyycON/hfLTX6cLCnzDsqm/ -NxCuwn9aqP9aGRGfIu7Y+If3zTymvrXEPUN98OEID814bOKdx0uVTZRiSMbvuTGI -8uMa/kpGX/78rqI61gbZV51RFoU7pT2tzwY/ABEBAAG0HkouIFIuIEhhY2tlciA8 -anJoQGV4YW1wbGUuY29tPokBOAQTAQIAIgUCUk0HyAIbAwYLCQgHAwIGFQgCCQoL -BBYCAwECHgECF4AACgkQtpVAhgkYletuhQf+JAyHYhTZNxjq0UYlikuLX8EtYbXX -PB+03J0B73SMzEai5XsiTU2ADxqxwr7pveVK1INf+IGLiiXBlQq+4DSOvQY4xLfp -58jTOYRV1ECvlXK/JtvVOwufXREADaydf9l/MUxA5G2PPBWIuQknh3ysPSsx68OJ -SzNHFwklLn0DKc4WloE/GLDpTzimnCg7QGzuUo3Iilpjdy8EvTdI5d3jx/mGJIwI -goB+YZgyxSPM+GjDwh5DEwD7OexNqqa7RynnmU0epmlYyi9UufCHLwgiiEIzjpWi -6+iF+CQ45ZAKncovByenIUv73J3ImOudrsskeAHBmahljv1he6uV9Egj2Q== -=b5Kg +mI0EX48EbAEEANrsWXyZ4MRZRjVbLAh5jX/+1+31oB/aJ/q/5DkH1qUHJf0La9LC +sykUSM3H2u5VWLytX/ozrxIRYX13GR2xBxyJlUkDWB209AAVLFrjSp1yUX/Sb5SU +Kb7p421ZAeHiOxfnLRuErFZkTfzY19mUCyw4cdamw430V3mUC9uns/d9ABEBAAG0 +LUouIFJhbmRvbSBIYWNrZXIgKFRFU1QgS0VZKSA8anJoQGV4YW1wbGUub3JnPojO +BBMBCgA4FiEEHP310DrP36xrZ1kSMKdkJgeTYhoFAl+PBGwCGwMFCwkIBwIGFQoJ +CAsCBBYCAwECHgECF4AACgkQMKdkJgeTYhq9MQP7BYkCk8r5G777Ilp8kWjsEIo3 +aDX9jORiNfMAGys/aLjjEajHFAlTQKfSLm/VXLDYtK28c8ACjThQagaDF46MRWqQ +rFFiH4IAZRgj2ELj+/j1ljQZjGjKR2Yx4BCDhbumz8zeMSPL6yFT5+8LOMUAtdv4 +lEPWXW0AycylbdbE7024jQRfjwRsAQQApjTw9kONmSVouCi8ZIQwwYiA9tLzbSZv +CYxbJ6KH0icRhBLfdb1hL/Kn8x3k+xll9A0c/ABVkMxRcbQkY98xsFck7E2GcvnC +sY+w/NdcUUZJYMB3l2MH5ojCbOk5jSAZzxzeFcJhNAhmLqomMHg2LI6KDVey6iYU +FxyIpIQ3SlkAEQEAAYi2BBgBCgAgFiEEHP310DrP36xrZ1kSMKdkJgeTYhoFAl+P +BGwCGwwACgkQMKdkJgeTYhrtywQAhoCR/skBSQWWBI10N0qhtdlNxbpvK8ErSPKw +wS74Pq407Zv0VD9ual/HC3Uet2z8LeG9ZwU4Jd23g96fmJt7AM9CQWrOhC242JYr +YSqWxANyek8otsvppJNHtt2Stmknv7XbJFFB1JDC8WKo8lVo9/MkmzROxuEFEvOU +Yn923VI= +=NRtx -----END PGP PUBLIC KEY BLOCK----- diff --git a/test/lisp/emacs-lisp/package-resources/key.sec b/test/lisp/emacs-lisp/package-resources/key.sec index d21e6ae9a4..dbc80f43cb 100644 --- a/test/lisp/emacs-lisp/package-resources/key.sec +++ b/test/lisp/emacs-lisp/package-resources/key.sec @@ -1,33 +1,35 @@ -----BEGIN PGP PRIVATE KEY BLOCK----- -Version: GnuPG v1.4.14 (GNU/Linux) -lQO+BFJNB8gBCACfbtpvYrM8V1HM0KFlIwatcEJugHqwOHpr/Z9mrCW0fxyQAW/d -2L+3QVNsN9Tz/K9lLcBUgeR7rhVEzHNqhmhNj/HnikwGqXbIofhp+QbZmBKnAlCz -d77kg8K9lozHtfTkm1gX/7DdPzQKmgi7WOzzi2395wGubeqJLvYaEcqVbI0Eob+E -3CzRjNy/e/Tf3TJRW5etTcdZN6LVuIY7tNCHqlQZTwyycON/hfLTX6cLCnzDsqm/ -NxCuwn9aqP9aGRGfIu7Y+If3zTymvrXEPUN98OEID814bOKdx0uVTZRiSMbvuTGI -8uMa/kpGX/78rqI61gbZV51RFoU7pT2tzwY/ABEBAAH+AwMCKCCpPNXkXuVgF7cz -eByuvgIO7wImDYGOdJqsASSzV4q0u1acnGtlxg7WphKDF9RnC5+1ZZ1ZcrBcv2uJ -xZm2jHdjqM3FmgQTN70GVzO1nKEur2wxlKotG4Q+8BtaRDwHdKpQFk+QW9aInH3C -BkNWTK97iFwZaoUGxKuRJb35qjMe3SsDE7kdbtOqO+tOeppRVeOOZCn7F33ir/6i -j2gmIME6LFDzvBi6YAyMBSh90Ak70HJINt0QfXlZf5MtX1NaxaEcnsRmwwcNqxh9 -JvcC9q4WrR92NhHCHI+lOsAe7hbwo/VkwRjSSx0HdKkx6kvdcNj/9LeX/jykzLvg -kEqvAqT4Jmk57W2seqvpNcAO+eUVrJ5D1OR6khsUtikPp2pQH5MDXJDGcie+ZAFb -w6BwoWBDBjooKtfuP0LKqrdtJG2JLe6yhBhWvfqHPBlUU1SsA7a5aTCLo8FiqgEI -Kyy60zMx/2Mi48oN1a/mAoV1MTWLhOVUWJlIHM7nVLj1OaX0316LcLX/uTLTq40p -apHKwERanzY7f8ROiv/Fa/J+9cCsfOLKfjFAjpBVUVoOb39HsyS/vvkGMY4kgaD6 -K6r9JPdsaoYvsLkxk5HyHF7Mk2uS1z1EIArD2/3lRiX6ag+IU1Nl3XDkgfZj06K3 -juS84dGF8CmN49uOEjzAJAQZH9jTs5OKzUuZhGJF+gt0L78vLOoKRr8bu1N1GPqU -wnS908HWruXzjJl1CAhnuCa8FnDaU+tmEKjYpWuelx85kolpMW7LT5gOFZr84MIj -Kq3Rt2hU6qQ7Cdy1ep531YKkmyh9Y4l/Tgir1OtnQQqtNuwHI497l7qAUnKZBBHZ -guApjS9BoHsRXkw2mgDssZ+khOwj/xJm876nFSiQeCD0aIbU/4zJ9e2HUOJAZI1r -d7QeSi4gUi4gSGFja2VyIDxqcmhAZXhhbXBsZS5jb20+iQE4BBMBAgAiBQJSTQfI -AhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRC2lUCGCRiV626FB/4kDIdi -FNk3GOrRRiWKS4tfwS1htdc8H7TcnQHvdIzMRqLleyJNTYAPGrHCvum95UrUg1/4 -gYuKJcGVCr7gNI69BjjEt+nnyNM5hFXUQK+Vcr8m29U7C59dEQANrJ1/2X8xTEDk -bY88FYi5CSeHfKw9KzHrw4lLM0cXCSUufQMpzhaWgT8YsOlPOKacKDtAbO5SjciK -WmN3LwS9N0jl3ePH+YYkjAiCgH5hmDLFI8z4aMPCHkMTAPs57E2qprtHKeeZTR6m -aVjKL1S58IcvCCKIQjOOlaLr6IX4JDjlkAqdyi8HJ6chS/vcnciY652uyyR4AcGZ -qGWO/WF7q5X0SCPZ -=5FZK +lQIGBF+PBGwBBADa7Fl8meDEWUY1WywIeY1//tft9aAf2if6v+Q5B9alByX9C2vS +wrMpFEjNx9ruVVi8rV/6M68SEWF9dxkdsQcciZVJA1gdtPQAFSxa40qdclF/0m+U +lCm+6eNtWQHh4jsX5y0bhKxWZE382NfZlAssOHHWpsON9Fd5lAvbp7P3fQARAQAB +/gcDAngNw4ppSPBe/w734cz++xNEv0TDgwxGBWp2wGSwWao04Nl1U4LkjiIy+dkc +uUPwEZMvxXwMcq10PPH26ifP8Xfi/zANXUoLJ0DsG6rtE3BcSC9MPFe3EJENtcIP +a0jFLsbi72aBzolNEDCZCv93znXFPekaXw/RAeeFLJz8GR2Sx6bHbTJKklXgWPHw +C5Dw6xr/kEZktgjlhjkx280STpLGaFO4jiiGZ4Obp5ePp7kyOzDUzaimdZgJwClT +VbZDNQMTzgQrBOP8doXlo9euW4Wo1IYBIOwgeYieM3ZA9YjJAmp4lFnk/KFYt0Ak +0H9IWzDU8VERcU4B04PSXahzvB1Ii7C7bbHxPyuu6sAfMK8DRkrGjwgAlrhuWNLX +M07acT/E9Pm+mBlDcdkyKB2LfwgaVb9F3C25sfcFSvc5p+sqgZp1Zx7Qg9pOhQjw +U7Ln+96c0bUl+iQKdm3TGjOXAFUHYXbRkx2cJ4gxnMVNj0D68xBtBSm0LUouIFJh +bmRvbSBIYWNrZXIgKFRFU1QgS0VZKSA8anJoQGV4YW1wbGUub3JnPojOBBMBCgA4 +FiEEHP310DrP36xrZ1kSMKdkJgeTYhoFAl+PBGwCGwMFCwkIBwIGFQoJCAsCBBYC +AwECHgECF4AACgkQMKdkJgeTYhq9MQP7BYkCk8r5G777Ilp8kWjsEIo3aDX9jORi +NfMAGys/aLjjEajHFAlTQKfSLm/VXLDYtK28c8ACjThQagaDF46MRWqQrFFiH4IA +ZRgj2ELj+/j1ljQZjGjKR2Yx4BCDhbumz8zeMSPL6yFT5+8LOMUAtdv4lEPWXW0A +ycylbdbE702dAgYEX48EbAEEAKY08PZDjZklaLgovGSEMMGIgPbS820mbwmMWyei +h9InEYQS33W9YS/yp/Md5PsZZfQNHPwAVZDMUXG0JGPfMbBXJOxNhnL5wrGPsPzX +XFFGSWDAd5djB+aIwmzpOY0gGc8c3hXCYTQIZi6qJjB4NiyOig1XsuomFBcciKSE +N0pZABEBAAH+BwMCXeUOBwcOsxb/AY6rnHmgACNTGwIa5vgelw0qfET0ms/YzVrN +ufikyV9dEWVxJyuTKav978wanPu7VcCh0pTjL2nTm2nZWyRJN4gb3UIC0MA1xfB2 +yPLTCmsGeJhVOqi4Af/r06mk+NOQ96ivOA2CJuw1LSpcUtuYxB5t/grGyEojYjRP +s0Htvf2bfN9KbFJ26DGsfYzC8bCxm9szPFHBQjw4NboCigUSAHmkoTW01aWZU9Vq +brY4cWhdmCqHgfmsQgzP3LfaAQ6kJ/bkuKef7z57lz5XmlyjMQGWcZWp5xf2n81p +BV6unaIPyavzkKVAXizVfNiHNJgK9PoVoEOJkPLjRfMxVmFSGN/oF7lVTRWfOIwo +68rtNPhr6UzE4ArGHYv/pK3kijUp5daWmfrySWPcwoVAaR3mIIVs/1rhd9aZrwn6 +Q07Yo5u11rH9b8anZQF3BdTcrnU9pUzLYlFPnfhtyGqhikQILtPTf0iwr8hpG9b2 +Zoi2BBgBCgAgFiEEHP310DrP36xrZ1kSMKdkJgeTYhoFAl+PBGwCGwwACgkQMKdk +JgeTYhrtywQAhoCR/skBSQWWBI10N0qhtdlNxbpvK8ErSPKwwS74Pq407Zv0VD9u +al/HC3Uet2z8LeG9ZwU4Jd23g96fmJt7AM9CQWrOhC242JYrYSqWxANyek8otsvp +pJNHtt2Stmknv7XbJFFB1JDC8WKo8lVo9/MkmzROxuEFEvOUYn923VI= +=2DW8 -----END PGP PRIVATE KEY BLOCK----- diff --git a/test/lisp/emacs-lisp/package-resources/signed/archive-contents.sig b/test/lisp/emacs-lisp/package-resources/signed/archive-contents.sig index 658edd3f60..dac168b0e4 100644 Binary files a/test/lisp/emacs-lisp/package-resources/signed/archive-contents.sig and b/test/lisp/emacs-lisp/package-resources/signed/archive-contents.sig differ diff --git a/test/lisp/emacs-lisp/package-resources/signed/signed-bad-1.0.el b/test/lisp/emacs-lisp/package-resources/signed/signed-bad-1.0.el index 3734823876..ff070c6526 100644 --- a/test/lisp/emacs-lisp/package-resources/signed/signed-bad-1.0.el +++ b/test/lisp/emacs-lisp/package-resources/signed/signed-bad-1.0.el @@ -1,4 +1,4 @@ -;;; signed-bad.el --- A single-file package with bad signature +;;; signed-bad.el --- A single-file package with bad signature -*- lexical-binding: t -*- ;; Author: J. R. Hacker ;; Version: 1.0 diff --git a/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el b/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el index 22718df276..60b1b8663d 100644 --- a/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el +++ b/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el @@ -1,4 +1,4 @@ -;;; signed-good.el --- A single-file package with good signature +;;; signed-good.el --- A single-file package with good signature -*- lexical-binding: t -*- ;; Author: J. R. Hacker ;; Version: 1.0 diff --git a/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el.sig b/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el.sig index 747918794c..5b1c721e32 100644 Binary files a/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el.sig and b/test/lisp/emacs-lisp/package-resources/signed/signed-good-1.0.el.sig differ diff --git a/test/lisp/emacs-lisp/package-resources/signed/update-signatures.sh b/test/lisp/emacs-lisp/package-resources/signed/update-signatures.sh new file mode 100755 index 0000000000..a48c9bb1aa --- /dev/null +++ b/test/lisp/emacs-lisp/package-resources/signed/update-signatures.sh @@ -0,0 +1,32 @@ +#! /bin/sh + +# Generate a new key and update the signatures for tests. + +# Copyright (C) 2020 Free Software Foundation, Inc. + +# This file is part of GNU Emacs. + +# GNU Emacs is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# GNU Emacs is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with GNU Emacs. If not, see . + +export GPG_AGENT="" +KEYRING="./key.ring" +TRUSTDB="./trust.db" +GPG="gpg --no-default-keyring --trustdb-name $TRUSTDB --keyring $KEYRING --yes" + +rm $KEYRING +$GPG --full-generate-key +$GPG --export --armor > "../key.pub" +$GPG --export-secret-keys -armor > "../key.sec" +$GPG --detach-sign --sign "./archive-contents" +$GPG --detach-sign --sign "./signed-good-1.0.el" commit 5f9fb508e6dcc25462b3c9a5595a3ec87903720c Author: Mattias Engdegård Date: Tue Oct 20 17:27:31 2020 +0200 * lisp/textmodes/picture.el: Use lexical binding. diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el index 7a82f8f0e6..5216812b58 100644 --- a/lisp/textmodes/picture.el +++ b/lisp/textmodes/picture.el @@ -1,4 +1,4 @@ -;;; picture.el --- "Picture mode" -- editing using quarter-plane screen model +;;; picture.el --- "Picture mode" -- editing using quarter-plane screen model -*- lexical-binding: t -*- ;; Copyright (C) 1985, 1994, 2001-2020 Free Software Foundation, Inc. commit d3c3fe781424c866ad64ce9a8e3b649b30a0b5ae Author: Eli Zaretskii Date: Tue Oct 20 18:27:47 2020 +0300 Avoid assertion violations in malformed Unicode escapes * src/lread.c (read_escape): Produce better diagnostic for malformed \u Unicode escapes, while avoiding assertion violation when READCHAR returns -1 because the input is exhausted. (Bug#44084) diff --git a/src/lread.c b/src/lread.c index 4b788e9940..a3d5fd7bb8 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2573,6 +2573,13 @@ read_escape (Lisp_Object readcharfun, bool stringp) while (++count <= unicode_hex_count) { c = READCHAR; + if (c < 0) + { + if (unicode_hex_count > 4) + error ("Malformed Unicode escape: \\U%x", i); + else + error ("Malformed Unicode escape: \\u%x", i); + } /* `isdigit' and `isalpha' may be locale-specific, which we don't want. */ int digit = char_hexdigit (c); commit 01e0357ba77031dfc66a00822a034e561c0c1ccc Author: Stefan Kangas Date: Tue Oct 20 15:41:04 2020 +0200 * lisp/language/utf-8-lang.el: Use lexical-binding. diff --git a/lisp/language/utf-8-lang.el b/lisp/language/utf-8-lang.el index 78fbae3c89..9e59f61ee1 100644 --- a/lisp/language/utf-8-lang.el +++ b/lisp/language/utf-8-lang.el @@ -1,4 +1,4 @@ -;;; utf-8-lang.el --- generic UTF-8 language environment +;;; utf-8-lang.el --- generic UTF-8 language environment -*- lexical-binding: t -*- ;; Copyright (C) 2001-2020 Free Software Foundation, Inc. commit 0d25e274d7a087795f2f167fa39ff5509b9ddf31 Author: Bastien Guerry Date: Tue Oct 20 15:01:02 2020 +0200 ; * etc/tutorials/TUTORIAL.fr: Fix typo. diff --git a/etc/tutorials/TUTORIAL.fr b/etc/tutorials/TUTORIAL.fr index bc94f9ac62..3148c3f07e 100644 --- a/etc/tutorials/TUTORIAL.fr +++ b/etc/tutorials/TUTORIAL.fr @@ -917,7 +917,7 @@ que vous recherchez. termine une recherche. Avez-vous vu ce qui se passait ? Emacs, dans une recherche incrémentale, essaie d'aller sur l'occurrence de la chaîne que vous -avec tapée jusqu'à cet instant. Pour aller sur l'occurrence suivante de +avez tapée jusqu'à cet instant. Pour aller sur l'occurrence suivante de « curseur », il suffit de refaire C-s : s'il ne trouve rien, Emacs bippe et vous indique que la recherche a échoué. C-g permet également de mettre fin à la recherche. commit 4ef8c4a0f4e26f6ea2186a2b80c068b8d93e4993 Author: Lars Ingebrigtsen Date: Tue Oct 20 13:28:29 2020 +0200 Tweak the documentation for define-obsolete-variable-alias * doc/lispref/variables.texi (Variable Aliases): Actually describe the macro parameters (bug#44088). * lisp/emacs-lisp/byte-run.el (define-obsolete-variable-alias): Ditto (bug#44088). diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 6c0b3b5be1..394fb96acb 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -2385,6 +2385,14 @@ equivalent to the following: (defvaralias @var{obsolete-name} @var{current-name} @var{docstring}) (make-obsolete-variable @var{obsolete-name} @var{current-name} @var{when}) @end example + +This macro evaluates all its parameters, and both @var{obsolete-name} +and @var{current-name} should be symbols, so a typical usage would +look like: + +@lisp +(define-obsolete-variable-alias 'foo-thing 'bar-thing "27.1") +@end lisp @end defmac @defun indirect-variable variable diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 5279a57cd0..27f54d0ca2 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -432,7 +432,16 @@ ACCESS-TYPE if non-nil should specify the kind of access that will trigger (defmacro define-obsolete-variable-alias (obsolete-name current-name &optional when docstring) "Make OBSOLETE-NAME a variable alias for CURRENT-NAME and mark it obsolete. -This uses `defvaralias' and `make-obsolete-variable' (which see). + +WHEN should be a string indicating when the variable was first +made obsolete, for example a date or a release number. + +This macro evaluates all its parameters, and both OBSOLETE-NAME +and CURRENT-NAME should be symbols, so a typical usage would look like: + + (define-obsolete-variable-alias 'foo-thing 'bar-thing \"27.1\") + +This macro uses `defvaralias' and `make-obsolete-variable' (which see). See the Info node `(elisp)Variable Aliases' for more details. If CURRENT-NAME is a defcustom or a defvar (more generally, any variable @@ -446,9 +455,6 @@ dumped with Emacs). This is so that any user customizations are applied before the defcustom tries to initialize the variable (this is due to the way `defvaralias' works). -WHEN should be a string indicating when the variable was first -made obsolete, for example a date or a release number. - For the benefit of Customize, if OBSOLETE-NAME has any of the following properties, they are copied to CURRENT-NAME, if it does not already have them: commit e3fa592899f6999fda9fdaaab3929f346ce67f66 Author: Masahiro Nakamura Date: Tue Oct 20 13:20:48 2020 +0200 Fix some mpc.el updating quirks * lisp/mpc.el (mpc-songs-jump-to): Update the status buffer. * lisp/mpc.el (mpc-stop): M-x mpc-stop clears playlist queue. So updating *MPC-Songs* buffer is useful. * lisp/mpc.el (mpc-cmd-delete): I noticed M-x mpc-playlist-delete always messages “Deleted 1 songs” even if playlist queue has more than one songs. This is because mpc-cmd-delete’s sort modifies songs-poss by side effect. Using copy-sequence fixes this (bug#44093). * lisp/mpc.el (mpc-cmd-move): Ditto. diff --git a/lisp/mpc.el b/lisp/mpc.el index d22b7ab450..fade23e3cc 100644 --- a/lisp/mpc.el +++ b/lisp/mpc.el @@ -819,8 +819,8 @@ The songs are returned as alists." (defun mpc-cmd-status () (mpc-proc-cmd-to-alist "status")) -(defun mpc-cmd-play () - (mpc-proc-cmd "play") +(defun mpc-cmd-play (&optional sn) + (mpc-proc-cmd (if sn (list "play" sn) "play")) (mpc-status-refresh)) (defun mpc-cmd-seekcur (time) @@ -849,7 +849,7 @@ If PLAYLIST is t or nil or missing, use the main playlist." ;; Sort them from last to first, so the renumbering ;; caused by the earlier deletions don't affect ;; later ones. - (sort song-poss '>)))) + (sort (copy-sequence song-poss) '>)))) (if (stringp playlist) (puthash (cons 'Playlist playlist) nil mpc--find-memoize))) @@ -873,7 +873,7 @@ If PLAYLIST is t or nil or missing, use the main playlist." ;; Sort them from last to first, so the renumbering ;; caused by the earlier deletions affect ;; later ones a bit less. - (sort song-poss '>)))) + (sort (copy-sequence song-poss) '>)))) (if (stringp playlist) (puthash (cons 'Playlist playlist) nil mpc--find-memoize)))) @@ -2089,7 +2089,7 @@ This is used so that they can be compared with `eq', which is needed for ((null (with-current-buffer plbuf (re-search-forward re nil t))) ;; song-file only appears once in the playlist: no ambiguity, ;; we're good to go! - (mpc-proc-cmd (list "play" sn))) + (mpc-cmd-play sn)) (t ;; The song appears multiple times in the playlist. If the current ;; buffer holds not only the destination song but also the current @@ -2391,6 +2391,7 @@ This is used so that they can be compared with `eq', which is needed for (interactive) (mpc-cmd-stop) (mpc-cmd-clear) + (mpc-songs-refresh) (mpc-status-refresh)) (defun mpc-pause () commit 2e2a8e5491bc6259a9ebe8c703c1c501307953e2 Author: Jim Blandy Date: Tue Oct 20 13:09:16 2020 +0200 Man highlighting: Don't occasionally bold entire sections. * lisp/ansi-color.el (ansi-color-apply-on-region): Always save a restart position in ansi-color-context-region if the region ends with highlighting active. diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index 141ad2353e..c3b2d98c14 100644 --- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el @@ -414,11 +414,17 @@ this." ;; if the rest of the region should have a face, put it there (funcall ansi-color-apply-face-function start-marker end-marker (ansi-color--find-face codes)) - (setq ansi-color-context-region (if codes (list codes))))) + ;; Save a restart position when there are codes active. It's + ;; convenient for man.el's process filter to pass `begin' + ;; positions that overlap regions previously colored; these + ;; `codes' should not be applied to that overlap, so we need + ;; to know where they should really start. + (setq ansi-color-context-region (if codes (list codes end-marker))))) ;; Clean up our temporary markers. (unless (eq start-marker (cadr ansi-color-context-region)) (set-marker start-marker nil)) - (set-marker end-marker nil))) + (unless (eq end-marker (cadr ansi-color-context-region)) + (set-marker end-marker nil)))) (defun ansi-color-apply-overlay-face (beg end face) "Make an overlay from BEG to END, and apply face FACE. commit 117d58ace75fc210c15e6815d965b080466edc55 Author: Lars Ingebrigtsen Date: Tue Oct 20 13:07:25 2020 +0200 Preserve all `eval' elements from both .dir-locals files * lisp/files.el (dir-locals-read-from-dir): Preserve all `eval' elements from both .dir-locals files (bug#44066). diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el index 9073f9c7a5..4656277ea1 100644 --- a/lisp/emacs-lisp/seq.el +++ b/lisp/emacs-lisp/seq.el @@ -474,6 +474,7 @@ Equality is defined by TESTFN if non-nil or by `equal' if nil." (seq-reverse sequence1) '())) +;;;###autoload (cl-defgeneric seq-group-by (function sequence) "Apply FUNCTION to each element of SEQUENCE. Separate the elements of SEQUENCE into an alist using the results as diff --git a/lisp/files.el b/lisp/files.el index c2c58dae93..bbc8f88159 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4301,9 +4301,27 @@ Return the new class name, which is a symbol named DIR." (if (not (and newvars variables)) (or newvars variables) (require 'map) - (map-merge-with 'list (lambda (a b) (map-merge 'list a b)) - variables - newvars)))))) + ;; We want to make the variable setting from + ;; newvars (the second .dir-locals file) take + ;; presedence over the old variables, but we also + ;; want to preserve all `eval' elements as is from + ;; both lists. + (map-merge-with + 'list + (lambda (a b) + (let ((ag + (seq-group-by + (lambda (e) (eq (car e) 'eval)) a)) + (bg + (seq-group-by + (lambda (e) (eq (car e) 'eval)) b))) + (append (map-merge 'list + (assoc-default nil ag) + (assoc-default nil bg)) + (assoc-default t ag) + (assoc-default t bg)))) + variables + newvars)))))) (setq success latest)) (setq variables (dir-locals--sort-variables variables)) (dir-locals-set-class-variables class-name variables)