commit 03f64ebbc685d803f9dcbb638c37501e0d6f8340 (HEAD, refs/remotes/origin/master) Author: Leo Liu Date: Thu Feb 16 18:38:13 2017 +0800 * src/fns.c (Fbuffer_hash): Doc fix. diff --git a/src/fns.c b/src/fns.c index 0b694529c5..b4f416f4f5 100644 --- a/src/fns.c +++ b/src/fns.c @@ -4939,8 +4939,7 @@ If BINARY is non-nil, returns a string in binary form. */) DEFUN ("buffer-hash", Fbuffer_hash, Sbuffer_hash, 0, 1, 0, doc: /* Return a hash of the contents of BUFFER-OR-NAME. This hash is performed on the raw internal format of the buffer, -disregarding any coding systems. -If nil, use the current buffer." */ ) +disregarding any coding systems. If nil, use the current buffer. */ ) (Lisp_Object buffer_or_name) { Lisp_Object buffer; commit 16e304f38e57a9a31f1468ba6ebcb8a71efd253d Author: Eric Abrahamsen Date: Wed Feb 22 17:26:11 2017 -0800 Don't use mapconcat with chars in gnus registry marks (Bug#25839) * lisp/gnus/gnus-registry.el (gnus-registry-article-marks-to-chars): Instead, use a plain concat, which will create a string out of a list of characters. diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el index f728b19111..51f6459d2f 100644 --- a/lisp/gnus/gnus-registry.el +++ b/lisp/gnus/gnus-registry.el @@ -968,12 +968,13 @@ Uses `gnus-registry-marks' to find what shortcuts to install." "Show the marks for an article by the :char property." (let* ((id (mail-header-message-id headers)) (marks (when id (gnus-registry-get-id-key id 'mark)))) - (mapconcat (lambda (mark) - (plist-get - (cdr-safe - (assoc mark gnus-registry-marks)) - :char)) - marks ""))) + (concat (delq nil + (mapcar + (lambda (m) + (plist-get + (cdr-safe (assoc m gnus-registry-marks)) + :char)) + marks))))) ;; use like this: ;; (defalias 'gnus-user-format-function-M 'gnus-registry-article-marks-to-names) commit b7250496bd2d681a7a7f3c958eb3f0047b5c0a22 Author: Noam Postavsky Date: Tue Feb 21 20:46:15 2017 -0500 Fix epg-tests with dummy-pinentry program (Bug#23619) * test/data/epg/dummy-pinentry: New file. * test/lisp/epg-tests.el (with-epg-tests): Add it to gpg-agent.conf when a passphrase is required. Add debug declaration. Set GPG_AGENT_INFO non-destructively. diff --git a/test/data/epg/dummy-pinentry b/test/data/epg/dummy-pinentry new file mode 100755 index 0000000000..2228dfb0c6 --- /dev/null +++ b/test/data/epg/dummy-pinentry @@ -0,0 +1,22 @@ +#! /bin/bash +# Dummy pinentry +# +# Copyright 2008 g10 Code GmbH +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This file is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. + +echo OK Your orders please + +while read cmd; do + case $cmd in + GETPIN) echo D test0123456789; echo OK;; + *) echo OK;; + esac +done diff --git a/test/lisp/epg-tests.el b/test/lisp/epg-tests.el index ea2b62c358..c61527207f 100644 --- a/test/lisp/epg-tests.el +++ b/test/lisp/epg-tests.el @@ -52,8 +52,9 @@ require-secret-key) &rest body) "Set up temporary locations and variables for testing." - (declare (indent 1)) - `(let ((epg-tests-home-directory (make-temp-file "epg-tests-homedir" t))) + (declare (indent 1) (debug (sexp body))) + `(let ((epg-tests-home-directory (make-temp-file "epg-tests-homedir" t)) + (process-environment (cons "GPG_AGENT_INFO" process-environment))) (unwind-protect (let ((context (epg-make-context 'OpenPGP))) (setf (epg-context-program context) @@ -63,11 +64,16 @@ `'require-passphrase)))) (setf (epg-context-home-directory context) epg-tests-home-directory) - (setenv "GPG_AGENT_INFO") ,(if require-passphrase - `(epg-context-set-passphrase-callback - context - #'epg-tests-passphrase-callback)) + `(with-temp-file (expand-file-name + "gpg-agent.conf" epg-tests-home-directory) + (insert "pinentry-program " + (expand-file-name "dummy-pinentry" + epg-tests-data-directory) + "\n") + (epg-context-set-passphrase-callback + context + #'epg-tests-passphrase-callback))) ,(if require-public-key `(epg-import-keys-from-file context commit 7b5e1c8238ef961fd3305b1dce053b9bced684ba Author: Phillip Lord Date: Mon Feb 27 21:23:35 2017 +0000 Speed generation of ldefs-boot-auto Previously, generation of ldefs-boot-auto required at least one full bootstrap and, in extreme cases, two. Now, from build system, it requires the same time as taken to dump Emacs. * Makefile.in: Remove all calls, pass to src. * admin/ldefs-clean.el: Update for changed messages. * lisp/Makefile.in (compile-first-delete): Add. * lisp/ldefs-boot-auto.el: Update. * src/Makefile.in (generate-ldefs-boot): Add. diff --git a/Makefile.in b/Makefile.in index 2cc41feb46..a7b122f518 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1186,17 +1186,6 @@ check-declare: fi $(MAKE) -C lisp $@ -## Generating ldefs-boot-auto.el requires a completely clean build so -## that we can see which autoloads are actually called. The build has -## to complete because we use Emacs to clean the results up! We use -## loaddefs.el in place of ldefs-boot-auto, because if we are running -## this there is the possibility that ldefs-boot-auto is not -## sufficient for bootstrap. -generate-ldefs-boot: all - echo "Generating Bootstrap ldefs" - cp lisp/loaddefs.el lisp/ldefs-boot-auto.el - $(MAKE) -j 1 bootstrap \ - GENERATE_LDEFS_BOOT="generate-ldefs-boot" \ - 2>&1 | tee lisp/ldefs-boot-auto.temp - $(EMACS) -batch --load admin/ldefs-clean.el --funcall ldefs-clean - rm lisp/ldefs-boot-auto.temp +generate-ldefs-boot: + echo "Generating ldefs-boot-auto.el" + $(MAKE) -C src generate-ldefs-boot diff --git a/admin/ldefs-clean.el b/admin/ldefs-clean.el index c227a16360..91512b4bbb 100644 --- a/admin/ldefs-clean.el +++ b/admin/ldefs-clean.el @@ -40,9 +40,6 @@ ;; We need to record autoloads till the point that emacs (as opposed ;; to bootstrap-emacs) is dumped. After this point, we are not ;; bootstrapping any more. - (search-backward "-l loadup dump") - (beginning-of-line) - (delete-region (point) (point-max)) (keep-lines "(autoload" (point-min) (point-max)) (sort-lines nil (point-min) (point-max)) (ldefs-clean-uniquify-buffer-lines) @@ -60,6 +57,6 @@ (defun ldefs-clean () - (find-file "lisp/ldefs-boot-auto.temp") + (find-file "../lisp/ldefs-boot-auto.temp") (ldefs-clean-up) (write-file "ldefs-boot-auto.el")) diff --git a/lisp/Makefile.in b/lisp/Makefile.in index 91b035476f..366683b025 100644 --- a/lisp/Makefile.in +++ b/lisp/Makefile.in @@ -285,6 +285,9 @@ $(THEFILE)c: compile-first: loaddefs.el $(COMPILE_FIRST) +compile-first-delete: + -for f in ${COMPILE_FIRST}; do test ! -f $$f || rm $$f; done + # In 'compile-main' we could directly do # ... | xargs $(MAKE) # and it works, but it generates a lot of messages like diff --git a/lisp/ldefs-boot-auto.el b/lisp/ldefs-boot-auto.el index 66147173d5..f1b34aaee5 100644 --- a/lisp/ldefs-boot-auto.el +++ b/lisp/ldefs-boot-auto.el @@ -3,16 +3,12 @@ (autoload 'Info-directory "info" nil nil nil) (autoload 'Info-index "info" nil nil nil) (autoload 'View-exit-and-edit "view" nil nil nil) -(autoload 'add-change-log-entry "add-log" nil nil nil) -(autoload 'add-log-current-defun "add-log" nil nil nil) (autoload 'batch-byte-compile "bytecomp" nil nil nil) (autoload 'batch-update-autoloads "autoload" nil nil nil) (autoload 'bounds-of-thing-at-point "thingatpt" nil nil nil) (autoload 'browse-url "browse-url" nil nil nil) (autoload 'buffer-face-mode "face-remap" nil nil nil) (autoload 'byte-compile "bytecomp" nil nil nil) -(autoload 'byte-compile-disable-warning "bytecomp" nil nil nil) -(autoload 'byte-compile-enable-warning "bytecomp" nil nil nil) (autoload 'byte-compile-file "bytecomp" nil nil nil) (autoload 'byte-compile-inline-expand "byte-opt" nil nil nil) (autoload 'byte-compile-unfold-lambda "byte-opt" nil nil nil) @@ -20,19 +16,15 @@ (autoload 'byte-optimize-lapcode "byte-opt" nil nil nil) (autoload 'byte-recompile-directory "bytecomp" nil nil nil) (autoload 'char-displayable-p "mule-util" nil nil nil) +(autoload 'cl-member "cl-seq" nil nil nil) +(autoload 'cl-position "cl-seq" nil nil nil) (autoload 'color-name-to-rgb "color" nil nil nil) -(autoload 'comint-redirect-results-list-from-process "comint" nil nil nil) -(autoload 'comint-redirect-send-command-to-process "comint" nil nil nil) (autoload 'compilation-mode "compile" nil nil nil) -(autoload 'compilation-shell-minor-mode "compile" nil nil nil) -(autoload 'compilation-start "compile" nil nil nil) (autoload 'completing-read-multiple "crm" nil nil nil) (autoload 'conf-mode "conf-mode" nil nil nil) (autoload 'create-glyph "disp-table" nil nil nil) (autoload 'create-image "image" nil nil nil) -(autoload 'cursor-sensor-mode "cursor-sensor" nil nil nil) (autoload 'custom-save-all "cus-edit" nil nil nil) -(autoload 'customize-face "cus-edit" nil nil nil) (autoload 'customize-group "cus-edit" nil nil nil) (autoload 'customize-option "cus-edit" nil nil nil) (autoload 'customize-push-and-save "cus-edit" nil nil nil) @@ -49,46 +41,26 @@ (autoload 'describe-function-1 "help-fns" nil nil nil) (autoload 'describe-package "package" nil nil nil) (autoload 'describe-variable "help-fns" nil nil nil) -(autoload 'desktop-save "desktop" nil nil nil) -(autoload 'diff-mode "diff-mode" nil nil nil) (autoload 'dired "dired" nil nil nil) -(autoload 'dired-copy-file "dired-aux" nil nil nil) -(autoload 'dired-goto-subdir "dired-aux" nil nil nil) -(autoload 'dired-hide-subdir "dired-aux" nil nil nil) -(autoload 'dired-insert-subdir "dired-aux" nil nil nil) -(autoload 'dired-kill-subdir "dired-aux" nil nil nil) -(autoload 'dired-mark-subdir-files "dired-aux" nil nil nil) -(autoload 'dired-mode "dired" nil nil nil) -(autoload 'dired-noselect "dired" nil nil nil) -(autoload 'dired-query "dired-aux" nil nil nil) -(autoload 'dired-rename-file "dired-aux" nil nil nil) (autoload 'display-call-tree "bytecomp" nil nil nil) (autoload 'display-table-slot "disp-table" nil nil nil) (autoload 'display-warning "warnings" nil nil nil) (autoload 'easy-menu-create-menu "easymenu" nil nil nil) +(autoload 'easy-menu-do-define "easymenu" nil nil nil) (autoload 'edebug-basic-spec "edebug" nil nil nil) -(autoload 'ediff-patch-file "ediff" nil nil nil) -(autoload 'edit-kbd-macro "edmacro" nil nil nil) (autoload 'extract-rectangle "rect" nil nil nil) (autoload 'find-definition-noselect "find-func" nil nil nil) (autoload 'find-function-search-for-symbol "find-func" nil nil nil) (autoload 'find-lisp-object-file-name "help-fns" nil nil nil) -(autoload 'find-variable-noselect "find-func" nil nil nil) -(autoload 'format-kbd-macro "edmacro" nil nil nil) (autoload 'goto-address-mode "goto-addr" nil nil nil) -(autoload 'grep-compute-defaults "grep" nil nil nil) (autoload 'help-C-file-name "help-fns" nil nil nil) (autoload 'help-buffer "help-mode" nil nil nil) (autoload 'help-insert-xref-button "help-mode" nil nil nil) -(autoload 'help-make-xrefs "help-mode" nil nil nil) (autoload 'help-mode "help-mode" nil nil nil) (autoload 'help-setup-xref "help-mode" nil nil nil) (autoload 'help-with-tutorial "tutorial" nil nil nil) (autoload 'help-xref-button "help-mode" nil nil nil) (autoload 'hi-lock-face-buffer "hi-lock" nil nil nil) -(autoload 'html-mode "sgml-mode" nil nil nil) -(autoload 'image-type "image" nil nil nil) -(autoload 'image-type-auto-detected-p "image" nil nil nil) (autoload 'image-type-available-p "image" nil nil nil) (autoload 'image-type-from-buffer "image" nil nil nil) (autoload 'image-type-from-data "image" nil nil nil) @@ -102,42 +74,29 @@ (autoload 'insert-rectangle "rect" nil nil nil) (autoload 'isearch-process-search-multibyte-characters "isearch-x" nil nil nil) (autoload 'jka-compr-uninstall "jka-compr" nil nil nil) -(autoload 'log-edit "log-edit" nil nil nil) -(autoload 'log-view-mode "log-view" nil nil nil) (autoload 'lookup-nested-alist "mule-util" nil nil nil) (autoload 'make-display-table "disp-table" nil nil nil) (autoload 'make-glyph-code "disp-table" nil nil nil) (autoload 'multi-isearch-buffers "misearch" nil nil nil) (autoload 'multi-isearch-buffers-regexp "misearch" nil nil nil) -(autoload 'multi-isearch-files "misearch" nil nil nil) -(autoload 'multi-isearch-files-regexp "misearch" nil nil nil) (autoload 'nxml-mode "nxml-mode" nil nil nil) -(autoload 'open-network-stream "network-stream" nil nil nil) (autoload 'package-initialize "package" nil nil nil) -(autoload 'parse-time-string "parse-time" nil nil nil) (autoload 'pp "pp" nil nil nil) (autoload 'pp-buffer "pp" nil nil nil) (autoload 'print-buffer "lpr" nil nil nil) -(autoload 'quail-defrule-internal "quail" nil nil nil) +(autoload 'quail-defrule "quail" nil nil nil) (autoload 'read-kbd-macro "edmacro" nil nil nil) (autoload 'regexp-opt "regexp-opt" nil nil nil) +(autoload 'regexp-opt-depth "regexp-opt" nil nil nil) (autoload 'rx "rx" nil nil t) -(autoload 'seconds-to-string "time-date" nil nil nil) (autoload 'seconds-to-time "time-date" nil nil nil) (autoload 'server-save-buffers-kill-terminal "server" nil nil nil) (autoload 'server-start "server" nil nil nil) (autoload 'set-nested-alist "mule-util" nil nil nil) -(autoload 'skeleton-insert "skeleton" nil nil nil) -(autoload 'smerge-mode "smerge-mode" nil nil nil) -(autoload 'smerge-start-session "smerge-mode" nil nil nil) (autoload 'standard-display-8bit "disp-table" nil nil nil) (autoload 'standard-display-default "disp-table" nil nil nil) -(autoload 'tags-query-replace "etags" nil nil nil) -(autoload 'tags-search "etags" nil nil nil) (autoload 'text-scale-increase "face-remap" nil nil nil) (autoload 'thing-at-point "thingatpt" nil nil nil) -(autoload 'time-to-days "time-date" nil nil nil) -(autoload 'timezone-make-date-arpa-standard "timezone" nil nil nil) (autoload 'tmm-menubar "tmm" nil nil nil) (autoload 'tool-bar-add-item-from-menu "tool-bar" nil nil nil) (autoload 'truncate-string-to-width "mule-util" nil nil nil) @@ -149,9 +108,7 @@ (autoload 'ucs-normalize-NFKD-region "ucs-normalize" nil nil nil) (autoload 'url-handler-mode "url-handlers" nil nil nil) (autoload 'variable-at-point "help-fns" nil nil nil) -(autoload 'vc-register "vc" nil nil nil) (autoload 'vc-responsible-backend "vc" nil nil nil) -(autoload 'vc-transfer-file "vc" nil nil nil) (autoload 'view-buffer "view" nil nil nil) (autoload 'view-buffer-other-window "view" nil nil nil) (autoload 'view-file "view" nil nil nil) @@ -159,8 +116,8 @@ (autoload 'view-mode-enter "view" nil nil nil) (autoload 'visit-tags-table "etags" nil nil nil) (autoload 'warn "warnings" nil nil nil) -(autoload 'wdired-change-to-wdired-mode "wdired" nil nil nil) (autoload 'widget-value "wid-edit" nil nil nil) +(autoload 'with-coding-priority "mule-util" nil nil t) ;; Local Variables: ;; no-byte-compile: t ;; no-update-autoloads: t diff --git a/src/Makefile.in b/src/Makefile.in index ab31983724..730f79801c 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -761,9 +761,30 @@ endif @: Compile some files earlier to speed up further compilation. $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)" +shortlisp-keep=loadup.el loaddefs.el + +## Generating ldefs-boot-auto.el requires that we dump both emacs and +## the bootstrap-emacs so that we can see which autoloads are actually +## called. This is a slightly messy affair as we must ensure that +## they are build as if from clean, which means deleting all the build +## files first. We use loaddefs.el to make sure that we can build +## from bootstrap; obviously, this assumes that loaddefs.el already +## exists or we have a bootstrap problem! +generate-ldefs-boot: $(lispsource)/loaddefs.el + echo Cleaning to enable generate-ldefs-boot + mv $(lispsource)/loaddefs.el $(lispsource)/ldefs-boot-auto.el + $(MAKE) -C $(lispsource) compile-first-delete + -for f in $(filter-out $(shortlisp-keep), $(shortlisp)); do test -e $(lispsource)/$$f && rm -v $(lispsource)/$$f; done + - rm bootstrap-emacs$(EXEEXT) + - rm emacs$(EXEEXT) + echo Building generate-ldefs-boot + $(MAKE) -j 1 emacs$(EXEEXT) \ + GENERATE_LDEFS_BOOT="generate-ldefs-boot" \ + 2>&1 | tee $(lispsource)/ldefs-boot-auto.temp + echo Reformatting ldefs-boot-auto.el + emacs$(EXEEXT) -batch --load ../admin/ldefs-clean.el --funcall ldefs-clean + rm ../lisp/ldefs-boot-auto.temp -generate-ldefs-boot: bootstrap-emacs$(EXEEXT) - $(RUN_TEMACS) --batch $(BUILD_DETAILS) --load loadup bootstrap ifeq ($(AUTO_DEPEND),yes) -include $(ALLOBJS:%.o=${DEPDIR}/%.d) commit 75727406535572fb8d18e0c4d92f5a033a1a0933 Author: Phillip Lord Date: Sat Jan 21 16:43:38 2017 +0000 Add error handling to magic-mode-alist * lisp/files.el (set-auto-mode): Add explicit error handling in two places. diff --git a/lisp/files.el b/lisp/files.el index b7d104853c..7c9271e2f4 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2909,11 +2909,18 @@ we don't actually set it to the same mode the buffer already has." (narrow-to-region (point-min) (min (point-max) (+ (point-min) magic-mode-regexp-match-limit))) - (assoc-default nil magic-mode-alist - (lambda (re _dummy) - (if (functionp re) - (funcall re) - (looking-at re))))))) + (assoc-default + nil magic-mode-alist + (lambda (re _dummy) + (cond + ((functionp re) + (funcall re)) + ((stringp re) + (looking-at re)) + (t + (error + "Problem in magic-mode-alist with element %s" + re)))))))) (set-auto-mode-0 done keep-mode-if-same))) ;; Next compare the filename against the entries in auto-mode-alist. (unless done @@ -2965,10 +2972,16 @@ we don't actually set it to the same mode the buffer already has." (min (point-max) (+ (point-min) magic-mode-regexp-match-limit))) (assoc-default nil magic-fallback-mode-alist - (lambda (re _dummy) - (if (functionp re) - (funcall re) - (looking-at re))))))) + (lambda (re _dummy) + (cond + ((functionp re) + (funcall re)) + ((stringp re) + (looking-at re)) + (t + (error + "Problem with magic-fallback-mode-alist element: %s" + re)))))))) (set-auto-mode-0 done keep-mode-if-same))) (unless done (set-buffer-major-mode (current-buffer))))) commit 1b946305182312faa7fcd838caf55dcb07b2ab04 Author: Phillip Lord Date: Fri Jan 20 15:13:27 2017 +0000 Remove conditional includes from bootstrap Previously, bootstrap-emacs includes optional functionality, depending on the platform which is not needed for bootstrap function. As a result, bootstrap-emacs contains different functions in different circumstances. If ldefs-boot-auto.el is generated, then loaded functions will not be added to ldefs-boot-auto.el, although they may be required during some builds. With this change, bootstrap-emacs should always behave the same way and, therefore, require the same autoloads. * lisp/loadup.el: No longer load optional includes during bootstrap dumping. * lisp/ldefs-boot-auto.el: Regenerate. * lisp/ldefs-boot-manual.el: Add two autoloads. diff --git a/lisp/ldefs-boot-auto.el b/lisp/ldefs-boot-auto.el index 020c6707a0..66147173d5 100644 --- a/lisp/ldefs-boot-auto.el +++ b/lisp/ldefs-boot-auto.el @@ -87,7 +87,14 @@ (autoload 'help-xref-button "help-mode" nil nil nil) (autoload 'hi-lock-face-buffer "hi-lock" nil nil nil) (autoload 'html-mode "sgml-mode" nil nil nil) +(autoload 'image-type "image" nil nil nil) +(autoload 'image-type-auto-detected-p "image" nil nil nil) (autoload 'image-type-available-p "image" nil nil nil) +(autoload 'image-type-from-buffer "image" nil nil nil) +(autoload 'image-type-from-data "image" nil nil nil) +(autoload 'image-type-from-file-header "image" nil nil nil) +(autoload 'image-type-from-file-name "image" nil nil nil) +(autoload 'imagemagick-register-types "image" nil nil nil) (autoload 'info "info" nil nil nil) (autoload 'info-complete-symbol "info-look" nil nil nil) (autoload 'info-emacs-manual "info" nil nil nil) @@ -132,6 +139,7 @@ (autoload 'time-to-days "time-date" nil nil nil) (autoload 'timezone-make-date-arpa-standard "timezone" nil nil nil) (autoload 'tmm-menubar "tmm" nil nil nil) +(autoload 'tool-bar-add-item-from-menu "tool-bar" nil nil nil) (autoload 'truncate-string-to-width "mule-util" nil nil nil) (autoload 'ucs-normalize-HFS-NFC-region "ucs-normalize" nil nil nil) (autoload 'ucs-normalize-HFS-NFD-region "ucs-normalize" nil nil nil) diff --git a/lisp/ldefs-boot-manual.el b/lisp/ldefs-boot-manual.el index 183703d25e..2f6e3fd209 100644 --- a/lisp/ldefs-boot-manual.el +++ b/lisp/ldefs-boot-manual.el @@ -10,6 +10,12 @@ ;; during the byte-compile phase (defvar electric-pair-text-pairs '((34 . 34))) +;; These two autoloads are needed for files.el. They are only used on +;; their respective platforms so do not get added to +;; ldefs-boot-auto.el when it is generated on a different platform. +(autoload 'dos-convert-standard-filename "dos-fns.el" nil nil nil) +(autoload 'w32-convert-standard-filename "w32-fns.el" nil nil nil) + (load "ldefs-boot-auto.el") diff --git a/lisp/loadup.el b/lisp/loadup.el index 5b19b05a82..8780ea6edb 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -230,8 +230,11 @@ (load "jit-lock") (load "mouse") -(if (boundp 'x-toolkit-scroll-bars) - (load "scroll-bar")) + +(unless (equal (member "bootstrap" command-line-args) '("bootstrap")) + (if (boundp 'x-toolkit-scroll-bars) + (load "scroll-bar"))) + (load "select") (load "emacs-lisp/timer") (load "isearch") @@ -253,61 +256,62 @@ (load "emacs-lisp/tabulated-list") (load "buff-menu") -(if (fboundp 'x-create-frame) - (progn - (load "fringe") - ;; Needed by `imagemagick-register-types' - (load "emacs-lisp/regexp-opt") - (load "image") - (load "international/fontset") - (load "dnd") - (load "tool-bar"))) - -(if (featurep 'dynamic-setting) - (load "dynamic-setting")) - -(if (featurep 'x) - (progn - (load "x-dnd") - (load "term/common-win") - (load "term/x-win"))) - -(if (or (eq system-type 'windows-nt) - (featurep 'w32)) - (progn - (load "term/common-win") - (load "w32-vars") - (load "term/w32-win") - (load "disp-table") - (when (eq system-type 'windows-nt) - (load "w32-fns") +(unless (equal (member "bootstrap" command-line-args) '("bootstrap")) + (if (fboundp 'x-create-frame) + (progn + (load "fringe") + ;; Needed by `imagemagick-register-types' + (load "emacs-lisp/regexp-opt") + (load "image") + (load "international/fontset") + (load "dnd") + (load "tool-bar"))) + + (if (featurep 'dynamic-setting) + (load "dynamic-setting")) + + (if (featurep 'x) + (progn + (load "x-dnd") + (load "term/common-win") + (load "term/x-win"))) + + (if (or (eq system-type 'windows-nt) + (featurep 'w32)) + (progn + (load "term/common-win") + (load "w32-vars") + (load "term/w32-win") + (load "disp-table") + (when (eq system-type 'windows-nt) + (load "w32-fns") + (load "ls-lisp") + (load "dos-w32")))) + (if (eq system-type 'ms-dos) + (progn + (load "dos-w32") + (load "dos-fns") + (load "dos-vars") + ;; Don't load term/common-win: it isn't appropriate for the `pc' + ;; ``window system'', which generally behaves like a terminal. + (load "term/internal") + (load "term/pc-win") (load "ls-lisp") - (load "dos-w32")))) -(if (eq system-type 'ms-dos) - (progn - (load "dos-w32") - (load "dos-fns") - (load "dos-vars") - ;; Don't load term/common-win: it isn't appropriate for the `pc' - ;; ``window system'', which generally behaves like a terminal. - (load "term/internal") - (load "term/pc-win") - (load "ls-lisp") - (load "disp-table"))) ; needed to setup ibm-pc char set, see internal.el -(if (featurep 'ns) - (progn - (load "term/common-win") - ;; Don't load ucs-normalize.el unless uni-*.el files were - ;; already produced, because it needs uni-*.el files that might - ;; not be built early enough during bootstrap. - (when (load-history-filename-element "charprop\\.el") - (load "international/mule-util") - (load "international/ucs-normalize") - (load "term/ns-win")))) -(if (fboundp 'x-create-frame) - ;; Do it after loading term/foo-win.el since the value of the - ;; mouse-wheel-*-event vars depends on those files being loaded or not. - (load "mwheel")) + (load "disp-table"))) ; needed to setup ibm-pc char set, see internal.el + (if (featurep 'ns) + (progn + (load "term/common-win") + ;; Don't load ucs-normalize.el unless uni-*.el files were + ;; already produced, because it needs uni-*.el files that might + ;; not be built early enough during bootstrap. + (when (load-history-filename-element "charprop\\.el") + (load "international/mule-util") + (load "international/ucs-normalize") + (load "term/ns-win")))) + (if (fboundp 'x-create-frame) + ;; Do it after loading term/foo-win.el since the value of the + ;; mouse-wheel-*-event vars depends on those files being loaded or not. + (load "mwheel"))) ;; Preload some constants and floating point functions. (load "emacs-lisp/float-sup") @@ -317,8 +321,10 @@ (load "electric") (load "emacs-lisp/eldoc") (load "cus-start") ;Late to reduce customize-rogue (needs loaddefs.el anyway) -(if (not (eq system-type 'ms-dos)) - (load "tooltip")) + +(unless (equal (member "bootstrap" command-line-args) '("bootstrap")) + (if (not (eq system-type 'ms-dos)) + (load "tooltip"))) ;; This file doesn't exist when building a development version of Emacs ;; from the repository. It is generated just after temacs is built. commit 514a14ffd826e2686a106f45b7e7495ab42fe12e Author: Phillip Lord Date: Fri Jan 20 15:11:50 2017 +0000 Do not use find-file non-interactively * lisp/international/titdic-cnv (miscdic-convert): Use insert-file-contents in place of find-file. diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el index 6f65d491ed..130bc742a5 100644 --- a/lisp/international/titdic-cnv.el +++ b/lisp/international/titdic-cnv.el @@ -1167,11 +1167,14 @@ the generated Quail package is saved." (if (eq coding 'iso-2022-cn-ext) "Chinese-CNS" "Chinese-GB")) "\" \"" title "\" t\n") - (let* ((coding-system-for-read - (coding-system-change-eol-conversion coding 'unix)) - (dicbuf (find-file-noselect filename))) - (funcall converter dicbuf name title) - (kill-buffer dicbuf)) + (let ((coding-system-for-read + (coding-system-change-eol-conversion coding 'unix)) + (dstbuf (current-buffer))) + (with-temp-buffer + (insert-file-contents filename) + (let ((dicbuf (current-buffer))) + (with-current-buffer dstbuf + (funcall converter dicbuf name title))))) (insert ";; Local Variables:\n" ";; version-control: never\n" ";; no-update-autoloads: t\n" commit c2469c50e80f4a18448e6f5f45e960cf00944822 Author: Stefan Monnier Date: Tue Feb 28 14:00:17 2017 -0500 * src/xdisp.c (overlay_arrows_changed_p): Fix return value and doc (update_overlay_arrows): Skip non-markers. diff --git a/src/xdisp.c b/src/xdisp.c index 4e87001abf..1f8878408b 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -13338,12 +13338,15 @@ overlay_arrow_in_current_buffer_p (void) /* Return true if any overlay_arrows have moved or overlay-arrow-string - has changed. */ + has changed. + If SET_REDISPLAY is true, additionally, set the `redisplay' bit in those + buffers that are affected. */ static bool overlay_arrows_changed_p (bool set_redisplay) { Lisp_Object vlist; + bool changed = false; for (vlist = Voverlay_arrow_variable_list; CONSP (vlist); @@ -13370,12 +13373,13 @@ overlay_arrows_changed_p (bool set_redisplay) { if (buf) bset_redisplay (buf); + changed = true; } else return true; } } - return false; + return changed; } /* Mark overlay arrows to be updated on next redisplay. */ @@ -13397,6 +13401,8 @@ update_overlay_arrows (int up_to_date) if (up_to_date > 0) { Lisp_Object val = find_symbol_value (var); + if (!MARKERP (val)) + continue; Fput (var, Qlast_arrow_position, COERCE_MARKER (val)); Fput (var, Qlast_arrow_string, commit f8e36e04c4a11912d9f996a1fbf2870cf822151f Author: Ken Brown Date: Tue Feb 28 11:59:12 2017 -0500 ; * src/w32fns.c (w32_wnd_proc): Adjust comment. diff --git a/src/w32fns.c b/src/w32fns.c index 1b628b0b42..dd16d74439 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -4801,7 +4801,11 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) case WM_ENDSESSION: my_post_msg (&wmsg, hwnd, msg, wParam, lParam); - /* If we return, the process will be terminated immediately. */ + /* Allow time for Emacs to attempt an orderly shutdown. If we + return, the process will be terminated immediately. FIXME: + 1000 seconds is too long to sleep if the shutdown attempt + fails (see bug#25875). But if it fails, we want to find out + about it, so let's leave 1000 for now. */ sleep (1000); case WM_WINDOWPOSCHANGING: commit 57f5ab8c4057d82c8fbc6a414169a44f5e181280 Author: Ken Brown Date: Tue Feb 28 11:25:00 2017 -0500 Try to avoid hang when logging out of MS-Windows * src/w32term.c (x_update_window_begin, x_update_window_end) (my_show_window, my_set_window_pos, my_set_focus) (my_set_foreground_window, my_destroy_window) (my_bring_window_to_top, x_iconify_frame): Replace calls to SendMessage by calls to SendMessageTimeout with a 6-second timeout. (Bug#25875) diff --git a/src/w32term.c b/src/w32term.c index d6b78fd7e0..3d41c30dfe 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -548,7 +548,8 @@ x_update_window_begin (struct window *w) /* Hide the system caret during an update. */ if (w32_use_visible_system_caret && w32_system_caret_hwnd) { - SendMessage (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0); + SendMessageTimeout (w32_system_caret_hwnd, WM_EMACS_HIDE_CARET, 0, 0, + 0, 6000, NULL); } w->output_cursor = w->cursor; @@ -714,7 +715,8 @@ x_update_window_end (struct window *w, bool cursor_on_p, x_update_window_begin. */ if (w32_use_visible_system_caret && w32_system_caret_hwnd) { - SendMessage (w32_system_caret_hwnd, WM_EMACS_SHOW_CARET, 0, 0); + SendMessageTimeout (w32_system_caret_hwnd, WM_EMACS_SHOW_CARET, 0, 0, + 0, 6000, NULL); } } @@ -3668,8 +3670,8 @@ static BOOL my_show_window (struct frame *f, HWND hwnd, int how) { #ifndef ATTACH_THREADS - return SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SHOWWINDOW, - (WPARAM) hwnd, (LPARAM) how); + return SendMessageTimeout (FRAME_W32_WINDOW (f), WM_EMACS_SHOWWINDOW, + (WPARAM) hwnd, (LPARAM) how, 0, 6000, NULL); #else return ShowWindow (hwnd, how); #endif @@ -3687,7 +3689,8 @@ my_set_window_pos (HWND hwnd, HWND hwndAfter, pos.cx = cx; pos.cy = cy; pos.flags = flags; - SendMessage (hwnd, WM_EMACS_SETWINDOWPOS, (WPARAM) &pos, 0); + SendMessageTimeout (hwnd, WM_EMACS_SETWINDOWPOS, (WPARAM) &pos, 0, + 0, 6000, NULL); #else SetWindowPos (hwnd, hwndAfter, x, y, cx, cy, flags); #endif @@ -3697,29 +3700,31 @@ my_set_window_pos (HWND hwnd, HWND hwndAfter, static void my_set_focus (struct frame * f, HWND hwnd) { - SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SETFOCUS, - (WPARAM) hwnd, 0); + SendMessageTimeout (FRAME_W32_WINDOW (f), WM_EMACS_SETFOCUS, + (WPARAM) hwnd, 0, 0, 6000, NULL); } #endif static void my_set_foreground_window (HWND hwnd) { - SendMessage (hwnd, WM_EMACS_SETFOREGROUND, (WPARAM) hwnd, 0); + SendMessageTimeout (hwnd, WM_EMACS_SETFOREGROUND, (WPARAM) hwnd, 0, + 0, 6000, NULL); } static void my_destroy_window (struct frame * f, HWND hwnd) { - SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_DESTROYWINDOW, - (WPARAM) hwnd, 0); + SendMessageTimeout (FRAME_W32_WINDOW (f), WM_EMACS_DESTROYWINDOW, + (WPARAM) hwnd, 0, 0, 6000, NULL); } static void my_bring_window_to_top (HWND hwnd) { - SendMessage (hwnd, WM_EMACS_BRINGTOTOP, (WPARAM) hwnd, 0); + SendMessageTimeout (hwnd, WM_EMACS_BRINGTOTOP, (WPARAM) hwnd, 0, + 0, 6000, NULL); } /* Create a scroll bar and return the scroll bar vector for it. W is @@ -6538,7 +6543,8 @@ x_iconify_frame (struct frame *f) x_set_bitmap_icon (f); /* Simulate the user minimizing the frame. */ - SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0); + SendMessageTimeout (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0, + 0, 6000, NULL); SET_FRAME_VISIBLE (f, 0); SET_FRAME_ICONIFIED (f, true); commit 122d2d675c77138cdde34347930a70b299d95363 Author: Stefan Monnier Date: Tue Feb 28 11:15:24 2017 -0500 * lisp/textmodes/reftex-toc.el (reftex-re-enlarge): Demote errors. diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el index ab49ae8e32..4f7c738a13 100644 --- a/lisp/textmodes/reftex-toc.el +++ b/lisp/textmodes/reftex-toc.el @@ -380,13 +380,17 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help (defun reftex-re-enlarge () "Enlarge window to a remembered size." + ;; FIXME: reftex-last-window-width might be the width of another window on + ;; another frame, so the enlarge-window call might make no sense. + ;; We should just use `quit-window' instead nowadays. (let ((count (if reftex-toc-split-windows-horizontally (- (or reftex-last-window-width (window-total-width)) (window-total-width)) (- (or reftex-last-window-height (window-height)) (window-height))))) (when (> count 0) - (enlarge-window count reftex-toc-split-windows-horizontally)))) + (with-demoted-errors ;E.g. the window might be the root window! + (enlarge-window count reftex-toc-split-windows-horizontally))))) (defun reftex-toc-dframe-p (&optional frame error) ;; Check if FRAME is the dedicated TOC frame. commit 0fa594172709770a431121360f8f122df14d6259 Author: Stefan Monnier Date: Tue Feb 28 11:11:01 2017 -0500 * doc/misc/eieio.texi: Update to account for the cl-generic facilities (Quick Start, Class Options, Generics): Adjust names for cl-generic. (Methods): Document cl-defmethod. Explain in more detail the order in which the various methods are executed. Document the conditions under which a method is redefined. Remove reference to `eieio-generic-call-arglst`. Don't document the precise return value of cl-next-method-p. (Static Methods): Adjust to use `subclass` specializer. (Method Invocation): Use cl-call-next-method and drop mention of :primary. (Signal Handling, Signals): Adjust names and args for cl-generic; add cl-no-primary-method. (CLOS compatibility, Wish List): Adjust to new featureset. diff --git a/doc/misc/eieio.texi b/doc/misc/eieio.texi index 3820bd50df..ce31bc84b4 100644 --- a/doc/misc/eieio.texi +++ b/doc/misc/eieio.texi @@ -112,7 +112,7 @@ three slots named @code{name}, @code{birthday}, and @code{phone}: Each class can have methods, which are defined like this: @example -(defmethod call-record ((rec record) &optional scriptname) +(cl-defmethod call-record ((rec record) &optional scriptname) "Dial the phone for the record REC. Execute the program SCRIPTNAME to dial the phone." (message "Dialing the phone for %s" (oref rec name)) @@ -170,7 +170,7 @@ or In these examples, @eieio{} automatically examines the class of @code{rec}, and ensures that the method defined above is called. If @code{rec} is some other class lacking a @code{call-record} method, or -some other data type, Emacs signals a @code{no-method-definition} +some other data type, Emacs signals a @code{cl-no-applicable-method} error. @ref{Signals}. @node Introduction @@ -589,9 +589,9 @@ This option is specific to Emacs, and is not in the CLOS spec. @item :method-invocation-order This controls the order in which method resolution occurs for -@code{:primary} methods in cases of multiple inheritance. The order +methods in cases of multiple inheritance. The order affects which method is called first in a tree, and if -@code{call-next-method} is used, it controls the order in which the +@code{cl-call-next-method} is used, it controls the order in which the stack of methods are run. Valid values are: @@ -817,19 +817,19 @@ provides a function binding and the base documentation for the method symbol (@pxref{Symbol Components,,,elisp,GNU Emacs Lisp Reference Manual}). -@defmac defgeneric method arglist [doc-string] +@defmac cl-defgeneric method arglist [doc-string] This macro turns the (unquoted) symbol @var{method} into a function. @var{arglist} is the default list of arguments to use (not implemented yet). @var{doc-string} is the documentation used for this symbol. A generic function acts as a placeholder for methods. There is no -need to call @code{defgeneric} yourself, as @code{defmethod} will call +need to call @code{cl-defgeneric} yourself, as @code{cl-defmethod} will call it if necessary. Currently the argument list is unused. -@code{defgeneric} signals an error if you attempt to turn an existing +@code{cl-defgeneric} signals an error if you attempt to turn an existing Emacs Lisp function into a generic function. -You can also create a generic method with @code{defmethod} +You can also create a generic method with @code{cl-defmethod} (@pxref{Methods}). When a method is created and there is no generic method in place with that name, then a new generic will be created, and the new method will use it. @@ -842,31 +842,26 @@ only occurs for the first argument, so the @var{arglist} is not used. @node Methods @section Methods -A method is a function that is executed if the first argument passed -to it matches the method's class. Different @eieio{} classes may +A method is a function that is executed if the arguments passed +to it matches the method's specializers. Different @eieio{} classes may share the same method names. -Methods are created with the @code{defmethod} macro, which is similar +Methods are created with the @code{cl-defmethod} macro, which is similar to @code{defun}. -@defmac defmethod method [:before | :primary | :after | :static ] arglist [doc-string] forms +@defmac cl-defmethod method [:before | :around | :after ] arglist [doc-string] forms @var{method} is the name of the function to create. -@code{:before} and @code{:after} specify execution order (i.e., when -this form is called). If neither of these symbols are present, the -default priority is used (before @code{:after} and after -@code{:before}); this default priority is represented in CLOS as -@code{:primary}. +@code{:before}, @code{:around}, and @code{:after} specify execution order +(i.e., when this form is called). If none of these symbols are present, the +method is said to be a @emph{primary}. -@b{Note:} The @code{:BEFORE}, @code{:PRIMARY}, @code{:AFTER}, and -@code{:STATIC} method tags were in all capital letters in previous -versions of @eieio{}. - -@var{arglist} is the list of arguments to this method. The first -argument in this list---and @emph{only} the first argument---may have -a type specifier (see the example below). If no type specifier is -supplied, the method applies to any object. +@var{arglist} is the list of arguments to this method. The mandatory arguments +in this list may have a type specializer (see the example below) which means +that the method will only apply when those arguments match the given type +specializer. An argument with no type specializer means that the method +applies regardless of its value. @var{doc-string} is the documentation attached to the implementation. All method doc-strings are incorporated into the generic method's @@ -881,7 +876,7 @@ In the following example, we create a method @code{mymethod} for the @code{classname} class: @example -(defmethod mymethod ((obj classname) secondarg) +(cl-defmethod mymethod ((obj classname) secondarg) "Doc string" ) @end example @@ -889,84 +884,86 @@ In the following example, we create a method @code{mymethod} for the This method only executes if the @var{obj} argument passed to it is an @eieio{} object of class @code{classname}. -A method with no type specifier is a @dfn{default method}. If a given +A method with no type specializer is a @dfn{default method}. If a given class has no implementation, then the default method is called when that method is used on a given object of that class. -Only one default method per execution specifier (@code{:before}, -@code{:primary}, or @code{:after}) is allowed. If two -@code{defmethod}s appear with @var{arglist}s lacking a type specifier, -and having the same execution specifier, then the first implementation -is replaced. +Only one method per combination of specializers and qualifiers (@code{:before}, +@code{:around}, or @code{:after}) is kept. If two @code{cl-defmethod}s appear +with the same specializers and the same qualifiers, then the second +implementation replaces the first. When a method is called on an object, but there is no method specified for that object, but there is a method specified for object's parent -class, the parent class' method is called. If there is a method +class, the parent class's method is called. If there is a method defined for both, only the child's method is called. A child method -may call a parent's method using @code{call-next-method}, described +may call a parent's method using @code{cl-call-next-method}, described below. If multiple methods and default methods are defined for the same method and class, they are executed in this order: @enumerate -@item method :before -@item default :before -@item method :primary -@item default :primary -@item method :after -@item default :after +@item :around methods +The most specific @code{:around} method is called first, which may invoke the +less specific ones via @code{cl-call-next-method}. If it doesn't invoke +@code{cl-call-next-method}, then no other methods will be executed. When there +are no more @code{:around} methods to call, falls through to run the other +(non-@code{:around}) methods. +@item :before methods +Called in sequence from most specific to least specific. +@item primary methods +The most specific method is called, which may invoke the less specific +ones via @code{cl-call-next-method}. +@item :after methods +Called in sequence from least specific to most specific. @end enumerate -If no methods exist, Emacs signals a @code{no-method-definition} -error. @xref{Signals}. +If no methods exist, Emacs signals a @code{cl-no-applicable-method} error. +@xref{Signals}. If methods exist but none of them are primary, Emacs +signals a @code{cl-no-primary-method} error. @xref{Signals}. -@defun call-next-method &rest replacement-args -@anchor{call-next-method} +@defun cl-call-next-method &rest replacement-args +@anchor{cl-call-next-method} This function calls the superclass method from a subclass method. This is the ``next method'' specified in the current method list. -If @var{replacement-args} is non-@code{nil}, then use them instead of -@code{eieio-generic-call-arglst}. At the top level, the generic -argument list is passed in. +If @var{replacement-args} is non-@code{nil}, then use them instead of the +arguments originally provided to the method. -Use @code{next-method-p} to find out if there is a next method to -call. +Can only be used from within the lexical body of a primary or around method. @end defun -@defun next-method-p -@anchor{next-method-p} +@defun cl-next-method-p +@anchor{cl-next-method-p} Non-@code{nil} if there is a next method. -Returns a list of lambda expressions which is the @code{next-method} -order. -@end defun - -At present, @eieio{} does not implement all the features of CLOS: -@enumerate -@item -There is currently no @code{:around} tag. -@item -CLOS allows multiple sets of type-cast arguments, but @eieio{} only -allows the first argument to be cast. -@end enumerate +Can only be used from within the lexical body of a primary or around method. +@end defun @node Static Methods @section Static Methods Static methods do not depend on an object instance, but instead operate on a class. You can create a static method by using -the @code{:static} key with @code{defmethod}. +the @code{subclass} specializer with @code{cl-defmethod}: + +@example +(cl-defmethod make-instance ((class (subclass mychild)) &rest args) + (let ((new (cl-call-next-method))) + (push new all-my-children) + new)) +@end example -The first argument of a @code{:static} method will be a class rather than an +The first argument of a static method will be a class rather than an object. Use the functions @code{oref-default} or @code{oset-default} which will work on a class. -A class's @code{make-instance} method is defined as a @code{:static} +A class's @code{make-instance} method is defined as a static method. -@b{Note:} The @code{:static} keyword is unique to @eieio{}. +@b{Note:} The @code{subclass} specializer is unique to @eieio{}. @c TODO - Write some more about static methods here @@ -977,9 +974,9 @@ When classes are defined, you can specify the @code{:method-invocation-order}. This is a feature specific to EIEIO. This controls the order in which method resolution occurs for -@code{:primary} methods in cases of multiple inheritance. The order +methods in cases of multiple inheritance. The order affects which method is called first in a tree, and if -@code{call-next-method} is used, it controls the order in which the +@code{cl-call-next-method} is used, it controls the order in which the stack of methods are run. The original EIEIO order turned out to be broken for multiple @@ -1297,8 +1294,7 @@ class. @defmethod eieio-instance-tracker initialize-instance obj slot This method is defined as an @code{:after} method. -It adds new instances to the master list. Do not overload this method -unless you use @code{call-next-method.} +It adds new instances to the master list. @end defmethod @defmethod eieio-instance-tracker delete-instance obj @@ -1582,7 +1578,7 @@ Additional useful methods defined on the base subclass are: Make a copy of @var{obj}, and then apply @var{params}. @var{params} is a parameter list of the same form as @var{initialize-instance} which are applied to change the object. When overloading @dfn{clone}, be -sure to call @dfn{call-next-method} first and modify the returned object. +sure to call @dfn{cl-call-next-method} first and modify the returned object. @end defun @defun object-print this &rest strings @@ -1595,7 +1591,7 @@ It is sometimes useful to put a summary of the object into the default # string when using eieio browsing tools. Implement this function and specify @var{strings} in a call to -@dfn{call-next-method} to provide additional summary information. +@dfn{cl-call-next-method} to provide additional summary information. When passing in extra strings from child classes, always remember to prepend a space. @@ -1604,10 +1600,11 @@ to prepend a space. (value) "Object containing one data slot.") -(defmethod object-print ((this data-object) &optional strings) +(cl-defmethod object-print ((this data-object) &optional strings) "Return a string with a summary of the data object as part of the name." - (apply 'call-next-method this - (cons (format " value: %s" (render this)) strings))) + (apply #'cl-call-next-method this + (format " value: %s" (render this)) + strings)) @end example Here is what some output could look like: @@ -1667,24 +1664,36 @@ In @var{clos}, the argument list is (@var{class} @var{object} @var{slot-name}), @var{eieio} can only dispatch on the first argument, so the first two are swapped. @end defun -@defun no-applicable-method object method &rest args -@anchor{no-applicable-method} -Called if there are no implementations for @var{object} in @var{method}. -@var{object} is the object which has no method implementation. -@var{args} are the arguments that were passed to @var{method}. +@defun cl-no-applicable-method generic &rest args +@anchor{cl-no-applicable-method} +Called if there are no methods applicable for @var{args} in the generic +function @var{generic}. +@var{args} are the arguments that were passed to @var{generic}. Implement this for a class to block this signal. The return value becomes the return value of the original method call. @end defun -@defun no-next-method object &rest args -@anchor{no-next-method} -Called from @dfn{call-next-method} when no additional methods are available. -@var{object} is othe object being called on @dfn{call-next-method}. +@defun cl-no-primary-method generic &rest args +@anchor{cl-no-primary-method} +Called if there are methods applicable for @var{args} in the generic +function @var{generic} but they are all qualified. +@var{args} are the arguments that were passed to @var{generic}. + +Implement this for a class to block this signal. The return +value becomes the return value of the original method call. +@end defun + +@defun cl-no-next-method generic method &rest args +@anchor{cl-no-next-method} +Called from @dfn{cl-call-next-method} when no additional methods are available. +@var{generic} is the generic function being called on +@dfn{cl-call-next-method}, @var{method} is the method where +@dfn{cl-call-next-method} was called, and @var{args} are the arguments it is called by. -This method signals @dfn{no-next-method} by default. Override this +This method signals @dfn{cl-no-next-method} by default. Override this method to not throw an error, and its return value becomes the -return value of @dfn{call-next-method}. +return value of @dfn{cl-call-next-method}. @end defun @node Signals @@ -1699,23 +1708,29 @@ This signal is called when an attempt to reference a slot in an it. @end deffn -@deffn Signal no-method-definition method arguments -This signal is called when @var{method} is called, with @var{arguments} -and nothing is resolved. This occurs when @var{method} has been +@deffn Signal cl-no-applicable-method generic arguments +This signal is called when @var{generic} is called, with @var{arguments} +and nothing is resolved. This occurs when @var{generic} has been defined, but the arguments make it impossible for @eieio{} to determine which method body to run. To prevent this signal from occurring in your class, implement the -method @code{no-applicable-method} for your class. This method is +method @code{cl-no-applicable-method} for your class. This method is called when to throw this signal, so implementing this for your class allows you block the signal, and perform some work. @end deffn -@deffn Signal no-next-method class arguments -This signal is called if the function @code{call-next-method} is called +@deffn Signal cl-no-primary-method generic arguments +Like @code{cl-no-applicable-method} but applies when there are some applicable +methods, but none of them are primary. You can similarly block it by +implementing a @code{cl-no-primary-method} method. +@end deffn + +@deffn Signal cl-no-next-method class arguments +This signal is called if the function @code{cl-call-next-method} is called and there is no next method to be called. -Overload the method @code{no-next-method} to protect against this signal. +Overload the method @code{cl-no-next-method} to protect against this signal. @end deffn @deffn Signal invalid-slot-type slot spec value @@ -1796,22 +1811,17 @@ Make instance works as expected, however it just uses the @eieio{} instance creator automatically generated when a new class is created. @xref{Making New Objects}. -@item defgeneric -Creates the desired symbol, and accepts all of the expected arguments -except @code{:around}. - -@item defmethod -Calls defgeneric, and accepts most of the expected arguments. Only -the first argument to the created method may have a type specifier. -To type cast against a class, the class must exist before defmethod is -called. In addition, the @code{:around} tag is not supported. - -@item call-next-method -Inside a method, calls the next available method up the inheritance tree -for the given object. This is different than that found in CLOS because -in @eieio{} this function accepts replacement arguments. This permits -subclasses to modify arguments as they are passed up the tree. If no -arguments are given, the expected CLOS behavior is used. +@item cl-defgeneric +Creates the desired symbol, and accepts most of the expected arguments of +CLOS's @code{defgeneric}. + +@item cl-defmethod +Accepts most of the expected arguments of CLOS's @code{defmethod}. To type +cast against a class, the class must exist before @code{cl-defmethod} +is called. + +@item cl-call-next-method +Works just like CLOS's @code{call-next-method}. @end table CLOS supports the @code{describe} command, but @eieio{} provides @@ -1834,13 +1844,7 @@ Some important compatibility features that would be good to add are: @enumerate @item -Support for metaclasses and EQL specialization. -@item -@code{:around} method key. -@item -Method dispatch for built-in types. -@item -Method dispatch for multiple argument typing. +Support for metaclasses. @item Improve integration with the @file{cl} package. @end enumerate commit 8d7a3f489082e2aaf4ff238613a497cc03d833ae Author: Stefan Monnier Date: Tue Feb 28 09:41:04 2017 -0500 * lisp/cedet/mode-local.el (define-mode-local-override): Declare doctring. diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el index ef24e8a6cb..88ee400141 100644 --- a/lisp/cedet/mode-local.el +++ b/lisp/cedet/mode-local.el @@ -579,6 +579,8 @@ ARGS are the function arguments, which should match those of the same named function created with `define-overload'. DOCSTRING is the documentation string. BODY is the implementation of this function." + ;; FIXME: Make this obsolete and use cl-defmethod with &context instead. + (declare (doc-string 4)) (let ((newname (intern (format "%s-%s" name mode)))) `(progn (eval-and-compile commit a3069604d5d672975ee9e421881fad9be95aaf54 Author: Stefan Monnier Date: Tue Feb 28 09:35:25 2017 -0500 * lisp/nxml/nxml-mode.el (nxml-mode): Use new sgml-syntax-propertize. diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el index 7f9ece7914..7e33e743de 100644 --- a/lisp/nxml/nxml-mode.el +++ b/lisp/nxml/nxml-mode.el @@ -518,7 +518,7 @@ Many aspects this mode can be customized using (nxml-with-invisible-motion (nxml-scan-prolog))))) (setq-local syntax-ppss-table sgml-tag-syntax-table) - (setq-local syntax-propertize-function sgml-syntax-propertize-function) + (setq-local syntax-propertize-function #'sgml-syntax-propertize) (add-hook 'change-major-mode-hook #'nxml-cleanup nil t) ;; Emacs 23 handles the encoding attribute on the xml declaration commit 00551901745e51562dfb2fe4bf901ffecd7c42a7 Author: Stefan Monnier Date: Tue Feb 28 09:34:13 2017 -0500 * lisp/textmodes/sgml-mode.el: syntax-propertize (sgml-syntax-propertize-function): Mark . (sgml-syntax-propertize-inside): New fun. diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index e148b06aa7..97a1144398 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -341,20 +341,40 @@ Any terminating `>' or `/' is not matched.") (defvar sgml-font-lock-keywords sgml-font-lock-keywords-1 "Rules for highlighting SGML code. See also `sgml-tag-face-alist'.") -(defconst sgml-syntax-propertize-function +(defun sgml-syntax-propertize (start end) + "Syntactic keywords for `sgml-mode'." + (goto-char start) + (sgml-syntax-propertize-inside end) + (funcall (syntax-propertize-rules ;; Use the `b' style of comments to avoid interference with the -- ... -- ;; comments recognized when `sgml-specials' includes ?-. - ;; FIXME: beware of blabla !! + ;; FIXME: beware of blabla !! ("\\(<\\)!--" (1 "< b")) - ("--[ \t\n]*\\(>\\)" (1 "> b")) - ;; Double quotes outside of tags should not introduce strings. - ;; Be careful to call `syntax-ppss' on a position before the one we're - ;; going to change, so as not to need to flush the data we just computed. - ("\"" (0 (if (prog1 (zerop (car (syntax-ppss (match-beginning 0)))) - (goto-char (match-end 0))) - (string-to-syntax "."))))) - "Syntactic keywords for `sgml-mode'.") + ("--[ \t\n]*\\(>\\)" (1 "> b")) + ("\\(<\\)[?!]" (1 (prog1 "|>" + (sgml-syntax-propertize-inside end)))) + ;; Double quotes outside of tags should not introduce strings. + ;; Be careful to call `syntax-ppss' on a position before the one we're + ;; going to change, so as not to need to flush the data we just computed. + ("\"" (0 (if (prog1 (zerop (car (syntax-ppss (match-beginning 0)))) + (goto-char (match-end 0))) + (string-to-syntax "."))))) + start end)) + +(defun sgml-syntax-propertize-inside (end) + (let ((ppss (syntax-ppss))) + (cond + ((eq (nth 3 ppss) t) + (let ((endre (save-excursion + (goto-char (nth 8 ppss)) + (cond + ((looking-at-p "") + ((looking-at-p "<\\?") (if sgml-xml-mode "\\?>" ">")) + (t ">"))))) + (when (re-search-forward endre end 'move) + (put-text-property (1- (point)) (point) + 'syntax-table (string-to-syntax "|<")))))))) ;; internal (defvar sgml-face-tag-alist () @@ -547,7 +567,7 @@ Do \\[describe-key] on the following bindings to discover what they do. sgml-font-lock-keywords-1 sgml-font-lock-keywords-2) nil t)) - (setq-local syntax-propertize-function sgml-syntax-propertize-function) + (setq-local syntax-propertize-function #'sgml-syntax-propertize) (setq-local facemenu-add-face-function 'sgml-mode-facemenu-add-face-function) (setq-local sgml-xml-mode (sgml-xml-guess)) (unless sgml-xml-mode commit fe578ae4ddccbc4736b1e17ec4ecf2317fe03b0e Author: Stefan Monnier Date: Tue Feb 28 09:29:06 2017 -0500 * lisp/textmodes/css-mode.el (css-completion-at-point): Auto-insert ": ;" after completing a property. diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index cd86db639a..7a9454f7f3 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -696,7 +696,8 @@ cannot be completed sensibly: `custom-ident', ;; Even though pseudo-elements should be prefixed by ::, a ;; single colon is accepted for backward compatibility. "\\(?:\\(:" (regexp-opt (append css-pseudo-class-ids - css-pseudo-element-ids) t) + css-pseudo-element-ids) + t) "\\|\\::" (regexp-opt css-pseudo-element-ids t) "\\)" "\\(?:([^)]+)\\)?" (if (not sassy) @@ -965,10 +966,22 @@ pseudo-elements, pseudo-classes, at-rules, and bang-rules." (seq-let (prop-beg prop-end prop-table) (css--complete-property) (seq-let (sel-beg sel-end sel-table) (css--complete-selector) (when (or prop-table sel-table) + ;; FIXME: If both prop-table and sel-table are set but + ;; prop-beg/prop-end is different from sel-beg/sel-end + ;; we have a problem! `(,@(if prop-table (list prop-beg prop-end) (list sel-beg sel-end)) - ,(completion-table-merge prop-table sel-table))))))) + ,(completion-table-merge prop-table sel-table) + :exit-function + ,(lambda (string status) + (and (eq status 'finished) + prop-table + (test-completion string prop-table) + (not (and sel-table + (test-completion string sel-table))) + (progn (insert ": ;") + (forward-char -1)))))))))) ;;;###autoload (define-derived-mode css-mode prog-mode "CSS"