Merge from origin/emacs-29

a74e51cfd1 Fix a defcustom :type
c27b90d04b Fix 'ido--ffap-find-file'
1594d5f17a Fix setting the pipe capacity for subprocesses
aad8b5d78f Handle LANG on macOS differently (bug#65908)

# Conflicts:
#	src/process.c
This commit is contained in:
Eli Zaretskii 2023-10-07 03:48:00 -04:00
commit 5384619921
4 changed files with 35 additions and 26 deletions

View file

@ -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")

View file

@ -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."

View file

@ -554,29 +554,32 @@ - (unsigned long)unsignedLong
/* 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);
setlocale (LC_ALL, oldLocale);
const NSLocale *locale = [NSLocale currentLocale];
const NSString *localeID = [NSString stringWithFormat:@"%@.UTF-8",
[locale localeIdentifier]];
lang = [localeID UTF8String];
}
/* 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);
}

View file

@ -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))