diff --git a/lisp/align.el b/lisp/align.el index 79a75dcec79..6b6cba12447 100644 --- a/lisp/align.el +++ b/lisp/align.el @@ -568,7 +568,14 @@ The possible settings for `align-region-separate' are: (css-declaration (regexp . "^\\s-*\\(?:\\w-?\\)+:\\(\\s-*\\).*;") (group . (1)) - (modes . '(css-mode html-mode)))) + (modes . '(css-mode html-mode))) + + (toml-assignment + (regexp . ,(rx (group (zero-or-more (syntax whitespace))) + "=" + (group (zero-or-more (syntax whitespace))))) + (group . (1 2)) + (modes . '(conf-toml-mode toml-ts-mode)))) "A list describing all of the available alignment rules. The format is: diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 392f8fafa79..6ce00bf4d6d 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -609,7 +609,7 @@ package." (package-archive-priority (package-desc-archive pkg-desc))) (defun package--parse-elpaignore (pkg-desc) - "Return the of regular expression to match files ignored by PKG-DESC." + "Return a list of regular expressions to match files ignored by PKG-DESC." (let* ((pkg-dir (file-name-as-directory (package-desc-dir pkg-desc))) (ignore (expand-file-name ".elpaignore" pkg-dir)) files) diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el index 550b5ed0e6a..37065f5d41a 100644 --- a/lisp/ibuf-ext.el +++ b/lisp/ibuf-ext.el @@ -143,10 +143,10 @@ Returns (OLD-FORMAT-DETECTED . UPDATED-SAVED-FILTERS-LIST)." (mode . bibtex-mode))) ("web" (or (derived-mode . sgml-mode) - (derived-mode . css-mode) - (mode . javascript-mode) + (derived-mode . css-base-mode) + (derived-mode . js-base-mode) + (derived-mode . typescript-ts-base-mode) (mode . js2-mode) - (mode . scss-mode) (derived-mode . haml-mode) (mode . sass-mode))) ("gnus" diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el index 6fcb0ae5e69..590544f199f 100644 --- a/lisp/net/tramp-archive.el +++ b/lisp/net/tramp-archive.el @@ -263,7 +263,7 @@ It must be supported by libarchive(3).") (file-regular-p . tramp-handle-file-regular-p) ;; `file-remote-p' performed by default handler. (file-selinux-context . tramp-handle-file-selinux-context) - (file-symlink-p . tramp-handle-file-symlink-p) + (file-symlink-p . tramp-archive-handle-file-symlink-p) (file-system-info . tramp-archive-handle-file-system-info) (file-truename . tramp-archive-handle-file-truename) (file-user-uid . tramp-archive-handle-file-user-uid) @@ -666,6 +666,10 @@ offered." "Like `file-readable-p' for file archives." (file-readable-p (tramp-archive-gvfs-file-name filename))) +(defun tramp-archive-handle-file-symlink-p (filename) + "Like `file-symlink-p' for file archives." + (file-symlink-p (tramp-archive-gvfs-file-name filename))) + (defun tramp-archive-handle-file-system-info (filename) "Like `file-system-info' for file archives." (with-parsed-tramp-archive-file-name filename nil diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index e0d38853956..8282e9c87ff 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el @@ -80,7 +80,6 @@ ;;; Code: (require 'tramp-compat) -(require 'tramp-loaddefs) (require 'time-stamp) ;;; -- Cache -- @@ -125,6 +124,7 @@ details see the info pages." If it doesn't exist yet, it is created and initialized with matching entries of `tramp-connection-properties'. If KEY is `tramp-cache-undefined', don't create anything, and return nil." + (declare (tramp-suppress-trace t)) (unless (eq key tramp-cache-undefined) (or (gethash key tramp-cache-data) (let ((hash @@ -506,6 +506,7 @@ PROPERTIES is a list of file properties (strings)." ;;;###tramp-autoload (defun tramp-cache-print (table) "Print hash table TABLE." + ;; (declare (tramp-suppress-trace t)) (when (hash-table-p table) (let (result) (maphash @@ -538,6 +539,11 @@ PROPERTIES is a list of file properties (strings)." table) result))) +;; We cannot use the `declare' form for `tramp-suppress-trace' in +;; autoloaded functions, because the tramp-loaddefs.el generation +;; would fail. +(function-put #'tramp-cache-print 'tramp-suppress-trace t) + ;;;###tramp-autoload (defun tramp-list-connections () "Return all active `tramp-file-name' structs according to `tramp-cache-data'." @@ -553,6 +559,7 @@ PROPERTIES is a list of file properties (strings)." (defun tramp-dump-connection-properties () "Write persistent connection properties into file \ `tramp-persistency-file-name'." + (declare (tramp-suppress-trace t)) ;; We shouldn't fail, otherwise Emacs might not be able to be closed. (ignore-errors (when (and (hash-table-p tramp-cache-data) diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el index 3c9b9e984e6..87651d60328 100644 --- a/lisp/net/tramp-cmds.el +++ b/lisp/net/tramp-cmds.el @@ -221,6 +221,7 @@ functions are called with `current-buffer' set." (defun tramp-cleanup-dired-buffer-p () "Return t if current buffer runs `dired-mode'." + (declare (tramp-suppress-trace t)) (derived-mode-p 'dired-mode)) (add-hook 'tramp-cleanup-some-buffers-hook @@ -231,14 +232,21 @@ functions are called with `current-buffer' set." (defun tramp-delete-tainted-remote-process-buffer-function () "Delete current buffer from `tramp-tainted-remote-process-buffers'." + (declare (tramp-suppress-trace t)) (setq tramp-tainted-remote-process-buffers (delete (current-buffer) tramp-tainted-remote-process-buffers))) ;;;###tramp-autoload (defun tramp-taint-remote-process-buffer (buffer) "Mark buffer as related to remote processes." + ;; (declare (tramp-suppress-trace t)) (add-to-list 'tramp-tainted-remote-process-buffers buffer)) +;; We cannot use the `declare' form for `tramp-suppress-trace' in +;; autoloaded functions, because the tramp-loaddefs.el generation +;; would fail. +(function-put #'tramp-taint-remote-process-buffer 'tramp-suppress-trace t) + (add-hook 'kill-buffer-hook #'tramp-delete-tainted-remote-process-buffer-function) (add-hook 'tramp-unload-hook diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 85ddb81f398..5bd3dff3d21 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -29,6 +29,7 @@ ;;; Code: +(require 'tramp-loaddefs) (require 'ansi-color) (require 'auth-source) (require 'format-spec) @@ -36,7 +37,7 @@ (require 'shell) (require 'xdg) -(declare-function tramp-error "tramp") +(declare-function tramp-error "tramp-message") (declare-function tramp-tramp-file-p "tramp") (defvar tramp-temp-name-prefix) diff --git a/lisp/net/tramp-crypt.el b/lisp/net/tramp-crypt.el index c85f566c4d5..79eafc5c12e 100644 --- a/lisp/net/tramp-crypt.el +++ b/lisp/net/tramp-crypt.el @@ -281,7 +281,7 @@ arguments to pass to the OPERATION." (assoc operation tramp-crypt-file-name-handler-alist)))) (prog1 (save-match-data (apply (cdr fn) args)) (setq tramp-debug-message-fnh-function (cdr fn))) - (prog1 (tramp-run-real-handler operation args) + (prog1 (tramp-crypt-run-real-handler operation args) (setq tramp-debug-message-fnh-function operation)))) ;;;###tramp-autoload diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el index d7fcd8afefa..c73c86a9110 100644 --- a/lisp/net/tramp-integration.el +++ b/lisp/net/tramp-integration.el @@ -65,6 +65,7 @@ "Set up a minibuffer for `file-name-shadow-mode'. Adds another overlay hiding filename parts according to Tramp's special handling of `substitute-in-file-name'." + (declare (tramp-suppress-trace t)) (when minibuffer-completing-file-name (setq tramp-rfn-eshadow-overlay (make-overlay (minibuffer-prompt-end) (minibuffer-prompt-end))) @@ -86,6 +87,7 @@ special handling of `substitute-in-file-name'." (defun tramp-rfn-eshadow-update-overlay-regexp () "An overlay covering the shadowed part of the filename." + (declare (tramp-suppress-trace t)) (rx-to-string `(: (* (not (any ,tramp-postfix-host-format "/~"))) (| "/" "~")))) @@ -94,6 +96,7 @@ special handling of `substitute-in-file-name'." This is intended to be used as a minibuffer `post-command-hook' for `file-name-shadow-mode'; the minibuffer should have already been set up by `rfn-eshadow-setup-minibuffer'." + (declare (tramp-suppress-trace t)) ;; In remote files name, there is a shadowing just for the local part. (ignore-errors (let ((end (or (overlay-end rfn-eshadow-overlay) diff --git a/lisp/net/tramp-message.el b/lisp/net/tramp-message.el index cf90db1d6b1..cca22a28d7c 100644 --- a/lisp/net/tramp-message.el +++ b/lisp/net/tramp-message.el @@ -47,25 +47,13 @@ ;;; Code: -(require 'tramp-loaddefs) +(require 'tramp-compat) (require 'help-mode) -(declare-function tramp-compat-string-replace "tramp-compat") (declare-function tramp-file-name-equal-p "tramp") (declare-function tramp-file-name-host-port "tramp") (declare-function tramp-file-name-user-domain "tramp") (declare-function tramp-get-default-directory "tramp") -(defvar tramp-compat-temporary-file-directory) - -(eval-and-compile - (defalias 'tramp-byte-run--set-suppress-trace - #'(lambda (f _args val) - (list 'function-put (list 'quote f) - ''tramp-suppress-trace val))) - - (add-to-list - 'defun-declarations-alist - (list 'tramp-suppress-trace #'tramp-byte-run--set-suppress-trace))) ;;;###tramp-autoload (defcustom tramp-verbose 3 @@ -132,6 +120,7 @@ When it is used for regexp matching, the regexp groups are Point must be at the beginning of a header line. The outline level is equal to the verbosity of the Tramp message." + (declare (tramp-suppress-trace t)) (1+ (string-to-number (match-string 3)))) ;; This function takes action since Emacs 28.1, when @@ -140,6 +129,7 @@ The outline level is equal to the verbosity of the Tramp message." (defun tramp-debug-buffer-command-completion-p (_symbol buffer) "A predicate for Tramp interactive commands. They are completed by \"M-x TAB\" only in Tramp debug buffers." + (declare (tramp-suppress-trace t)) (with-current-buffer buffer (string-equal (buffer-substring (point-min) (min (+ (point-min) 10) (point-max))) @@ -306,6 +296,7 @@ is greater than or equal 4. Calls functions `message' and `tramp-debug-message' with FMT-STRING as control string and the remaining ARGUMENTS to actually emit the message (if applicable)." + ;; (declare (tramp-suppress-trace t)) (ignore-errors (when (<= level tramp-verbose) ;; Display only when there is a minimum level, and the progress @@ -346,8 +337,10 @@ applicable)." (concat (format "(%d) # " level) fmt-string) arguments)))))) -;; We cannot declare our private symbols in loaddefs. -(function-put 'tramp-message 'tramp-suppress-trace t) +;; We cannot use the `declare' form for `tramp-suppress-trace' in +;; autoloaded functions, because the tramp-loaddefs.el generation +;; would fail. +(function-put #'tramp-message 'tramp-suppress-trace t) (defsubst tramp-backtrace (&optional vec-or-proc force) "Dump a backtrace into the debug buffer. @@ -473,6 +466,7 @@ the resulting error message." (defun tramp-debug-button-action (button) "Goto the linked message in debug buffer at place." + (declare (tramp-suppress-trace t)) (when (mouse-event-p last-input-event) (mouse-set-point last-input-event)) (when-let ((point (button-get button 'position))) (goto-char point))) @@ -485,6 +479,7 @@ the resulting error message." (defun tramp-debug-link-messages (pos1 pos2) "Set links for two messages in current buffer. The link buttons are in the verbositiy level substrings." + (declare (tramp-suppress-trace t)) (save-excursion (let (beg1 end1 beg2 end2) (goto-char pos1) @@ -518,6 +513,7 @@ Bound in `tramp-*-file-name-handler' functions.") (defun tramp-debug-message-buttonize (position) "Buttonize function in current buffer, at next line starting after POSTION." + (declare (tramp-suppress-trace t)) (save-excursion (goto-char position) (while (not (search-forward-regexp diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 772acc843b7..2c1acb7f5fc 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -87,15 +87,6 @@ ;;;###autoload (when (featurep 'tramp-compat) ;;;###autoload (load "tramp-compat" 'noerror 'nomessage)) -;;; User Customizable Internal Variables: - -(defgroup tramp nil - "Edit remote files with a combination of ssh, scp, etc." - :group 'files - :group 'comm - :version "22.1" - :link '(custom-manual "(tramp)Top")) - ;;;###tramp-autoload (progn (defvar tramp--startup-hook nil @@ -105,9 +96,26 @@ (defmacro tramp--with-startup (&rest body) "Schedule BODY to be executed at the end of tramp.el." - `(add-hook 'tramp--startup-hook (lambda () ,@body)))) + `(add-hook 'tramp--startup-hook (lambda () ,@body))) -(require 'tramp-loaddefs) + (eval-and-compile + (defalias 'tramp-byte-run--set-suppress-trace + #'(lambda (f _args val) + (list 'function-put (list 'quote f) + ''tramp-suppress-trace val))) + + (add-to-list + 'defun-declarations-alist + (list 'tramp-suppress-trace #'tramp-byte-run--set-suppress-trace)))) + +;;; User Customizable Internal Variables: + +(defgroup tramp nil + "Edit remote files with a combination of ssh, scp, etc." + :group 'files + :group 'comm + :version "22.1" + :link '(custom-manual "(tramp)Top")) ;; Maybe we need once a real Tramp mode, with key bindings etc. ;;;###autoload @@ -1485,6 +1493,7 @@ If LOCALNAME is an absolute file name, set it as localname. If LOCALNAME is a relative file name, return `tramp-cache-undefined'. Objects returned by this function compare `equal' if they refer to the same connection. Make a copy in order to avoid side effects." + ;; (declare (tramp-suppress-trace t)) (if (and (stringp localname) (not (file-name-absolute-p localname))) (setq vec tramp-cache-undefined) @@ -1496,13 +1505,16 @@ same connection. Make a copy in order to avoid side effects." (tramp-file-name-hop vec) nil)) vec)) -;; We cannot declare our private symbols in loaddefs. -(function-put 'tramp-file-name-unify 'tramp-suppress-trace t) +;; We cannot use the `declare' form for `tramp-suppress-trace' in +;; autoloaded functions, because the tramp-loaddefs.el generation +;; would fail. +(function-put #'tramp-file-name-unify 'tramp-suppress-trace t) ;; Comparison of file names is performed by `tramp-equal-remote'. (defun tramp-file-name-equal-p (vec1 vec2) "Check, whether VEC1 and VEC2 denote the same `tramp-file-name'. LOCALNAME and HOP do not count." + (declare (tramp-suppress-trace t)) (and (tramp-file-name-p vec1) (tramp-file-name-p vec2) (equal (tramp-file-name-unify vec1) (tramp-file-name-unify vec2)))) @@ -1531,6 +1543,7 @@ entry does not exist, return nil." ;;;###tramp-autoload (defun tramp-tramp-file-p (name) "Return t if NAME is a string with Tramp file name syntax." + ;; (declare (tramp-suppress-trace t)) (and tramp-mode (stringp name) ;; No "/:" and "/c:". This is not covered by `tramp-file-name-regexp'. (not (string-match-p (rx bos "/" (? alpha) ":") name)) @@ -1540,6 +1553,11 @@ entry does not exist, return nil." (string-match-p tramp-file-name-regexp name) t)) +;; We cannot use the `declare' form for `tramp-suppress-trace' in +;; autoloaded functions, because the tramp-loaddefs.el generation +;; would fail. +(function-put #'tramp-tramp-file-p 'tramp-suppress-trace t) + ;; This function bypasses the file name handler approach. It is NOT ;; recommended to use it in any package if not absolutely necessary. ;; However, it is more performant than `file-local-name', and might be @@ -1568,6 +1586,7 @@ of `process-file', `start-file-process', or `shell-command'." "Return the right method string to use depending on USER and HOST. This is METHOD, if non-nil. Otherwise, do a lookup in `tramp-default-method-alist' and `tramp-default-method'." + (declare (tramp-suppress-trace t)) (when (and method (or (string-empty-p method) (string-equal method tramp-default-method-marker))) @@ -1593,6 +1612,7 @@ This is METHOD, if non-nil. Otherwise, do a lookup in "Return the right user string to use depending on METHOD and HOST. This is USER, if non-nil. Otherwise, do a lookup in `tramp-default-user-alist' and `tramp-default-user'." + (declare (tramp-suppress-trace t)) (let ((result (or user (let ((choices tramp-default-user-alist) @@ -1614,6 +1634,7 @@ This is USER, if non-nil. Otherwise, do a lookup in "Return the right host string to use depending on METHOD and USER. This is HOST, if non-nil. Otherwise, do a lookup in `tramp-default-host-alist' and `tramp-default-host'." + (declare (tramp-suppress-trace t)) (let ((result (or (and (tramp-compat-length> host 0) host) (let ((choices tramp-default-host-alist) @@ -1640,6 +1661,7 @@ localname (file name on remote host), and hop. Unless NODEFAULT is non-nil, method, user and host are expanded to their default values. For the other file name parts, no default values are used." + ;; (declare (tramp-suppress-trace t)) (save-match-data (unless (tramp-tramp-file-p name) (tramp-user-error nil "Not a Tramp file name: \"%s\"" name)) @@ -1696,8 +1718,10 @@ default values are used." (tramp-user-error v "Method `%s' is not supported for multi-hops" method))))))) -;; We cannot declare our private symbols in loaddefs. -(function-put 'tramp-dissect-file-name 'tramp-suppress-trace t) +;; We cannot use the `declare' form for `tramp-suppress-trace' in +;; autoloaded functions, because the tramp-loaddefs.el generation +;; would fail. +(function-put #'tramp-dissect-file-name 'tramp-suppress-trace t) ;;;###tramp-autoload (defun tramp-ensure-dissected-file-name (vec-or-filename) @@ -1705,13 +1729,16 @@ default values are used." VEC-OR-FILENAME may be either a string or a `tramp-file-name'. If it's not a Tramp filename, return nil." + ;; (declare (tramp-suppress-trace t)) (cond ((tramp-file-name-p vec-or-filename) vec-or-filename) ((tramp-tramp-file-p vec-or-filename) (tramp-dissect-file-name vec-or-filename)))) -;; We cannot declare our private symbols in loaddefs. -(function-put 'tramp-ensure-dissected-file-name 'tramp-suppress-trace t) +;; We cannot use the `declare' form for `tramp-suppress-trace' in +;; autoloaded functions, because the tramp-loaddefs.el generation +;; would fail. +(function-put #'tramp-ensure-dissected-file-name 'tramp-suppress-trace t) (defun tramp-dissect-hop-name (name &optional nodefault) "Return a `tramp-file-name' structure of `hop' part of NAME. @@ -1738,6 +1765,7 @@ See `tramp-dissect-file-name' for details." (defun tramp-buffer-name (vec) "A name for the connection buffer VEC." + (declare (tramp-suppress-trace t)) (let ((method (tramp-file-name-method vec)) (user-domain (tramp-file-name-user-domain vec)) (host-port (tramp-file-name-host-port vec))) @@ -6171,6 +6199,7 @@ Return the local name of the temporary file." (defun tramp-delete-temp-file-function () "Remove temporary files related to current buffer." + (declare (tramp-suppress-trace t)) (when (stringp tramp-temp-buffer-file-name) (ignore-errors (delete-file tramp-temp-buffer-file-name)))) @@ -6463,6 +6492,7 @@ Consults the auth-source package." (defun tramp-time-diff (t1 t2) "Return the difference between the two times, in seconds. T1 and T2 are time values (as returned by `current-time' for example)." + (declare (tramp-suppress-trace t)) (float-time (time-subtract t1 t2))) (defun tramp-unquote-shell-quote-argument (s) diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el index 6bf1c0d4f6f..4d0dde7752b 100644 --- a/lisp/textmodes/conf-mode.el +++ b/lisp/textmodes/conf-mode.el @@ -245,6 +245,7 @@ This variable is best set in the file local variables, or through ("^\\s-*\\(.+?\\)\\(?:\\[\\(.*?\\)\\]\\)?\\s-*=" (1 'font-lock-variable-name-face) (2 'font-lock-constant-face nil t)) + ;; Must be lower-case according to the TOML spec. ("\\_" 0 'font-lock-keyword-face)) "Keywords to highlight in Conf TOML mode.") @@ -644,7 +645,10 @@ For details see `conf-mode'. Example: \[entry] value = \"some string\"" - (conf-mode-initialize "#" 'conf-toml-font-lock-keywords) + (conf-mode-initialize "#") + ;; Booleans are "always lowercase", so we must *not* use case + ;; folding. Therefore, we can't set it using `conf-mode-initialize´. + (setq-local font-lock-defaults `(,conf-toml-font-lock-keywords nil nil nil nil)) (setq-local conf-assignment-column 0) (setq-local conf-assignment-sign ?=)) diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el index d80cdc34775..27f3b2acd1c 100644 --- a/lisp/textmodes/sgml-mode.el +++ b/lisp/textmodes/sgml-mode.el @@ -2680,7 +2680,6 @@ HTML Autoview mode is a buffer-local minor mode for use with "" \n "" \n "" \n - "" \n "" \n "" (skeleton-read "Page Title: ") "" \n "" \n diff --git a/lisp/textmodes/toml-ts-mode.el b/lisp/textmodes/toml-ts-mode.el index 2c491034372..193c83f9aec 100644 --- a/lisp/textmodes/toml-ts-mode.el +++ b/lisp/textmodes/toml-ts-mode.el @@ -39,8 +39,8 @@ (defcustom toml-ts-mode-indent-offset 2 "Number of spaces for each indentation step in `toml-ts-mode'." :version "29.1" - :type 'integer - :safe 'integerp + :type 'natnum + :safe 'natnump :group 'toml) (defvar toml-ts-mode--syntax-table diff --git a/src/image.c b/src/image.c index 8a8f18754ac..06fc44b5abd 100644 --- a/src/image.c +++ b/src/image.c @@ -466,32 +466,101 @@ image_reference_bitmap (struct frame *f, ptrdiff_t id) } #ifdef HAVE_PGTK + +/* Create a Cairo pattern from the bitmap BITS, which should be WIDTH + and HEIGHT in size. BITS's fill order is LSB first, meaning that + the value of the left most pixel within a byte is its least + significant bit. */ + static cairo_pattern_t * -image_create_pattern_from_pixbuf (struct frame *f, GdkPixbuf * pixbuf) +image_bitmap_to_cr_pattern (char *bits, int width, int height) { - GdkPixbuf *pb = gdk_pixbuf_add_alpha (pixbuf, TRUE, 255, 255, 255); - cairo_surface_t *surface = - cairo_surface_create_similar_image (cairo_get_target - (f->output_data.pgtk->cr_context), - CAIRO_FORMAT_A1, - gdk_pixbuf_get_width (pb), - gdk_pixbuf_get_height (pb)); + cairo_surface_t *surface; + unsigned char *data; + int stride; + cairo_pattern_t *pattern; +#ifdef WORDS_BIGENDIAN + int x; + static const unsigned char table[] = { + 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, + 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, + 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, + 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, + 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, + 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, + 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, + 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, + 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, + 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, + 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, + 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, + 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, + 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, + 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, + 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, + 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, + 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, + 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, + 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, + 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, + 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, + 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, + 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, + 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, + 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, + 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, + 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, + 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, + 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, + 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, + }; +#endif /* WORDS_BIGENDIAN */ - cairo_t *cr = cairo_create (surface); - gdk_cairo_set_source_pixbuf (cr, pb, 0, 0); - cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); - cairo_paint (cr); - cairo_destroy (cr); + surface = cairo_image_surface_create (CAIRO_FORMAT_A1, width, + height); - cairo_pattern_t *pat = cairo_pattern_create_for_surface (surface); - cairo_pattern_set_extend (pat, CAIRO_EXTEND_REPEAT); + if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS) + memory_full (0); + cairo_surface_flush (surface); + data = cairo_image_surface_get_data (surface); + stride = cairo_image_surface_get_stride (surface); + +#ifdef WORDS_BIGENDIAN + /* Big endian systems require that individual bytes be inverted to + compensate for the different fill order used by Cairo. */ + while (height--) + { + memcpy (data, bits, (width + 7) / 8); + for (x = 0; x < (width + 7) / 8; ++x) + data[x] = table[data[x]]; + data += stride; + bits += (width + 7) / 8; + } +#else /* !WORDS_BIGENDIAN */ + /* Cairo uses LSB first fill order for bitmaps on little-endian + systems, so copy each row over. */ + + while (height--) + { + memcpy (data, bits, (width + 7) / 8); + data += stride; + bits += (width + 7) / 8; + } +#endif /* WORDS_BIGENDIAN */ + + cairo_surface_mark_dirty (surface); + pattern = cairo_pattern_create_for_surface (surface); + if (cairo_pattern_status (pattern) != CAIRO_STATUS_SUCCESS) + memory_full (0); + + /* The pattern now holds a reference to the surface. */ cairo_surface_destroy (surface); - g_object_unref (pb); - - return pat; + cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT); + return pattern; } -#endif + +#endif /* HAVE_PGTK */ /* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS. */ @@ -541,46 +610,9 @@ image_create_bitmap_from_data (struct frame *f, char *bits, #endif #ifdef HAVE_PGTK - GdkPixbuf *pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, - FALSE, - 8, - width, - height); - { - char *sp = bits; - int mask = 0x01; - unsigned char *buf = gdk_pixbuf_get_pixels (pixbuf); - int rowstride = gdk_pixbuf_get_rowstride (pixbuf); - for (int y = 0; y < height; y++) - { - unsigned char *dp = buf + rowstride * y; - for (int x = 0; x < width; x++) - { - if (*sp & mask) - { - *dp++ = 0xff; - *dp++ = 0xff; - *dp++ = 0xff; - } - else - { - *dp++ = 0x00; - *dp++ = 0x00; - *dp++ = 0x00; - } - if ((mask <<= 1) >= 0x100) - { - mask = 0x01; - sp++; - } - } - if (mask != 0x01) - { - mask = 0x01; - sp++; - } - } - } + cairo_pattern_t *pattern; + + pattern = image_bitmap_to_cr_pattern (bits, width, height); #endif /* HAVE_PGTK */ #ifdef HAVE_HAIKU @@ -614,10 +646,8 @@ image_create_bitmap_from_data (struct frame *f, char *bits, #endif #ifdef HAVE_PGTK - dpyinfo->bitmaps[id - 1].img = pixbuf; dpyinfo->bitmaps[id - 1].depth = 1; - dpyinfo->bitmaps[id - 1].pattern = - image_create_pattern_from_pixbuf (f, pixbuf); + dpyinfo->bitmaps[id - 1].pattern = pattern; #endif #ifdef HAVE_HAIKU @@ -665,7 +695,8 @@ typedef struct android_fd_or_asset image_fd; typedef int image_fd; #endif /* defined HAVE_ANDROID && !defined ANDROID_STUBIFY */ -#if defined HAVE_HAIKU || defined HAVE_NS || defined HAVE_ANDROID +#if defined HAVE_HAIKU || defined HAVE_NS || defined HAVE_PGTK \ + || defined HAVE_ANDROID static char *slurp_file (image_fd, ptrdiff_t *); static Lisp_Object image_find_image_fd (Lisp_Object, image_fd *); static bool xbm_read_bitmap_data (struct frame *, char *, char *, @@ -729,25 +760,38 @@ image_create_bitmap_from_file (struct frame *f, Lisp_Object file) #endif #ifdef HAVE_PGTK - GError *err = NULL; - ptrdiff_t id; - void * bitmap = gdk_pixbuf_new_from_file (SSDATA (file), &err); + ptrdiff_t id, size; + int fd, width, height, rc; + char *contents, *data; + void *bitmap; - if (!bitmap) + if (!STRINGP (image_find_image_fd (file, &fd))) + return -1; + + contents = slurp_file (fd, &size); + + if (!contents) + return -1; + + rc = xbm_read_bitmap_data (f, contents, contents + size, + &width, &height, &data, 0); + + if (!rc) { - g_error_free (err); + xfree (contents); return -1; } id = image_allocate_bitmap_record (f); - dpyinfo->bitmaps[id - 1].img = bitmap; dpyinfo->bitmaps[id - 1].refcount = 1; dpyinfo->bitmaps[id - 1].file = xlispstrdup (file); - dpyinfo->bitmaps[id - 1].height = gdk_pixbuf_get_width (bitmap); - dpyinfo->bitmaps[id - 1].width = gdk_pixbuf_get_height (bitmap); + dpyinfo->bitmaps[id - 1].height = width; + dpyinfo->bitmaps[id - 1].width = height; dpyinfo->bitmaps[id - 1].pattern - = image_create_pattern_from_pixbuf (f, bitmap); + = image_bitmap_to_cr_pattern (data, width, height); + xfree (contents); + xfree (data); return id; #endif diff --git a/src/pgtkterm.c b/src/pgtkterm.c index dc2d6477bb5..9c1fc7bef4e 100644 --- a/src/pgtkterm.c +++ b/src/pgtkterm.c @@ -3147,11 +3147,15 @@ pgtk_scroll_run (struct window *w, struct run *run) /* Icons. */ -/* Make the x-window of frame F use the gnu icon bitmap. */ - static bool pgtk_bitmap_icon (struct frame *f, Lisp_Object file) { + /* This code has never worked anyway for the reason that Wayland + uses icons set within desktop files, and has been disabled + because leaving it intact would require image.c to retain a + reference to a GdkPixbuf (which are no longer used) within new + bitmaps. */ +#if 0 ptrdiff_t bitmap_id; if (FRAME_GTK_WIDGET (f) == 0) @@ -3207,12 +3211,8 @@ pgtk_bitmap_icon (struct frame *f, Lisp_Object file) bitmap_id = FRAME_DISPLAY_INFO (f)->icon_bitmap_id; } - if (FRAME_DISPLAY_INFO (f)->bitmaps[bitmap_id - 1].img != NULL) - gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), - FRAME_DISPLAY_INFO (f)->bitmaps[bitmap_id - 1].img); - f->output_data.pgtk->icon_bitmap = bitmap_id; - +#endif /* 0 */ return false; } @@ -6685,12 +6685,12 @@ pgtk_display_x_warning (GdkDisplay *display) gtk_window_set_title (window, "Warning"); gtk_window_set_screen (window, screen); - label = gtk_label_new ("You are trying to run Emacs configured with" - " the \"pure-GTK\" interface under the X Window" - " System. That configuration is unsupported and" - " will lead to sporadic crashes during transfer of" - " large selection data. It will also lead to" - " various problems with keyboard input."); + label = gtk_label_new ("You are trying to run Emacs configured with\n" + " the \"pure-GTK\" interface under the X Window\n" + " System. That configuration is unsupported and\n" + " will lead to sporadic crashes during transfer of\n" + " large selection data. It will also lead to\n" + " various problems with keyboard input.\n"); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); gtk_container_add (GTK_CONTAINER (content_area), label); gtk_widget_show (label); diff --git a/src/pgtkterm.h b/src/pgtkterm.h index 8f2f00efdad..069e425fd9c 100644 --- a/src/pgtkterm.h +++ b/src/pgtkterm.h @@ -42,7 +42,6 @@ along with GNU Emacs. If not, see . */ struct pgtk_bitmap_record { - void *img; char *file; int refcount; int height, width, depth; diff --git a/test/lisp/align-resources/align-post.c b/test/lisp/align-resources/align-post.c deleted file mode 100644 index 157e1d6242a..00000000000 --- a/test/lisp/align-resources/align-post.c +++ /dev/null @@ -1,3 +0,0 @@ -int -main (int argc, - char *argv[]); diff --git a/test/lisp/align-resources/align-post.java b/test/lisp/align-resources/align-post.java deleted file mode 100644 index e0ea8e727f1..00000000000 --- a/test/lisp/align-resources/align-post.java +++ /dev/null @@ -1,9 +0,0 @@ -class X -{ - String field1; - String[] field2; - int field3; - int[] field4; - X field5; - X[] field6; -} diff --git a/test/lisp/align-resources/align-pre.c b/test/lisp/align-resources/align-pre.c deleted file mode 100644 index b1774181a40..00000000000 --- a/test/lisp/align-resources/align-pre.c +++ /dev/null @@ -1,3 +0,0 @@ -int -main (int argc, - char *argv[]); diff --git a/test/lisp/align-resources/align-pre.java b/test/lisp/align-resources/align-pre.java deleted file mode 100644 index fe7a87a9393..00000000000 --- a/test/lisp/align-resources/align-pre.java +++ /dev/null @@ -1,9 +0,0 @@ -class X -{ - String field1; - String[] field2; - int field3; - int[] field4; - X field5; - X[] field6; -} diff --git a/test/lisp/align-resources/c-mode.erts b/test/lisp/align-resources/c-mode.erts new file mode 100644 index 00000000000..0a0fa046b34 --- /dev/null +++ b/test/lisp/align-resources/c-mode.erts @@ -0,0 +1,11 @@ +Name: align function declaration + +=-= +int +main (int argc, + char *argv[]); +=-= +int +main (int argc, + char *argv[]); +=-=-= diff --git a/test/lisp/align-resources/conf-toml-mode.erts b/test/lisp/align-resources/conf-toml-mode.erts new file mode 100644 index 00000000000..d1fcbd58708 --- /dev/null +++ b/test/lisp/align-resources/conf-toml-mode.erts @@ -0,0 +1,45 @@ +Name: align key-value pairs + +=-= +[foo] +foo1=10 +foo22=20 + +[bar] +bar333="example.org" +bar4444 = "zzz" +=-= +[foo] +foo1 = 10 +foo22 = 20 + +[bar] +bar333 = "example.org" +bar4444 = "zzz" +=-=-= + +Name: align list values + +=-= +[foo] +a = 1 +some_list = [ + true, + false, +] +some_other_list = [ + 1, + 2, +] +=-= +[foo] +a = 1 +some_list = [ + true, + false, +] +some_other_list = [ + 1, + 2, +] +=-=-= diff --git a/test/lisp/align-resources/css-mode.erts b/test/lisp/align-resources/css-mode.erts new file mode 100644 index 00000000000..e4455601083 --- /dev/null +++ b/test/lisp/align-resources/css-mode.erts @@ -0,0 +1,23 @@ +Name: align attributes + +=-= +div { + border: 1px solid black; + padding: 25px 50px 75px 100px; + background-color: lightblue; +} +p.center { + text-align: center; + color: red; +} +=-= +div { + border: 1px solid black; + padding: 25px 50px 75px 100px; + background-color: lightblue; +} +p.center { + text-align: center; + color: red; +} +=-=-= diff --git a/test/lisp/align-resources/java-mode.erts b/test/lisp/align-resources/java-mode.erts new file mode 100644 index 00000000000..693a4123121 --- /dev/null +++ b/test/lisp/align-resources/java-mode.erts @@ -0,0 +1,23 @@ +Name: align class fields + +=-= +class X +{ + String field1; + String[] field2; + int field3; + int[] field4; + X field5; + X[] field6; +} +=-= +class X +{ + String field1; + String[] field2; + int field3; + int[] field4; + X field5; + X[] field6; +} +=-=-= diff --git a/test/lisp/align-tests.el b/test/lisp/align-tests.el index 62ef9cf27fa..52e136abfc8 100644 --- a/test/lisp/align-tests.el +++ b/test/lisp/align-tests.el @@ -25,22 +25,28 @@ (require 'ert-x) (require 'align) -(defun test-align-compare (file function) - (should (equal - (with-temp-buffer - (insert-file-contents (ert-resource-file (format file "pre"))) - (funcall function) - (align (point-min) (point-max)) - (buffer-substring-no-properties (point-min) (point-max))) - (with-temp-buffer - (insert-file-contents (ert-resource-file (format file "post"))) - (buffer-string))))) - -(ert-deftest align-java () - (test-align-compare "align-%s.java" #'java-mode)) +(defun test-align-transform-fun (function) + (lambda () + (funcall function) + (align (point-min) (point-max)))) (ert-deftest align-c () - (test-align-compare "align-%s.c" #'c-mode)) + (ert-test-erts-file (ert-resource-file "c-mode.erts") + (test-align-transform-fun #'c-mode))) + +(ert-deftest align-css () + (let ((indent-tabs-mode nil)) + (ert-test-erts-file (ert-resource-file "css-mode.erts") + (test-align-transform-fun #'css-mode)))) + +(ert-deftest align-java () + (ert-test-erts-file (ert-resource-file "java-mode.erts") + (test-align-transform-fun #'java-mode))) + +(ert-deftest align-toml () + (let ((indent-tabs-mode nil)) + (ert-test-erts-file (ert-resource-file "conf-toml-mode.erts") + (test-align-transform-fun #'conf-toml-mode)))) (provide 'align-tests) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index ee9c09df9d8..d97785ee481 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -7848,7 +7848,7 @@ process sentinels. They shall not disturb each other." (ert-deftest tramp-test47-read-password () "Check Tramp password handling." - :tags '(:expensive-test) + :tags '(:expensive-test :unstable) (skip-unless (tramp--test-enabled)) (skip-unless (tramp--test-mock-p)) ;; Not all read commands understand argument "-s" or "-p". diff --git a/test/lisp/textmodes/conf-mode-tests.el b/test/lisp/textmodes/conf-mode-tests.el index 5e21d2cfacb..677a6d35d66 100644 --- a/test/lisp/textmodes/conf-mode-tests.el +++ b/test/lisp/textmodes/conf-mode-tests.el @@ -93,12 +93,13 @@ x.2.y.1.z.2.zz =") (should (equal (face-at-point) 'font-lock-variable-name-face)) (search-forward "val") (should-not (face-at-point))) - (while (re-search-forward "a-z" nil t) + (while (re-search-forward "[xyz]" nil t) (backward-char) (should (equal (face-at-point) 'font-lock-variable-name-face)) - (re-search-forward "[0-0]" nil t) - (backward-char) - (should (equal (face-at-point) 'font-lock-constant-face))))) + (forward-char) + (when (re-search-forward "[0-9]" nil t) + (backward-char) + (should (equal (face-at-point) 'font-lock-constant-face)))))) (ert-deftest conf-test-space-mode () ;; From `conf-space-mode' docstring. @@ -157,7 +158,6 @@ image/tiff tiff tif (should-not (face-at-point)))) (ert-deftest conf-test-toml-mode () - ;; From `conf-toml-mode' docstring. (with-temp-buffer (insert "[entry] value = \"some string\"") @@ -173,6 +173,22 @@ value = \"some string\"") (search-forward "som") (should (equal (face-at-point) 'font-lock-string-face)))) +(ert-deftest conf-test-toml-mode/boolean () + ;; https://toml.io/en/v1.0.0#boolean + (with-temp-buffer + (insert "[entry] +a = true +b = True") + (goto-char (point-min)) + (conf-toml-mode) + (font-lock-mode) + (font-lock-ensure) + (search-forward "tru") + (should (equal (face-at-point) 'font-lock-keyword-face)) + ;; Do not fontify upper-case "True". + (search-forward "Tru") + (should (equal (face-at-point) nil)))) + (ert-deftest conf-test-desktop-mode () ;; From `conf-desktop-mode' dostring. (with-temp-buffer