[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 53846199217 4/4: Merge from origin/emacs-29
From: |
Eli Zaretskii |
Subject: |
master 53846199217 4/4: Merge from origin/emacs-29 |
Date: |
Sat, 7 Oct 2023 03:50:55 -0400 (EDT) |
branch: master
commit 5384619921783bc6d411ea88976ea55b1198ed91
Merge: 2132d8d8dd6 a74e51cfd15
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>
Merge from origin/emacs-29
a74e51cfd15 Fix a defcustom :type
c27b90d04bf Fix 'ido--ffap-find-file'
1594d5f17ad Fix setting the pipe capacity for subprocesses
aad8b5d78f3 Handle LANG on macOS differently (bug#65908)
# Conflicts:
# src/process.c
---
lisp/cedet/srecode/map.el | 3 ++-
lisp/ido.el | 4 ++--
src/nsterm.m | 39 +++++++++++++++++++++------------------
src/process.c | 13 +++++++++----
4 files changed, 34 insertions(+), 25 deletions(-)
diff --git a/lisp/cedet/srecode/map.el b/lisp/cedet/srecode/map.el
index 125459d6eeb..004bb7adddb 100644
--- a/lisp/cedet/srecode/map.el
+++ b/lisp/cedet/srecode/map.el
@@ -49,7 +49,8 @@
"The save location for SRecode's map file.
If the save file is nil, then the MAP is not saved between sessions."
:group 'srecode
- :type 'file)
+ :type '(choice (const :tag "Don't save" nil)
+ file))
(defclass srecode-map (eieio-persistent)
((fileheaderline :initform ";; SRECODE TEMPLATE MAP")
diff --git a/lisp/ido.el b/lisp/ido.el
index 041ed33aa99..bbb3264f4f7 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1509,8 +1509,8 @@ Removes badly formatted data and ignored directories."
(add-hook 'minibuffer-setup-hook #'ido-minibuffer-setup)
(add-hook 'choose-completion-string-functions
#'ido-choose-completion-string))
-(defun ido--ffap-find-file (file)
- (find-file file))
+(defun ido--ffap-find-file (file &optional wildcard)
+ (find-file file wildcard))
(define-minor-mode ido-everywhere
"Toggle use of Ido for all buffer/file reading."
diff --git a/src/nsterm.m b/src/nsterm.m
index efa6ab39a0c..11535f071eb 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -554,29 +554,32 @@ ns_init_locale (void)
/* macOS doesn't set any environment variables for the locale when run
from the GUI. Get the locale from the OS and set LANG. */
{
- NSLocale *locale = [NSLocale currentLocale];
-
NSTRACE ("ns_init_locale");
- /* If we were run from a terminal then assume an unset LANG variable
- is intentional and don't try to "fix" it. */
- if (!isatty (STDIN_FILENO))
+ /* Either use LANG, if set, or try to construct LANG from
+ NSLocale. */
+ const char *lang = getenv ("LANG");
+ if (lang == NULL || *lang == 0)
{
- char *oldLocale = setlocale (LC_ALL, NULL);
- /* It seems macOS should probably use UTF-8 everywhere.
- 'localeIdentifier' does not specify the encoding, and I can't
- find any way to get the OS to tell us which encoding to use,
- so hard-code '.UTF-8'. */
- NSString *localeID = [NSString stringWithFormat:@"%@.UTF-8",
- [locale localeIdentifier]];
-
- /* Check the locale ID is valid and if so set LANG, but not if
- it is already set. */
- if (setlocale (LC_ALL, [localeID UTF8String]))
- setenv("LANG", [localeID UTF8String], 0);
+ const NSLocale *locale = [NSLocale currentLocale];
+ const NSString *localeID = [NSString stringWithFormat:@"%@.UTF-8",
+ [locale localeIdentifier]];
+ lang = [localeID UTF8String];
+ }
- setlocale (LC_ALL, oldLocale);
+ /* Check if LANG can be used for initializing the locale. If not,
+ use a default setting. Note that Emacs' main will undo the
+ setlocale below, initializing the locale from the
+ environment. */
+ if (setlocale (LC_ALL, lang) == NULL)
+ {
+ const char *const default_lang = "en_US.UTF-8";
+ fprintf (stderr, "LANG=%s cannot be used, using %s instead.\n",
+ lang, default_lang);
+ lang = default_lang;
}
+
+ setenv ("LANG", lang, 1);
}
diff --git a/src/process.c b/src/process.c
index 2376d0f288d..e885f771139 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2206,10 +2206,15 @@ create_process (Lisp_Object process, char **new_argv,
Lisp_Object current_dir)
inchannel = p->open_fd[READ_FROM_SUBPROCESS];
forkout = p->open_fd[SUBPROCESS_STDOUT];
-#if (defined (GNU_LINUX) || defined __ANDROID__) \
- && defined (F_SETPIPE_SZ)
- fcntl (inchannel, F_SETPIPE_SZ, read_process_output_max);
-#endif /* (GNU_LINUX || __ANDROID__) && F_SETPIPE_SZ */
+#if defined(F_SETPIPE_SZ) && defined(F_GETPIPE_SZ)
+ /* If they requested larger reads than the default system pipe
+ capacity, try enlarging the capacity to match the request. */
+ if (read_process_output_max > fcntl (inchannel, F_GETPIPE_SZ))
+ {
+ int readmax = clip_to_bounds (1, read_process_output_max, INT_MAX);
+ fcntl (inchannel, F_SETPIPE_SZ, readmax);
+ }
+#endif
}
if (!NILP (p->stderrproc))