commit d8c1d3e49baa282d9f7b8070426e47ec67171b93 (HEAD, refs/remotes/origin/master) Merge: e708da62270 d59630e591c Author: Eli Zaretskii Date: Thu Jul 27 10:01:25 2023 +0300 Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs commit e708da62270d311d6bceac0dcbdf4740112156ed Author: Eli Zaretskii Date: Thu Jul 27 09:51:39 2023 +0300 ; Better documentation of HOME on MS-Windows * doc/emacs/custom.texi (Find Init): Add footnote about HOME on MS-Windows. (Bug#64871) diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index d2d51e344dd..456e2087217 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -2823,7 +2823,12 @@ Find Init @subsection How Emacs Finds Your Init File Emacs normally finds your init file in a location under your home -directory. @xref{Init File}. +directory@footnote{ +On MS-Windows, there's no single directory considered by all programs +as ``the home directory'' of the user. Emacs uses one of the +pertinent directories as the equivalent of your home directory; see +@ref{Windows HOME}, for the details. +}. @xref{Init File}. Emacs looks for your init file using the filenames @file{~/.emacs.el}, @file{~/.emacs}, or @file{~/.emacs.d/init.el} in that order; you can commit d59630e591cd49780e6554d1025c1879bb89680b Author: Eli Zaretskii Date: Thu Jul 27 09:51:39 2023 +0300 ; Better documentation of HOME on MS-Windows * doc/emacs/custom.texi (Find Init): Add footnote about HOME on MS-Windows. (Bug#64871) diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index d2d51e344dd..456e2087217 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -2823,7 +2823,12 @@ Find Init @subsection How Emacs Finds Your Init File Emacs normally finds your init file in a location under your home -directory. @xref{Init File}. +directory@footnote{ +On MS-Windows, there's no single directory considered by all programs +as ``the home directory'' of the user. Emacs uses one of the +pertinent directories as the equivalent of your home directory; see +@ref{Windows HOME}, for the details. +}. @xref{Init File}. Emacs looks for your init file using the filenames @file{~/.emacs.el}, @file{~/.emacs}, or @file{~/.emacs.d/init.el} in that order; you can commit e650a14f64b9ebea69615c19ca4466c14af35857 Author: Eli Zaretskii Date: Thu Jul 27 09:37:03 2023 +0300 ; Clarify documentation of 'server-after-make-frame-hook' * doc/lispref/frames.texi (Creating Frames): * lisp/server.el (server-after-make-frame-hook): Clarify documentation of 'server-after-make-frame-hook'. (Bug#64873) diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index 5a2d9f29295..368def90d85 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi @@ -187,9 +187,13 @@ Creating Frames @end defvar @defopt server-after-make-frame-hook -A normal hook run when the Emacs server creates a client frame. When -this hook is called, the created frame is the selected one. -@xref{Emacs Server,,, emacs, The GNU Emacs Manual}. +A normal hook run when the Emacs server starts using a client frame. +When this hook is called, the client frame is the selected one. Note +that, depending on how @command{emacsclient} was invoked +(@pxref{Invoking emacsclient,,, emacs, The GNU Emacs Manual}), this +client frame could be a new frame created for the client, or it could +be an existing frame that the server reused for handling the client +commands. @xref{Emacs Server,,, emacs, The GNU Emacs Manual}. @end defopt diff --git a/lisp/server.el b/lisp/server.el index c3325e5a24c..ba7e02d2555 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -182,8 +182,10 @@ server-switch-hook :type 'hook) (defcustom server-after-make-frame-hook nil - "Hook run when the Emacs server creates a client frame. -The created frame is selected when the hook is called." + "Hook run when the Emacs server starts using a client frame. +The client frame is selected when the hook is called. +The client frame could be a newly-created frame, or an +existing frame reused for this purpose." :type 'hook :version "27.1") commit 27944247d161f0ed65bbb34959c4493f7984987a Author: Mattias Engdegård Date: Wed Jul 26 18:39:36 2023 +0200 Fix broken byte-compilation of unary comparisons * lisp/emacs-lisp/byte-opt.el (byte-opt--nary-comparison): Fix a typo causing miscompilation of code such as (OP X), where OP is <, >, <=, >= or =. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--test-cases): Add test case. Reported by Richard Copley. diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 0be6ae65aab..3005d69ae88 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -973,7 +973,7 @@ byte-opt--nary-comparison (let ((nargs (length (cdr form)))) (cond ((= nargs 1) - `(progn (cadr form) t)) + `(progn ,(cadr form) t)) ((>= nargs 3) ;; At least 3 arguments: transform to N-1 binary comparisons, ;; since those have their own byte-ops which are particularly diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index b549ae1fe09..593fd117685 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -780,6 +780,11 @@ bytecomp-tests--test-cases ;; (+ 0 -0.0) etc (let ((x (bytecomp-test-identity -0.0))) (list x (+ x) (+ 0 x) (+ x 0) (+ 1 2 -3 x) (+ 0 x 0))) + + ;; Unary comparisons: keep side-effect, return t + (let ((x 0)) + (list (= (setq x 1)) + x)) ) "List of expressions for cross-testing interpreted and compiled code.") commit b4063c399be2472dfb184ac003cf85c882253e25 Author: Mattias Engdegård Date: Tue Jul 25 12:52:29 2023 +0200 * lisp/emacs-lisp/byte-opt.el (pure-fns): Add `max-char` diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el index 26a1dc4a103..0be6ae65aab 100644 --- a/lisp/emacs-lisp/byte-opt.el +++ b/lisp/emacs-lisp/byte-opt.el @@ -1924,7 +1924,7 @@ byte-optimize-set (let ((pure-fns '( ;; character.c - characterp + characterp max-char ;; data.c % * + - / /= 1+ 1- < <= = > >= aref arrayp ash atom bare-symbol bool-vector-count-consecutive bool-vector-count-population commit 82f5f3b8a26249db0679bb7dc38c44352e8fbdf5 Author: Mattias Engdegård Date: Tue Jul 25 12:16:30 2023 +0200 Provide backtrace for byte-ops aref and aset Produce synthetic backtrace entries for `aref` and `aset` byte-ops when the index is non-fixnum, or is out of range for vector or record arguments (bug#64613). * src/bytecode.c (exec_byte_code): Detect type and range errors in-line for aref and aset. * src/data.c (syms_of_data): Declare symbols Qaref and Qaset. * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--byte-op-error-cases): Add test cases. diff --git a/src/bytecode.c b/src/bytecode.c index 2eb53b0428a..c53ef678edd 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -1115,14 +1115,24 @@ #define DEFINE(name, value) [name] = &&insn_ ## name, { Lisp_Object idxval = POP; Lisp_Object arrayval = TOP; + if (!FIXNUMP (idxval)) + { + record_in_backtrace (Qaref, &TOP, 2); + wrong_type_argument (Qfixnump, idxval); + } ptrdiff_t size; - ptrdiff_t idx; if (((VECTORP (arrayval) && (size = ASIZE (arrayval), true)) - || (RECORDP (arrayval) && (size = PVSIZE (arrayval), true))) - && FIXNUMP (idxval) - && (idx = XFIXNUM (idxval), - idx >= 0 && idx < size)) - TOP = AREF (arrayval, idx); + || (RECORDP (arrayval) && (size = PVSIZE (arrayval), true)))) + { + ptrdiff_t idx = XFIXNUM (idxval); + if (idx >= 0 && idx < size) + TOP = AREF (arrayval, idx); + else + { + record_in_backtrace (Qaref, &TOP, 2); + args_out_of_range (arrayval, idxval); + } + } else TOP = Faref (arrayval, idxval); NEXT; @@ -1133,16 +1143,26 @@ #define DEFINE(name, value) [name] = &&insn_ ## name, Lisp_Object newelt = POP; Lisp_Object idxval = POP; Lisp_Object arrayval = TOP; + if (!FIXNUMP (idxval)) + { + record_in_backtrace (Qaset, &TOP, 3); + wrong_type_argument (Qfixnump, idxval); + } ptrdiff_t size; - ptrdiff_t idx; if (((VECTORP (arrayval) && (size = ASIZE (arrayval), true)) - || (RECORDP (arrayval) && (size = PVSIZE (arrayval), true))) - && FIXNUMP (idxval) - && (idx = XFIXNUM (idxval), - idx >= 0 && idx < size)) + || (RECORDP (arrayval) && (size = PVSIZE (arrayval), true)))) { - ASET (arrayval, idx, newelt); - TOP = newelt; + ptrdiff_t idx = XFIXNUM (idxval); + if (idx >= 0 && idx < size) + { + ASET (arrayval, idx, newelt); + TOP = newelt; + } + else + { + record_in_backtrace (Qaset, &TOP, 3); + args_out_of_range (arrayval, idxval); + } } else TOP = Faset (arrayval, idxval, newelt); diff --git a/src/data.c b/src/data.c index 108ed97d1f6..619ab8fde64 100644 --- a/src/data.c +++ b/src/data.c @@ -4116,6 +4116,8 @@ syms_of_data (void) DEFSYM (Qelt, "elt"); DEFSYM (Qsetcar, "setcar"); DEFSYM (Qsetcdr, "setcdr"); + DEFSYM (Qaref, "aref"); + DEFSYM (Qaset, "aset"); error_tail = pure_cons (Qerror, Qnil); diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 16c6408c921..b549ae1fe09 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -1953,6 +1953,15 @@ bytecomp-tests--byte-op-error-cases ((setcdr c 5) (wrong-type-argument consp c)) ((nth 2 "abcd") (wrong-type-argument listp "abcd")) ((elt (x y . z) 2) (wrong-type-argument listp z)) + ((aref [2 3 5] p) (wrong-type-argument fixnump p)) + ((aref #s(a b c) p) (wrong-type-argument fixnump p)) + ((aref "abc" p) (wrong-type-argument fixnump p)) + ((aref [2 3 5] 3) (args-out-of-range [2 3 5] 3)) + ((aref #s(a b c) 3) (args-out-of-range #s(a b c) 3)) + ((aset [2 3 5] q 1) (wrong-type-argument fixnump q)) + ((aset #s(a b c) q 1) (wrong-type-argument fixnump q)) + ((aset [2 3 5] -1 1) (args-out-of-range [2 3 5] -1)) + ((aset #s(a b c) -1 1) (args-out-of-range #s(a b c) -1)) ;; Many more to add )) commit c50f6538cfc43d856b361347c945f6348c6f2dc9 Author: Mattias Engdegård Date: Tue Jul 25 12:15:00 2023 +0200 ; bytecode backtrace test clean-up diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 9813e9459c8..16c6408c921 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -1967,17 +1967,17 @@ bytecomp--byte-op-error-backtrace ;; Test both calling the function directly, and calling ;; a byte-compiled η-expansion (lambda (ARGS...) (FUN ARGS...)) ;; which should turn the function call into a byte-op. - (dolist (byte-op '(nil t)) - (ert-info ((prin1-to-string byte-op) :prefix "byte-op: ") - (let* ((fun - (if byte-op - (let* ((nargs (length (cdr call))) - (formals (mapcar (lambda (i) - (intern (format "x%d" i))) - (number-sequence 1 nargs)))) - (byte-compile - `(lambda ,formals (,fun-sym ,@formals)))) - fun-sym)) + (dolist (mode '(funcall byte-op)) + (ert-info ((symbol-name mode) :prefix "mode: ") + (let* ((fun (pcase-exhaustive mode + ('funcall fun-sym) + ('byte-op + (let* ((nargs (length (cdr call))) + (formals (mapcar (lambda (i) + (intern (format "x%d" i))) + (number-sequence 1 nargs)))) + (byte-compile + `(lambda ,formals (,fun-sym ,@formals))))))) (error-frame (bytecomp-tests--error-frame fun actuals))) (should (consp error-frame)) (should (equal (car error-frame) (list 'error expected-error))) commit 6572dcc7f5db90a32c35ef43788a8b29a07a0c2c Author: Eli Zaretskii Date: Wed Jul 26 18:11:49 2023 +0300 ; Documentation followup to last change * lisp/progmodes/project.el (project-uniquify-dirname-transform): * lisp/uniquify.el (uniquify-dirname-transform): Doc fixes. * etc/NEWS: Announce the change. diff --git a/etc/NEWS b/etc/NEWS index e81bc223836..d0dab755212 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -102,6 +102,15 @@ plus, minus, check-mark, start, etc. The 'tool-bar-position' frame parameter can be set to 'bottom' on all window systems other than Nextstep. +--- +** New user option 'uniquify-dirname-transform'. +This can be used to customize how buffer names are uniquified, by +making arbitrary transforms on the buffer's directory name (whose +components are used to uniquify buffer names when they clash). You +can use this to distinguish between buffers visiting files with the +same base name that belong to different projects by using the provided +transform function 'project-uniquify-dirname-transform'. + ** cl-print *** You can expand the "..." truncation everywhere. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index e7deee43f8e..eac6a60f5bf 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1889,12 +1889,12 @@ project-switch-project ;;;###autoload (defun project-uniquify-dirname-transform (dirname) - "Include `project-name' in DIRNAME if in a project. + "Uniquify name of directory DIRNAME using `project-name', if in a project. If you set `uniquify-dirname-transform' to this function, -slash-separated components from `project-name' will be added to -the buffer's name when buffers from two different projects would -otherwise have the same name." +slash-separated components from `project-name' will be appended to +the buffer's directory name when buffers from two different projects +would otherwise have the same name." (if-let (proj (project-current nil dirname)) (let ((root (project-root proj))) (expand-file-name diff --git a/lisp/uniquify.el b/lisp/uniquify.el index af00c95663d..2ad2fb0eeac 100644 --- a/lisp/uniquify.el +++ b/lisp/uniquify.el @@ -169,25 +169,26 @@ uniquify-list-buffers-directory-modes contains the name of the directory which the buffer is visiting.") (defcustom uniquify-dirname-transform #'identity - "Function to transform buffer's directory for uniquifying its name. - -If `uniquify-buffer-name-style' is non-nil and a buffer's name -would be the same as some other buffer, then components from the -buffer's directory name are added to the buffer's name until the -buffer's name is unique. - -This function is used to transform the buffer's directory name -before the uniquifying process, allowing the unique buffer name -to include components from other sources. The default is -`identity', so only the buffer's directory name is used for -uniquifying. This function is called with the buffer's directory -name and should return a file name (which does not need to -actually exist in the filesystem) to use components from. - -To include components from `project-name', set this variable to -`project-uniquify-dirname-transform'." - :type '(choice (function-item :tag "Don't change the dirname" identity) - (function-item :tag "Include project name in dirname" + "Function to transform buffer's directory name when uniquifying buffer's name. + +When `uniquify-buffer-name-style' is non-nil, Emacs makes buffer +names unique by adding components of the buffer's directory name +until the resulting name is unique. This function is used to +transform the buffer's directory name during this uniquifying +process, allowing the unique buffer name to include strings +from sources other than the buffer's directory. The default is +`identity', so the unmodified buffer's directory name is used for +uniquifying. + +This function is called with the buffer's directory name and +should return a string which names a file (that does not need to +actually exist in the filesystem); the components of this file +name will then be used to uniquify the buffer's name. + +To include components from the `project-name' of the buffer, set +this variable to `project-uniquify-dirname-transform'." + :type '(choice (function-item :tag "Use directory name as-is" identity) + (function-item :tag "Include project name in directory name" #'project-uniquify-dirname-transform) function) :version "30.1" commit 2aec67f4deb1a7dfd87f7da8479be4b2784bcc39 Author: Spencer Baugh Date: Sun Jul 9 22:21:03 2023 -0400 Support transforming the dirname used by uniquify By transforming the buffer's directory name, we can add additional information to use during uniquifying. A basic one: uniquifying buffer names based on the project name. * lisp/progmodes/project.el (project-uniquify-dirname-transform): Add. * lisp/uniquify.el (uniquify-dirname-transform-default) (uniquify-dirname-transform): Add. (Bug#62621) (uniquify-rationalize-file-buffer-names, uniquify-buffer-file-name): Use 'uniquify-dirname-transform'. * test/lisp/uniquify-tests.el (uniquify-home) (uniquify-project-transform): Add tests. diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el index 03ed966cc45..e7deee43f8e 100644 --- a/lisp/progmodes/project.el +++ b/lisp/progmodes/project.el @@ -1887,5 +1887,22 @@ project-switch-project (let ((project-current-directory-override dir)) (call-interactively command)))) +;;;###autoload +(defun project-uniquify-dirname-transform (dirname) + "Include `project-name' in DIRNAME if in a project. + +If you set `uniquify-dirname-transform' to this function, +slash-separated components from `project-name' will be added to +the buffer's name when buffers from two different projects would +otherwise have the same name." + (if-let (proj (project-current nil dirname)) + (let ((root (project-root proj))) + (expand-file-name + (file-name-concat + (file-name-directory root) + (project-name proj) + (file-relative-name dirname root)))) + dirname)) + (provide 'project) ;;; project.el ends here diff --git a/lisp/uniquify.el b/lisp/uniquify.el index d1ca455b673..af00c95663d 100644 --- a/lisp/uniquify.el +++ b/lisp/uniquify.el @@ -168,6 +168,31 @@ uniquify-list-buffers-directory-modes That means that when `buffer-file-name' is set to nil, `list-buffers-directory' contains the name of the directory which the buffer is visiting.") +(defcustom uniquify-dirname-transform #'identity + "Function to transform buffer's directory for uniquifying its name. + +If `uniquify-buffer-name-style' is non-nil and a buffer's name +would be the same as some other buffer, then components from the +buffer's directory name are added to the buffer's name until the +buffer's name is unique. + +This function is used to transform the buffer's directory name +before the uniquifying process, allowing the unique buffer name +to include components from other sources. The default is +`identity', so only the buffer's directory name is used for +uniquifying. This function is called with the buffer's directory +name and should return a file name (which does not need to +actually exist in the filesystem) to use components from. + +To include components from `project-name', set this variable to +`project-uniquify-dirname-transform'." + :type '(choice (function-item :tag "Don't change the dirname" identity) + (function-item :tag "Include project name in dirname" + #'project-uniquify-dirname-transform) + function) + :version "30.1" + :group 'uniquify) + ;;; Utilities ;; uniquify-fix-list data structure @@ -209,7 +234,8 @@ uniquify-rationalize-file-buffer-names ;; this buffer. (with-current-buffer newbuf (setq uniquify-managed nil)) (when dirname - (setq dirname (expand-file-name (directory-file-name dirname))) + (setq dirname (funcall uniquify-dirname-transform + (expand-file-name (directory-file-name dirname)))) (let ((fix-list (list (uniquify-make-item base dirname newbuf nil))) items) @@ -268,10 +294,11 @@ uniquify-buffer-file-name (if (memq major-mode uniquify-list-buffers-directory-modes) list-buffers-directory)))) (when filename - (directory-file-name - (file-name-directory - (expand-file-name - (directory-file-name filename)))))))) + (funcall uniquify-dirname-transform + (directory-file-name + (file-name-directory + (expand-file-name + (directory-file-name filename))))))))) (defun uniquify-rerationalize-w/o-cb (fix-list) "Re-rationalize the buffers in FIX-LIST, but ignoring `current-buffer'." diff --git a/test/lisp/uniquify-tests.el b/test/lisp/uniquify-tests.el index abd61fa3504..e533c4b644c 100644 --- a/test/lisp/uniquify-tests.el +++ b/test/lisp/uniquify-tests.el @@ -88,6 +88,21 @@ uniquify-dirs '("a/dir/" "b/dir/"))) (mapc #'kill-buffer bufs))))) +(ert-deftest uniquify-home () + "uniquify works, albeit confusingly, in the presence of directories named \"~\"" + (let (bufs) + (save-excursion + (push (find-file-noselect "~") bufs) + (push (find-file-noselect "./~") bufs) + (should (equal (mapcar #'buffer-name bufs) + '("~" "~<>"))) + (push (find-file-noselect "~/foo") bufs) + (push (find-file-noselect "./~/foo") bufs) + (should (equal (mapcar #'buffer-name bufs) + '("foo<~>" "foo" "~" "~<>"))) + (while bufs + (kill-buffer (pop bufs)))))) + (ert-deftest uniquify-rename-to-dir () "Giving a buffer a name which matches a directory doesn't rename the buffer" (let ((uniquify-buffer-name-style 'forward) @@ -125,5 +140,23 @@ uniquify-space-prefix (should (equal (buffer-name) "| foo")) (kill-buffer))) +(require 'project) +(ert-deftest uniquify-project-transform () + "`project-uniquify-dirname-transform' works" + (let ((uniquify-dirname-transform #'project-uniquify-dirname-transform) + (project-vc-name "foo1/bar") + bufs) + (save-excursion + (should (file-exists-p "../README")) + (push (find-file-noselect "../README") bufs) + (push (find-file-noselect "other/README") bufs) + (should (equal (mapcar #'buffer-name bufs) + '("README" "README"))) + (push (find-file-noselect "foo2/bar/README") bufs) + (should (equal (mapcar #'buffer-name bufs) + '("README" "README" "README"))) + (while bufs + (kill-buffer (pop bufs)))))) + (provide 'uniquify-tests) ;;; uniquify-tests.el ends here commit 4ef9cc5a5ded7156e573a67474f3f48da6c7afe4 Author: Eli Zaretskii Date: Wed Jul 26 17:30:21 2023 +0300 Fix "M-x man RET [ RET" * lisp/man.el (Man-completion-table): Quote special characters before passing them to the shell. (Man-name-regexp): Allow '@' and '[' in man-page names. (Bug#64795) diff --git a/lisp/man.el b/lisp/man.el index 479bf9f9a3c..506d6060269 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -315,7 +315,7 @@ Man-cooked-hook :type 'hook :group 'man) -(defvar Man-name-regexp "[-[:alnum:]_­+][-[:alnum:]_.:­+]*" +(defvar Man-name-regexp "[-[:alnum:]_­+[@][-[:alnum:]_.:­+]*" "Regular expression describing the name of a manpage (without section).") (defvar Man-section-regexp "[0-9][a-zA-Z0-9+]*\\|[LNln]" @@ -937,7 +937,16 @@ Man-completion-table "-k" (concat (when (or Man-man-k-use-anchor (string-equal prefix "")) "^") - prefix)))) + (if (string-equal prefix "") + prefix + ;; FIXME: shell-quote-argument + ;; is not entirely + ;; appropriate: we actually + ;; need to quote ERE here. + ;; But we don't have that, and + ;; shell-quote-argument does + ;; the job... + (shell-quote-argument prefix)))))) (setq table (Man-parse-man-k))))) ;; Cache the table for later reuse. (when table commit 8abe4ca83a1a271d2867b9efb9750ba8e9d37c37 Author: Neal Sidhwaney Date: Sun Jul 23 19:25:51 2023 -0400 Add 'define-error' to font lock keywords for emacs-lisp-mode * lisp/emacs-lisp/lisp-mode.el (lisp-fdefs): Add 'define-error'. (Bug#64824) * test/lisp/emacs-lisp/lisp-mode-tests.el (test-font-lock-keywords): New test. Copyright-paperwork-exempt: yes diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 4eee009f689..3bf9a2f10db 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -361,7 +361,7 @@ lisp-mode--search-key "define-globalized-minor-mode" "define-skeleton" "define-widget" "ert-deftest")) (el-vdefs '("defconst" "defcustom" "defvaralias" "defvar-local" - "defface")) + "defface" "define-error")) (el-tdefs '("defgroup" "deftheme")) (el-errs '("user-error")) ;; Common-Lisp constructs supported by EIEIO. FIXME: namespace. diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp/lisp-mode-tests.el index 3e906497020..825e6b6ab80 100644 --- a/test/lisp/emacs-lisp/lisp-mode-tests.el +++ b/test/lisp/emacs-lisp/lisp-mode-tests.el @@ -355,5 +355,28 @@ test-lisp-current-defun-name ;; (should (equal (lisp-current-defun-name) "defblarg"))) ) +(ert-deftest test-font-lock-keywords () + "Keywords should be fontified in `font-lock-keyword-face`." + (with-temp-buffer + (emacs-lisp-mode) + (mapc (lambda (el-keyword) + (erase-buffer) + (insert (format "(%s some-symbol () \"hello\"" el-keyword)) + (font-lock-ensure) + ;; Verify face property throughout the keyword + (let* ((begin (1+ (point-min))) + (end (1- (+ begin (length el-keyword))))) + (mapc (lambda (pos) + (should (equal (get-text-property pos 'face) + 'font-lock-keyword-face))) + (number-sequence begin end)))) + '("defsubst" "cl-defsubst" "define-inline" + "define-advice" "defadvice" "defalias" + "define-derived-mode" "define-minor-mode" + "define-generic-mode" "define-global-minor-mode" + "define-globalized-minor-mode" "define-skeleton" + "define-widget" "ert-deftest" "defconst" "defcustom" + "defvaralias" "defvar-local" "defface" "define-error")))) + (provide 'lisp-mode-tests) ;;; lisp-mode-tests.el ends here commit bcadb728e2f46263ca69a4702b70ff2c3bb62deb Author: Brian Leung Date: Mon Jul 24 04:32:19 2023 -0700 lisp-mode.el: Add defvar-keymap to lisp-imenu-generic-expression * lisp/emacs-lisp/lisp-mode.el (lisp-imenu-generic-expression): Add defvar-keymap. We do not ignore (defvar-keymap FOO) constructs in imenu as we do with (defvar FOO) since the former constructs are generally not vacuous whereas the latter ones often are. (Bug#64831) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 1990630608d..4eee009f689 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -134,7 +134,7 @@ lisp-imenu-generic-expression (purecopy (concat "^\\s-*(" (regexp-opt '(;; Elisp - "defconst" "defcustom" + "defconst" "defcustom" "defvar-keymap" ;; CL "defconstant" "defparameter" "define-symbol-macro") commit 586bdd6f9a522b2e0a9e701c9b2079095e880180 Author: Laurence Warne Date: Sat Jul 22 20:47:21 2023 +0100 Fix unstable Proced refine tests * test/lisp/proced-tests.el (proced-refine-test) (proced-refine-with-update-test): Also check if the parent process id of each process matches the process id refined on before failing, since the refiner for process id returns the children of a process in addition to the process itself. (Bug#64800) diff --git a/test/lisp/proced-tests.el b/test/lisp/proced-tests.el index d53f25b00d8..bffbf5486d3 100644 --- a/test/lisp/proced-tests.el +++ b/test/lisp/proced-tests.el @@ -44,6 +44,17 @@ proced--move-to-column "Move to the column under ATTRIBUTE in the current proced buffer." (move-to-column (string-match attribute proced-header-line))) +(defun proced--assert-process-valid-pid-refinement (pid) + "Fail unless the process at point could be present after a refinment using PID." + (proced--move-to-column "PID") + (let ((pid-equal (string= pid (word-at-point)))) + (should + (or pid-equal + ;; Guard against the unlikely event a platform doesn't support PPID + (when (string-match "PPID" proced-header-line) + (proced--move-to-column "PPID") + (string= pid (word-at-point))))))) + (ert-deftest proced-format-test () (dolist (format '(short medium long verbose)) (proced--within-buffer @@ -75,22 +86,21 @@ proced-color-test (ert-deftest proced-refine-test () ;;(skip-unless (memq system-type '(gnu/linux gnu/kfreebsd darwin))) (proced--within-buffer - 'medium + 'verbose 'user ;; When refining on PID for process A, a process is kept if and only - ;; if its PID are the same as process A, which more or less guarentees - ;; the refinement will remove some processes. + ;; if its PID is the same as process A, or its parent process is + ;; process A. (proced--move-to-column "PID") (let ((pid (word-at-point))) (proced-refine) (while (not (eobp)) - (proced--move-to-column "PID") - (should (string= pid (word-at-point))) + (proced--assert-process-valid-pid-refinement pid) (forward-line))))) (ert-deftest proced-refine-with-update-test () (proced--within-buffer - 'medium + 'verbose 'user (proced--move-to-column "PID") (let ((pid (word-at-point))) @@ -101,8 +111,7 @@ proced-refine-with-update-test ;; processes again, causing the test to fail. (proced-update) (while (not (eobp)) - (proced--move-to-column "PID") - (should (string= pid (word-at-point))) + (proced--assert-process-valid-pid-refinement pid) (forward-line))))) (ert-deftest proced-update-preserves-pid-at-point-test () commit 3449ff5b6528b9b75fa7a00ef9bf580668e20d9e Author: Valtteri Vuorikoski Date: Sat Jul 22 20:08:42 2023 +0300 Fix build --with-sound on NetBSD and OpenBSD * configure.ac: Use ossaudio by default on *BSD systems. (Bug#64698) * etc/NEWS: Announce the change. diff --git a/configure.ac b/configure.ac index 38ff6e18daf..79f5a468dd9 100644 --- a/configure.ac +++ b/configure.ac @@ -1800,12 +1800,15 @@ AC_DEFUN AC_MSG_ERROR([OSS sound support requested but not found.]) if test "${with_sound}" = "bsd-ossaudio" || test "${with_sound}" = "yes"; then - # Emulation library used on NetBSD. + # OSS emulation library used on NetBSD and OpenBSD. AC_CHECK_LIB([ossaudio], [_oss_ioctl], [LIBSOUND=-lossaudio], [LIBSOUND=]) test "${with_sound}" = "bsd-ossaudio" && test -z "$LIBSOUND" && \ AC_MSG_ERROR([bsd-ossaudio sound support requested but not found.]) - dnl FIXME? If we did find ossaudio, should we set with_sound=bsd-ossaudio? - dnl Traditionally, we go on to check for alsa too. Does that make sense? + # On {Net,Open}BSD use the system audio library instead of + # potentially switching to ALSA below, as ALSA on these appears to + # just wrap system libraries. + test "${with_sound}" = "yes" && test "$LIBSOUND" = "-lossaudio" && \ + with_sound="bsd-ossaudio" fi AC_SUBST([LIBSOUND]) diff --git a/etc/NEWS b/etc/NEWS index 5883b4df2a7..e81bc223836 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -24,6 +24,16 @@ applies, and please also update docstrings as needed. * Installation Changes in Emacs 30.1 +--- +** Emacs now defaults to ossaudio library for sound on NetBSD and OpenBSD. +Previously configure used ALSA libraries if installed on the +system when configured '--with-sound=yes' (which is the default), with +fallback to libossaudio. The libossaudio library included with the +base system is now used even if ALSA is found to avoid relying on +external packages and to resolve potential incompatibilities between +Linux and BSD versions of ALSA. Use '--with-sound=alsa' to build with +ALSA on these operating systems instead. + * Startup Changes in Emacs 30.1 commit 04a930a08ce80d8dcc123f86a3f153f23ec31a29 Author: Harald Jörg Date: Wed Jul 26 09:55:34 2023 +0200 cperl-mode.el: Bring cperl-short-docs up to Perl 5.38. * lisp/progmodes/cperl-mode.el (imenu-max-items): declare the variable to silence an elint warning. (cperl-short-docs): Reorder function description to match Perl's perlfunc documentation. Add missing shortdocs from perlfunc. Delete entries for operators which don't exist any more (EQ, NE and friends). Shorten docstring lines to 80 chars or less. diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el index c0e9cfde8e7..5dc49e4ebb4 100644 --- a/lisp/progmodes/cperl-mode.el +++ b/lisp/progmodes/cperl-mode.el @@ -7361,6 +7361,9 @@ cperl-list-fold (nreverse list2)) list1))))) +(defvar imenu-max-items nil + "Max items in an imenu list. Defined in imenu.el.") + (defun cperl-menu-to-keymap (menu) (let (list) (cons 'keymap @@ -7750,10 +7753,27 @@ cperl-short-docs ... >> ... Bitwise shift right. ... >>= ... Bitwise shift right assignment. ... ? ... : ... Condition=if-then-else operator. +... | ... Bitwise or. +... || ... Logical or. +... // ... Defined-or. +~ ... Unary bitwise complement. +... and ... Low-precedence synonym for &&. +... cmp ... String compare. +... eq ... String equality. +... ge ... String greater than or equal. +... gt ... String greater than. +... le ... String less than or equal. +... lt ... String less than. +... ne ... String inequality. +not ... Low-precedence synonym for ! - negation. +... or ... Low-precedence synonym for ||. +... x ... Repeat string or array. +x= ... Repetition assignment. +... xor ... Low-precedence synonym for exclusive or. @ARGV Command line arguments (not including the command name - see $0). @INC List of places to look for perl scripts during do/include/use. @_ Parameter array for subroutines; result of split() unless in list context. -\\ Creates reference to what follows, like \\$var, or quotes non-\\w in strings. +\\ Creates reference to what follows, like \\$var. Quotes non-\\w in strings. \\0 Octal char, e.g. \\033. \\E Case modification terminator. See \\Q, \\L, and \\U. \\L Lowercase until \\E . See also \\l, lc. @@ -7771,12 +7791,8 @@ cperl-short-docs \\u Upcase the next character. See also \\U and \\l, ucfirst. \\x Hex character, e.g. \\x1b. ... ^ ... Bitwise exclusive or. -__END__ Ends program source. __DATA__ Ends program source. -__FILE__ Current (source) filename. -__LINE__ Current line in current source. -__PACKAGE__ Current package. -__SUB__ Current sub. +__END__ Ends program source. ADJUST {...} Callback for object creation ARGV Default multi-file input filehandle. is a synonym for <>. ARGVOUT Output filehandle with -i flag. @@ -7786,267 +7802,252 @@ cperl-short-docs UNITCHECK { ... } INIT { ... } Pseudo-subroutine executed before the script starts running. DATA Input filehandle for what follows after __END__ or __DATA__. -accept(NEWSOCKET,GENERICSOCKET) -alarm(SECONDS) +abs [ EXPR ] absolute value function +accept(NEWSOCKET,GENERICSOCKET) accept an incoming socket connect +alarm(SECONDS) schedule a SIGALRM async(SUB NAME {}|SUB {}) Mark function as potentially asynchronous -atan2(X,Y) +atan2(X,Y) arctangent of Y/X in the range -PI to PI await(ASYNCEXPR) Yield result of Future -bind(SOCKET,NAME) -binmode(FILEHANDLE) +bind(SOCKET,NAME) binds an address to a socket +binmode(FILEHANDLE) prepare binary files for I/O +bless REFERENCE [, PACKAGE] Makes reference into an object of a package. break Break out of a given/when statement -caller[(LEVEL)] -chdir(EXPR) -chmod(LIST) -chop[(LIST|VAR)] -chown(LIST) -chroot(FILENAME) -class NAME Introduce a class. -close(FILEHANDLE) -closedir(DIRHANDLE) -... cmp ... String compare. -connect(SOCKET,NAME) +caller[(LEVEL)] get context of the current subroutine call +chdir(EXPR) change your current working directory +chmod(LIST) changes the permissions on a list of files +chomp [LIST] Strips $/ off LIST/$_. Returns count. +chop[(LIST|VAR)] remove the last character from a string +chown(LIST) change the ownership on a list of files +chr [NUMBER] Converts a number to char with the same ordinal. +chroot(FILENAME) make directory new root for path lookups +class NAME Introduce an object class. +close(FILEHANDLE) close file (or pipe or socket) handle +closedir(DIRHANDLE) close directory handle +connect(SOCKET,NAME) connect to a remote socket continue of { block } continue { block }. Is executed after `next' or at end. -cos(EXPR) -crypt(PLAINTEXT,SALT) -dbmclose(%HASH) -dbmopen(%HASH,DBNAME,MODE) -default { ... } default case for given/when block -defer { ... } run this block after the containing block. -defined(EXPR) -delete($HASH{KEY}) -die(LIST) +cos(EXPR) cosine function +crypt(PLAINTEXT,SALT) one-way passwd-style encryption +dbmclose(%HASH) breaks binding on a tied dbm file +dbmopen(%HASH,DBNAME,MODE) create binding on a tied dbm file +defined(EXPR) test whether a value, variable, or function is defined +delete($HASH{KEY}) deletes a value from a hash +die(LIST) raise an exception or bail out do { ... }|SUBR while|until EXPR executes at least once do(EXPR|SUBR([LIST])) (with while|until executes at least once) -dump LABEL -each(%HASH) -endgrent -endhostent -endnetent -endprotoent -endpwent -endservent -eof[([FILEHANDLE])] -... eq ... String equality. -eval(EXPR) or eval { BLOCK } +dump LABEL create an immediate core dump +each(%HASH) retrieve the next key/value pair from a hash +endgrent be done using group file +endhostent be done using hosts file +endnetent be done using networks file +endprotoent be done using protocols file +endpwent be done using passwd file +endservent be done using services file +eof[([FILEHANDLE])] test a filehandle for its end +eval(EXPR) or eval { BLOCK } catch exceptions or compile and run code evalbytes See eval. exec([TRUENAME] ARGV0, ARGVs) or exec(SHELL_COMMAND_LINE) -exit(EXPR) -exp(EXPR) +exists $HASH{KEY} True if the key exists. +exit(EXPR) terminate this program +exp(EXPR) raise e to a power +fc EXPR Returns the casefolded version of EXPR. fcntl(FILEHANDLE,FUNCTION,SCALAR) field VAR [:param[(NAME)]] [=EXPR] declare an object attribute -fileno(FILEHANDLE) -flock(FILEHANDLE,OPERATION) -for (EXPR;EXPR;EXPR) { ... } -foreach [VAR] (@ARRAY) { ... } -fork -... ge ... String greater than or equal. -getc[(FILEHANDLE)] -getgrent -getgrgid(GID) -getgrnam(NAME) -gethostbyaddr(ADDR,ADDRTYPE) -gethostbyname(NAME) -gethostent -getlogin -getnetbyaddr(ADDR,ADDRTYPE) -getnetbyname(NAME) -getnetent -getpeername(SOCKET) -getpgrp(PID) -getppid -getpriority(WHICH,WHO) -getprotobyname(NAME) -getprotobynumber(NUMBER) -getprotoent -getpwent -getpwnam(NAME) -getpwuid(UID) -getservbyname(NAME,PROTO) -getservbyport(PORT,PROTO) -getservent -getsockname(SOCKET) -getsockopt(SOCKET,LEVEL,OPTNAME) -given (EXPR) { [ when (EXPR) { ... } ]+ [ default { ... } ]? } -gmtime(EXPR) -goto LABEL -... gt ... String greater than. -hex(EXPR) -if (EXPR) { ... } [ elsif (EXPR) { ... } ... ] [ else { ... } ] or EXPR if EXPR -index(STR,SUBSTR[,OFFSET]) -int(EXPR) -ioctl(FILEHANDLE,FUNCTION,SCALA)R -join(EXPR,LIST) -keys(%HASH) -kill(LIST) -last [LABEL] -... le ... String less than or equal. -length(EXPR) -link(OLDFILE,NEWFILE) -listen(SOCKET,QUEUESIZE) -local(LIST) -localtime(EXPR) -log(EXPR) -lstat(EXPR|FILEHANDLE|VAR) -... lt ... String less than. -m/PATTERN/iogsmx +__FILE__ Current (source) filename. +fileno(FILEHANDLE) return file descriptor from filehandle +flock(FILEHANDLE,OPERATION) lock an entire file with an advisory lock +fork create a new process just like this one +format [NAME] = Start of output format. Ended by a single dot (.) on a line. +formline PICTURE, LIST Backdoor into \"format\" processing. +getc[(FILEHANDLE)] get the next character from the filehandle +getgrent get group record given group user ID +getgrgid(GID) get group record given group user ID +getgrnam(NAME) get group record given group name +gethostbyaddr(ADDR,ADDRTYPE) get host record given name +gethostbyname(NAME) get host record given name +gethostent get next hosts record +getlogin return who logged in at this tty +getnetbyaddr(ADDR,ADDRTYPE) get network record given its address +getnetbyname(NAME) get networks record given name +getnetent get next networks record +getpeername(SOCKET) find the other end of a socket connection +getpgrp(PID) get process group +getppid get parent process ID +getpriority(WHICH,WHO) get current nice value +getprotobyname(NAME) get protocol record given name +getprotobynumber(NUMBER) get protocol record numeric protocol +getprotoent get next protocols record +getpwent get next passwd record +getpwnam(NAME) get passwd record given user login name +getpwuid(UID) get passwd record given user ID +getservbyname(NAME,PROTO) get services record given its name +getservbyport(PORT,PROTO) get services record given numeric port +getservent get next services record +getsockname(SOCKET) retrieve the sockaddr for a given socket +getsockopt(SOCKET,LEVEL,OPTNAME) get socket options on a given socket +glob EXPR expand filenames using wildcards. Synonym of . +gmtime(EXPR) convert UNIX time into record or string using Greenwich time +goto LABEL create spaghetti code +grep EXPR,LIST or grep {BLOCK} LIST Filters LIST via EXPR/BLOCK. +hex(EXPR) convert a hexadecimal string to a number +import patch a module's namespace into your own +index(STR,SUBSTR[,OFFSET]) find a substring within a string +int(EXPR) get the integer portion of a number +ioctl(FILEHANDLE,FUNCTION,SCALAR) device control system call +join(EXPR,LIST) join a list into a string using a separator +keys(%HASH) retrieve list of indices from a hash +kill(LIST) send a signal to a process or process group +last [LABEL] exit a block prematurely +lc [ EXPR ] Returns lowercased EXPR. +lcfirst [ EXPR ] Returns EXPR with lower-cased first letter. +length(EXPR) return the number of characters in a string +__LINE__ Current line in current source. +link(OLDFILE,NEWFILE) create a hard link in the filesystem +listen(SOCKET,QUEUESIZE) register your socket as a server +local(LIST) create a temporary value for a global variable +localtime(EXPR) convert UNIX time into record or string using local time +lock(THING) get a thread lock on a variable, subroutine, or method +log(EXPR) retrieve the natural logarithm for a number +lstat(EXPR|FILEHANDLE|VAR) stat a symbolic link +m/PATTERN/iogsmx match a string with a regular expression pattern +map EXPR, LIST or map {BLOCK} LIST Applies EXPR/BLOCK to elts of LIST. method [NAME [(signature)]] { BODY } method NAME; -mkdir(FILENAME,MODE) -msgctl(ID,CMD,ARG) -msgget(KEY,FLAGS) -msgrcv(ID,VAR,SIZE,TYPE.FLAGS) -msgsnd(ID,MSG,FLAGS) +mkdir(FILENAME,MODE) create a directory +msgctl(ID,CMD,ARG) SysV IPC message control operations +msgget(KEY,FLAGS) get SysV IPC message queue +msgrcv(ID,VAR,SIZE,TYPE.FLAGS) receive a SysV IPC message from a message queue +msgsnd(ID,MSG,FLAGS) send a SysV IPC message to a message queue my VAR or my (VAR1,...) Introduces a lexical variable ($VAR, @ARR, or %HASH). -our VAR or our (VAR1,...) Lexically enable a global variable ($V, @A, or %H). -... ne ... String inequality. -next [LABEL] -oct(EXPR) -open(FILEHANDLE[,EXPR]) -opendir(DIRHANDLE,EXPR) +next [LABEL] iterate a block prematurely +no MODULE [SYMBOL1, ...] Partial reverse for `use'. Runs `unimport' method. +oct(EXPR) convert a string to an octal number +open(FILEHANDLE[,EXPR]) open a file, pipe, or descriptor +opendir(DIRHANDLE,EXPR) open a directory ord(EXPR) ASCII value of the first char of the string. -pack(TEMPLATE,LIST) +our VAR or our (VAR1,...) Lexically enable a global variable ($V, @A, or %H). +pack(TEMPLATE,LIST) convert a list into a binary representation package NAME Introduces package context. +__PACKAGE__ Current package. pipe(READHANDLE,WRITEHANDLE) Create a pair of filehandles on ends of a pipe. -pop(ARRAY) -print [FILEHANDLE] [(LIST)] -printf [FILEHANDLE] (FORMAT,LIST) -push(ARRAY,LIST) +pop(ARRAY) remove the last element from an array and return it +pos STRING Set/Get end-position of the last match over this string, see \\G. +print [FILEHANDLE] [(LIST)] output a list to a filehandle +printf [FILEHANDLE] (FORMAT,LIST) output a formatted list to a filehandle +prototype \\&SUB Returns prototype of the function given a reference. +push(ARRAY,LIST) append one or more elements to an array q/STRING/ Synonym for \\='STRING\\=' qq/STRING/ Synonym for \"STRING\" +qr/PATTERN/ compile pattern +quotemeta quote regular expression magic characters +qw/STRING/ quote a list of words qx/STRING/ Synonym for \\=`STRING\\=` -rand[(EXPR)] -read(FILEHANDLE,SCALAR,LENGTH[,OFFSET]) -readdir(DIRHANDLE) -readlink(EXPR) -recv(SOCKET,SCALAR,LEN,FLAGS) -redo [LABEL] -rename(OLDNAME,NEWNAME) -require [FILENAME | PERL_VERSION] -reset[(EXPR)] -return(LIST) -reverse(LIST) -rewinddir(DIRHANDLE) -rindex(STR,SUBSTR[,OFFSET]) -rmdir(FILENAME) -s/PATTERN/REPLACEMENT/gieoxsm -say [FILEHANDLE] [(LIST)] -scalar(EXPR) -seek(FILEHANDLE,POSITION,WHENCE) -seekdir(DIRHANDLE,POS) -select(FILEHANDLE | RBITS,WBITS,EBITS,TIMEOUT) -semctl(ID,SEMNUM,CMD,ARG) -semget(KEY,NSEMS,SIZE,FLAGS) -semop(KEY,...) -send(SOCKET,MSG,FLAGS[,TO]) -setgrent -sethostent(STAYOPEN) -setnetent(STAYOPEN) -setpgrp(PID,PGRP) -setpriority(WHICH,WHO,PRIORITY) -setprotoent(STAYOPEN) -setpwent -setservent(STAYOPEN) -setsockopt(SOCKET,LEVEL,OPTNAME,OPTVAL) -shift[(ARRAY)] -shmctl(ID,CMD,ARG) -shmget(KEY,SIZE,FLAGS) -shmread(ID,VAR,POS,SIZE) -shmwrite(ID,STRING,POS,SIZE) -shutdown(SOCKET,HOW) -sin(EXPR) -sleep[(EXPR)] -socket(SOCKET,DOMAIN,TYPE,PROTOCOL) -socketpair(SOCKET1,SOCKET2,DOMAIN,TYPE,PROTOCOL) -sort [SUBROUTINE] (LIST) -splice(ARRAY,OFFSET[,LENGTH[,LIST]]) -split[(/PATTERN/[,EXPR[,LIMIT]])] -sprintf(FORMAT,LIST) -sqrt(EXPR) -srand(EXPR) -stat(EXPR|FILEHANDLE|VAR) +rand[(EXPR)] retrieve the next pseudorandom number +read(FILEHANDLE,SCALAR,LENGTH[,OFFSET]) fixed-length buffered input +readdir(DIRHANDLE) get a directory from a directory handle +readline FH Synonym of . +readlink(EXPR) determine where a symbolic link is pointing +readpipe CMD Synonym of \\=`CMD\\=`. +recv(SOCKET,SCALAR,LEN,FLAGS) receive a message over a Socket +redo [LABEL] start this loop iteration over again +ref [ EXPR ] Type of EXPR when dereferenced. +rename(OLDNAME,NEWNAME) change a filename +require [FILENAME | PERL_VERSION] load from a library at runtime +reset[(EXPR)] clear all variables of a given name +return(LIST) get out of a function early +reverse(LIST) flip a string or a list +rewinddir(DIRHANDLE) reset directory handle +rindex(STR,SUBSTR[,OFFSET]) right-to-left substring search +rmdir(FILENAME) remove a directory +s/PATTERN/REPLACEMENT/gieoxsm replace a pattern with a string +say [FILEHANDLE] [(LIST)] output a list, appending a newline +scalar(EXPR) force a scalar context +seek(FILEHANDLE,POSITION,WHENCE) reposition file pointer +seekdir(DIRHANDLE,POS) reposition directory pointer +select(FILEHANDLE) reset default output or do I/O multiplexing +select(RBITS,WBITS,EBITS,TIMEOUT) do I/O multiplexing +semctl(ID,SEMNUM,CMD,ARG) SysV semaphore control operations +semget(KEY,NSEMS,SIZE,FLAGS) get set of SysV semaphores +semop(KEY,...) SysV semaphore operations +send(SOCKET,MSG,FLAGS[,TO]) send a message over a socket +setgrent prepare group file for use +sethostent(STAYOPEN) prepare hosts file for use +setnetent(STAYOPEN) prepare networks file for use +setpgrp(PID,PGRP) set the process group of a process +setpriority(WHICH,WHO,PRIORITY) Process set a process\\='s nice value +setprotoent(STAYOPEN) etwork prepare protocols file for use +setpwent prepare passwd file for use +setservent(STAYOPEN) prepare services file for use +setsockopt(SOCKET,LEVEL,OPTNAME,OPTVAL) set some socket options +shift[(ARRAY)] remove the first element of an array, and return it +shmctl(ID,CMD,ARG) SysV shared memory operations +shmget(KEY,SIZE,FLAGS) get SysV shared memory segment identifier +shmread(ID,VAR,POS,SIZE) read SysV shared memory +shmwrite(ID,STRING,POS,SIZE) write SysV shared memory +shutdown(SOCKET,HOW) close down just half of a socket connection +sin(EXPR) return the sine of a number +sleep[(EXPR)] block for some number of seconds +socket(SOCKET,DOMAIN,TYPE,PROTOCOL) create a socket +socketpair(SOCKET1,SOCKET2,DOMAIN,TYPE,PROTOCOL) create a pair of sockets +sort [SUBROUTINE] (LIST) sort a list of values +splice(ARRAY,OFFSET[,LENGTH[,LIST]]) add or remove elements anywhere +split[(/PATTERN/[,EXPR[,LIMIT]])] split up a string using a regexp +sprintf(FORMAT,LIST) formatted print into a string +sqrt(EXPR) square root function +srand(EXPR) seed the random number generator +stat(EXPR|FILEHANDLE|VAR) get a file\\='s status information state VAR or state (VAR1,...) Introduces a static lexical variable -study[(SCALAR)] +study[(SCALAR)] no-op, formerly optimized input data for repeated searches sub [NAME [(format)]] { BODY } sub NAME [(format)]; sub [(format)] {...} -substr(EXPR,OFFSET[,LEN]) -symlink(OLDFILE,NEWFILE) -syscall(LIST) -sysread(FILEHANDLE,SCALAR,LENGTH[,OFFSET]) +__SUB__ the current subroutine, or C if not in a subroutine +substr(EXPR,OFFSET[,LEN]) get or alter a portion of a string +symlink(OLDFILE,NEWFILE) create a symbolic link to a file +syscall(LIST) execute an arbitrary system call +sysopen FH, FILENAME, MODE [, PERM] (MODE is numeric, see Fcntl.) +sysread(FILEHANDLE,SCALAR,LENGTH[,OFFSET]) fixed-length unbuffered input +sysseek(FILEHANDLE,POSITION,WHENCE) position I/O pointer on handle system([TRUENAME] ARGV0 [,ARGV]) or system(SHELL_COMMAND_LINE) -syswrite(FILEHANDLE,SCALAR,LENGTH[,OFFSET]) -tell[(FILEHANDLE)] -telldir(DIRHANDLE) -time -times -tr/SEARCHLIST/REPLACEMENTLIST/cds -truncate(FILE|EXPR,LENGTH) -umask[(EXPR)] -undef[(EXPR)] -unless (EXPR) { ... } [ else { ... } ] or EXPR unless EXPR -unlink(LIST) -unpack(TEMPLATE,EXPR) -unshift(ARRAY,LIST) -until (EXPR) { ... } EXPR until EXPR -utime(LIST) -values(%HASH) -vec(EXPR,OFFSET,BITS) -wait -waitpid(PID,FLAGS) +syswrite(FILEHANDLE,SCALAR,LENGTH[,OFFSET]) fixed-length unbuffered output +tell[(FILEHANDLE)] get current seekpointer on a filehandle +telldir(DIRHANDLE) get current seekpointer on a directory handle +tie VAR, CLASS, LIST Hide an object behind a simple Perl variable. +tied Returns internal object for a tied data. +time return number of seconds since 1970 +times return elapsed time for self and child processes +tr/SEARCHLIST/REPLACEMENTLIST/cds transliterate a string +truncate(FILE|EXPR,LENGTH) shorten a file +uc [ EXPR ] Returns upcased EXPR. +ucfirst [ EXPR ] Returns EXPR with upcased first letter. +umask[(EXPR)] set file creation mode mask +undef[(EXPR)] remove a variable or function definition +unlink(LIST) remove one link to a file +unpack(TEMPLATE,EXPR) convert binary structure into normal perl variables +unshift(ARRAY,LIST) prepend more elements to the beginning of a list +untie VAR Unlink an object from a simple Perl variable. +use MODULE [SYMBOL1, ...] Compile-time `require' with consequent `import'. +utime(LIST) set a file\\='s last access and modify times +values(%HASH) return a list of the values in a hash +vec(EXPR,OFFSET,BITS) test or set particular bits in a string +wait wait for any child process to die +waitpid(PID,FLAGS) wait for a particular child process to die wantarray Returns true if the sub/eval is called in list context. -warn(LIST) -while (EXPR) { ... } EXPR while EXPR -write[(EXPR|FILEHANDLE)] -... x ... Repeat string or array. -x= ... Repetition assignment. -y/SEARCHLIST/REPLACEMENTLIST/ -... | ... Bitwise or. -... || ... Logical or. -... // ... Defined-or. -~ ... Unary bitwise complement. +warn(LIST) print debugging info +write[(EXPR|FILEHANDLE)] print a picture record +y/SEARCHLIST/REPLACEMENTLIST/ transliterate a string #! OS interpreter indicator. If contains `perl', used for options, and -x. AUTOLOAD {...} Shorthand for `sub AUTOLOAD {...}'. CORE:: Prefix to access builtin function if imported sub obscures it. SUPER:: Prefix to lookup for a method in @ISA classes. DESTROY Shorthand for `sub DESTROY {...}'. -... EQ ... Obsolete synonym of `eq'. -... GE ... Obsolete synonym of `ge'. -... GT ... Obsolete synonym of `gt'. -... LE ... Obsolete synonym of `le'. -... LT ... Obsolete synonym of `lt'. -... NE ... Obsolete synonym of `ne'. -abs [ EXPR ] absolute value -... and ... Low-precedence synonym for &&. -bless REFERENCE [, PACKAGE] Makes reference into an object of a package. -chomp [LIST] Strips $/ off LIST/$_. Returns count. Special if $/ eq \\='\\='! -chr Converts a number to char with the same ordinal. else Part of if/unless {BLOCK} elsif {BLOCK} else {BLOCK}. elsif Part of if/unless {BLOCK} elsif {BLOCK} else {BLOCK}. -exists $HASH{KEY} True if the key exists. -fc EXPR Returns the casefolded version of EXPR. -format [NAME] = Start of output format. Ended by a single dot (.) on a line. -formline PICTURE, LIST Backdoor into \"format\" processing. -glob EXPR Synonym of . -lc [ EXPR ] Returns lowercased EXPR. -lcfirst [ EXPR ] Returns EXPR with lower-cased first letter. -grep EXPR,LIST or grep {BLOCK} LIST Filters LIST via EXPR/BLOCK. -map EXPR, LIST or map {BLOCK} LIST Applies EXPR/BLOCK to elts of LIST. -no MODULE [SYMBOL1, ...] Partial reverse for `use'. Runs `unimport' method. -not ... Low-precedence synonym for ! - negation. -... or ... Low-precedence synonym for ||. -pos STRING Set/Get end-position of the last match over this string, see \\G. -prototype FUNC Returns the prototype of a function as a string, or undef. -quotemeta [ EXPR ] Quote regexp metacharacters. -qw/WORD1 .../ Synonym of split(\\='\\=', \\='WORD1 ...\\=') -readline FH Synonym of . -readpipe CMD Synonym of \\=`CMD\\=`. -ref [ EXPR ] Type of EXPR when dereferenced. -sysopen FH, FILENAME, MODE [, PERM] (MODE is numeric, see Fcntl.) -tie VAR, CLASS, LIST Hide an object behind a simple Perl variable. -tied Returns internal object for a tied data. -uc [ EXPR ] Returns upcased EXPR. -ucfirst [ EXPR ] Returns EXPR with upcased first letter. -untie VAR Unlink an object from a simple Perl variable. -use MODULE [SYMBOL1, ...] Compile-time `require' with consequent `import'. -... xor ... Low-precedence synonym for exclusive or. -prototype \\&SUB Returns prototype of the function given a reference. +default { ... } default case for given/when block +defer { ... } run this block after the containing block. +for (EXPR;EXPR;EXPR) { ... } +foreach [VAR] (@ARRAY) { ... } +given (EXPR) { [ when (EXPR) { ... } ]+ [ default { ... } ]? } +if (EXPR) { ... } [ elsif (EXPR) { ... } ... ] [ else { ... } ] or EXPR if EXPR +unless (EXPR) { ... } [ else { ... } ] or EXPR unless EXPR +until (EXPR) { ... } EXPR until EXPR +while (EXPR) { ... } EXPR while EXPR =head1 Top-level heading. =head2 Second-level heading. =head3 Third-level heading.