commit 94bcd7964bbb20bc8ff8a91a9656452a97139d60 (HEAD, refs/remotes/origin/master) Author: Po Lu Date: Thu Jun 13 10:46:59 2024 +0800 Correctly define `select' binding on Android * lisp/term/android-win.el (input-decode-map): Cease binding select in the initial frame's input-decode-map. * src/androidterm.c (android_term_init): Binding select in the freshly created kboard. (syms_of_androidterm) : New symbols. diff --git a/lisp/term/android-win.el b/lisp/term/android-win.el index 0d2d0299282..3e0f71abf91 100644 --- a/lisp/term/android-win.el +++ b/lisp/term/android-win.el @@ -627,9 +627,6 @@ accessible to other programs." (global-set-key [\83] #'ignore) ; KEYCODE_NOTIFICATION on pre-Honeycomb ; releases. -;; `select' key, which I suppose amounts to return. -(define-key input-decode-map [select] [return]) - (provide 'android-win) ;; android-win.el ends here. diff --git a/src/androidterm.c b/src/androidterm.c index 94a115a66a6..f98da97eeba 100644 --- a/src/androidterm.c +++ b/src/androidterm.c @@ -33,6 +33,7 @@ along with GNU Emacs. If not, see . */ #include "textconv.h" #include "coding.h" #include "pdumper.h" +#include "keymap.h" /* This is a chain of structures for all the X displays currently in use. */ @@ -6641,7 +6642,7 @@ android_term_init (void) dpyinfo->resx = android_pixel_density_x; dpyinfo->resy = android_pixel_density_y; dpyinfo->font_resolution = android_scaled_pixel_density; -#endif /* ANDROID_STUBIFY */ +#endif /* !ANDROID_STUBIFY */ /* https://lists.gnu.org/r/emacs-devel/2015-11/msg00194.html */ dpyinfo->smallest_font_height = 1; @@ -6679,7 +6680,13 @@ android_term_init (void) #ifndef ANDROID_STUBIFY sem_init (&edit_sem, false, 0); register_textconv_interface (&text_conversion_interface); -#endif +#endif /* !ANDROID_STUBIFY */ + + /* Binding certain key events in the terminal's `input-decode-map', + which being keyboard-local is not accessible from any point in + android-win.el. */ + Fdefine_key (KVAR (terminal->kboard, Vinput_decode_map), + make_vector (1, Qselect), Qreturn, Qnil); } @@ -6907,6 +6914,10 @@ for instance, `early-init.el', or they will be of no effect. */); Fput (Qmeta, Qmodifier_value, make_fixnum (meta_modifier)); DEFSYM (Qsuper, "super"); Fput (Qsuper, Qmodifier_value, make_fixnum (super_modifier)); + + /* Key symbols. */ + DEFSYM (Qselect, "select"); + DEFSYM (Qreturn, "return"); } void commit 6b7ff60a5e71c161a064e27509fe4fb95cf74ddd Author: Dmitry Gutov Date: Thu Jun 13 00:46:00 2024 +0300 Highlight the suffix in *Completions* buffer in 'basic' style too * lisp/minibuffer.el (completion-basic-all-completions): Make sure to highlight the suffix as well (bug#71419). diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index f62cb2566b2..144cda8cfdc 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3816,7 +3816,7 @@ Return the new suffix." 'point (substring afterpoint 0 (cdr bounds))))) (all (completion-pcm--all-completions prefix pattern table pred))) - (completion-hilit-commonality all point (car bounds)))) + (completion-pcm--hilit-commonality pattern all))) ;;; Partial-completion-mode style completion. commit d1e98a8f0128747030e97ffea20a8f67aa0cd923 Author: F. Jason Park Date: Wed Nov 8 16:45:37 2023 -0800 Release ERC 5.6 * lisp/erc/erc.el: Change Version header from 5.6-git to 5.6. A `customize-package-emacs-version-alist' mapping for ERC 5.6 to Emacs 30.1 was already added when moving from 5.5 to 5.6-git. The ERCVER variable in doc/misc/erc.texi was likewise updated at that time. Going forward, such changes will continue to happen preemptively, on the flip side of each release. (erc-version): Change version from 5.6-git to 5.6. diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index b728dd59fa3..daad48223fa 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -12,7 +12,7 @@ ;; David Edmondson (dme@dme.org) ;; Michael Olson (mwolson@gnu.org) ;; Kelvin White (kwhite@gnu.org) -;; Version: 5.6-git +;; Version: 5.6 ;; Package-Requires: ((emacs "27.1") (compat "29.1.4.5")) ;; Keywords: IRC, chat, client, Internet ;; URL: https://www.gnu.org/software/emacs/erc.html @@ -70,7 +70,7 @@ (require 'auth-source) (eval-when-compile (require 'subr-x)) -(defconst erc-version "5.6-git" +(defconst erc-version "5.6" "This version of ERC.") (defvar erc-official-location commit bbac7b9fa398254e64e5ee3e8aca2f59adcfda50 Author: F. Jason Park Date: Mon Jun 10 21:56:02 2024 -0700 ; Amend some doc strings in ERC * lisp/erc/erc-backend.el (define-erc-response-handler): Mention important distinction between aliases for handlers and hooks, and note expected type for the latter. * lisp/erc/erc.el (erc--define-channel-user-status-compat-getter): Mention that these accessors are not inlined like those generated by `cl-defstruct'. diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el index e2b7c0b6f48..a4a78c66b02 100644 --- a/lisp/erc/erc-backend.el +++ b/lisp/erc/erc-backend.el @@ -1649,6 +1649,10 @@ Would expand to: See also `erc-server-311'.\")) + Note that while all ALIASES share the same handler function, each gets + its own distinct hook variable. The default value of these variables + may be a list or a function. Robust code should handle both. + \(fn (NAME &rest ALIASES) &optional EXTRA-FN-DOC EXTRA-VAR-DOC &rest FN-BODY)" (declare (debug (&define [&name "erc-response-handler@" ;; No `def-edebug-elem-spec' in 27. diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 025bfbc0a5f..b728dd59fa3 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -676,10 +676,11 @@ Also remove members from the server table if this was their only buffer." (erc-remove-channel-users))) (defmacro erc--define-channel-user-status-compat-getter (name c d) - "Define a gv getter for historical `erc-channel-user' status slot NAME. -Expect NAME to be a string, C to be its traditionally associated -letter, and D to be its fallback power-of-2 integer for non-ERC -buffers." + "Define accessor with gv getter for historical `erc-channel-user' slot NAME. +Expect NAME to be a string, C to be its traditionally associated letter, +and D to be its fallback power-of-2 integer for non-ERC buffers. Unlike +pre-ERC-5.6 accessors, do not bother generating a compiler macro for +inlining calls to these adapters." `(defun ,(intern (concat "erc-channel-user-" name)) (u) ,(format "Get equivalent of pre-5.6 `%s' slot for `erc-channel-user'." name) commit e00af96c0691b749932756e47f48a53f5e92a00f Author: Eli Zaretskii Date: Wed Jun 12 21:25:41 2024 +0300 ; Mention new modes in the Emacs user manual * etc/NEWS: Mark new modes as documented. * doc/emacs/programs.texi (Program Modes): Add PHP. (Bug#71380) Add other new modes. diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index b944d24d91f..3b863eefd72 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -94,14 +94,15 @@ mode for the C programming language is @code{c-mode}. @cindex TOML mode Emacs has programming language modes for Lisp, Scheme, the Scheme-based DSSSL expression language, Ada, ASM, AWK, C, C++, C#, -Fortran, Icon, IDL (CORBA), IDLWAVE, Java, Javascript, M4, Makefiles, -Metafont (@TeX{}'s companion for font creation), Modula2, Object -Pascal, Objective-C, Octave, Pascal, Perl, Pike, PostScript, Prolog, -Python, Ruby, Simula, SQL, Tcl, TypeScript, Verilog, and VHDL@. An -alternative mode for Perl is called CPerl mode. Modes are also -available for the scripting languages of the common GNU and Unix -shells, and MS-DOS/MS-Windows @samp{BAT} files, JSON, DNS master -files, CSS (Cascading Style Sheets), Dockerfiles, CMake files, and various sorts of configuration files. +Elixir, Fortran, Icon, IDL (CORBA), HEEx, IDLWAVE, Java, Javascript, +Lua, M4, Makefiles, Metafont (@TeX{}'s companion for font creation), +Modula2, Object Pascal, Objective-C, Octave, Pascal, Perl, PHP, Pike, +PostScript, Prolog, Python, Ruby, Simula, SQL, Tcl, TypeScript, Verilog, +and VHDL@. The recommended mode for Perl is called CPerl mode. Modes +are also available for the scripting languages of the common GNU and +Unix shells, and MS-DOS/MS-Windows @samp{BAT} files, JSON, DNS master +files, CSS (Cascading Style Sheets), Dockerfiles, CMake files, and +various sorts of configuration files. Ideally, Emacs should have a major mode for each programming language that you might want to edit. If it doesn't have a mode for diff --git a/etc/NEWS b/etc/NEWS index 53bc8dc9534..b2fdbc4a88f 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1983,19 +1983,19 @@ the functionality of 'after-change-functions': An optional major mode based on the tree-sitter library for editing HTML files. ---- ++++ *** New major mode 'heex-ts-mode'. A major mode based on the tree-sitter library for editing HEEx files. ---- ++++ *** New major mode 'elixir-ts-mode'. A major mode based on the tree-sitter library for editing Elixir files. ---- ++++ *** New major mode 'lua-ts-mode'. A major mode based on the tree-sitter library for editing Lua files. ---- ++++ *** New major mode 'php-ts-mode'. A major mode based on the tree-sitter library for editing PHP files. commit e37754fc59bac409881d456a83aa0bf2468c94fb Author: Vincenzo Pupillo Date: Fri Jun 7 12:39:03 2024 +0200 Add php-ts-mode * etc/NEWS: Mention the new mode. * lisp/progmodes/php-ts-mode.el: New file. (Bug#71380) diff --git a/etc/NEWS b/etc/NEWS index 26339209678..53bc8dc9534 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1995,6 +1995,11 @@ A major mode based on the tree-sitter library for editing Elixir files. *** New major mode 'lua-ts-mode'. A major mode based on the tree-sitter library for editing Lua files. +--- +*** New major mode 'php-ts-mode'. +A major mode based on the tree-sitter library for editing PHP files. + + ** Minibuffer and Completions +++ diff --git a/lisp/progmodes/php-ts-mode.el b/lisp/progmodes/php-ts-mode.el new file mode 100644 index 00000000000..3473057edd4 --- /dev/null +++ b/lisp/progmodes/php-ts-mode.el @@ -0,0 +1,1647 @@ +;;; php-ts-mode.el --- Major mode for editing PHP files using tree-sitter -*- lexical-binding: t; -*- + +;; Copyright (C) 2024 Free Software Foundation, Inc. + +;; Author: Vincenzo Pupillo +;; Maintainer: Vincenzo Pupillo +;; Created: Jun 2024 +;; Keywords: PHP language tree-sitter + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: +;; +;; This package provides `php-ts-mode' which is a major mode +;; for editing PHP files with embedded HTML, JavaScript, CSS and phpdoc. +;; Tree Sitter is used to parse each of these languages. +;; +;; Please note that this package requires `html-ts-mode', which +;; registers itself as the major mode for editing HTML. +;; +;; This package is compatible and has been tested with the following +;; tree-sitter grammars: +;; * https://github.com/tree-sitter/tree-sitter-php +;; * https://github.com/tree-sitter/tree-sitter-html +;; * https://github.com/tree-sitter/tree-sitter-javascript +;; * https://github.com/tree-sitter/tree-sitter-css +;; * https://github.com/claytonrcarter/tree-sitter-phpdoc +;; +;; Features +;; +;; * Indent +;; * IMenu +;; * Navigation +;; * Which-function +;; * Flymake +;; * Tree-sitter parser installation helper +;; * PHP built-in server support +;; * Shell interaction: execute PHP code in a inferior PHP process + +;;; Code: + +(require 'treesit) +(require 'c-ts-common) ;; For comment indent and filling. +(require 'css-mode) ;; for embed css into html +(require 'js) ;; for embed javascript into html +(require 'comint) + +(eval-when-compile + (require 'cl-lib) + (require 'rx) + (require 'subr-x)) + +(declare-function treesit-node-child "treesit.c") +(declare-function treesit-node-child-by-field-name "treesit.c") +(declare-function treesit-node-end "treesit.c") +(declare-function treesit-node-parent "treesit.c") +(declare-function treesit-node-start "treesit.c") +(declare-function treesit-node-string "treesit.c") +(declare-function treesit-node-type "treesit.c") +(declare-function treesit-parser-add-notifier "treesit.c") +(declare-function treesit-parser-buffer "treesit.c") +(declare-function treesit-parser-create "treesit.c") +(declare-function treesit-parser-included-ranges "treesit.c") +(declare-function treesit-parser-list "treesit.c") +(declare-function treesit-parser-language "treesit.c") + +;;; Install treesitter language parsers +(defvar php-ts-mode--language-source-alist + '((php . ("https://github.com/tree-sitter/tree-sitter-php" "v0.22.5")) + (phpdoc . ("https://github.com/claytonrcarter/tree-sitter-phpdoc")) + (html . ("https://github.com/tree-sitter/tree-sitter-html" "v0.20.3")) + (javascript . ("https://github.com/tree-sitter/tree-sitter-javascript" "v0.21.2")) + (css . ("https://github.com/tree-sitter/tree-sitter-css" "v0.21.0"))) + "Treesitter language parsers required by `php-ts-mode'. +You can customize this variable if you want to stick to a specific +commit and/or use different parsers.") + +(defun php-ts-mode-install-parsers () + "Install all the required treesitter parsers. +`php-ts-mode--language-source-alist' defines which parsers to install." + (interactive) + (let ((treesit-language-source-alist php-ts-mode--language-source-alist)) + (dolist (item php-ts-mode--language-source-alist) + (treesit-install-language-grammar (car item))))) + +;;; Custom variables + +(defgroup php-ts-mode nil + "Major mode for editing PHP files." + :prefix "php-ts-mode-" + :group 'languages) + +(defcustom php-ts-mode-indent-offset 4 + "Number of spaces for each indentation step in `php-ts-mode'." + :tag "PHP indent offset" + :version "30.1" + :type 'integer + :safe 'integerp) + +(defcustom php-ts-mode-js-css-indent-offset 2 + "JavaScript and CSS indent spaces related to the