1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-14 09:39:42 +00:00
Commit Graph

426 Commits

Author SHA1 Message Date
Paul Eggert
9d626dffc6 Add 'nofollow' flag to set-file-modes etc.
This avoids some race conditions (Bug#39683).  E.g., if some other
program changes a file to a symlink between the time Emacs creates
the file and the time it changes the file’s permissions, using the
new flag prevents Emacs from inadvertently changing the
permissions of a victim in some completely unrelated directory.
* admin/merge-gnulib (GNULIB_MODULES): Add fchmodat.
* doc/lispref/files.texi (Testing Accessibility, Changing Files):
* doc/lispref/os.texi (File Notifications):
* etc/NEWS:
Adjust documentation accordingly.
* lib/chmodat.c, lib/fchmodat.c, lib/lchmod.c, m4/fchmodat.m4:
* m4/lchmod.m4: New files, copied from Gnulib.
* lib/gnulib.mk.in: Regenerate.
* lisp/dired-aux.el (dired-do-chmod):
* lisp/doc-view.el (doc-view-make-safe-dir):
* lisp/emacs-lisp/autoload.el (autoload--save-buffer):
* lisp/emacs-lisp/bytecomp.el (byte-compile-file):
* lisp/eshell/em-pred.el (eshell-pred-file-mode):
* lisp/files.el (backup-buffer-copy, copy-directory):
* lisp/gnus/mail-source.el (mail-source-movemail):
* lisp/gnus/mm-decode.el (mm-display-external):
* lisp/gnus/nnmail.el (nnmail-write-region):
* lisp/net/tramp-adb.el (tramp-adb-handle-file-local-copy)
(tramp-adb-handle-write-region):
* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-directly):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-write-region):
* lisp/net/tramp.el (tramp-handle-write-region)
(tramp-make-tramp-temp-file):
* lisp/server.el (server-ensure-safe-dir):
* lisp/url/url-util.el (url-make-private-file):
When getting or setting file modes, avoid following symbolic links
when the file is not supposed to be a symbolic link.
* lisp/doc-view.el (doc-view-make-safe-dir):
Omit no-longer-needed separate symlink test.
* lisp/gnus/gnus-util.el (gnus-set-file-modes):
* lisp/net/tramp.el (tramp-handle-file-modes):
* lisp/net/tramp-gvfs.el (tramp-gvfs-handle-set-file-modes):
* src/fileio.c (symlink_nofollow_flag): New function.
(Ffile_modes, Fset_file_modes):
Support an optional FLAG arg.  All C callers changed.
* lisp/net/ange-ftp.el (ange-ftp-set-file-modes):
* lisp/net/tramp-adb.el (tramp-adb-handle-set-file-modes):
* lisp/net/tramp-sh.el (tramp-sh-handle-set-file-modes):
* lisp/net/tramp-smb.el (tramp-smb-handle-set-file-modes):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-set-file-modes):
Accept an optional FLAG arg that is currently ignored,
and add a FIXME comment for it.
* m4/gnulib-comp.m4: Regenerate.
2020-02-23 16:45:50 -08:00
Paul Eggert
365e01cc9f Update copyright year to 2020
Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
2020-01-01 00:59:52 +00:00
Eli Zaretskii
c574d27464 Fix documentation of '-position' server command
* lisp/server.el (server-process-filter): Fix the description
of "-position" command to match the reality.  (Bug#38443)
2019-12-07 11:50:14 +02:00
Eli Zaretskii
e06324a032 Revert "Don't flash previous buffer when connecting with emacsclient"
This reverts commit 49fc040077.
It turns out that the fix for a minor aesthetical annoyance
caused much more serious bugs: bug#31038, bug#35726, Bug#37097,
2019-11-07 19:11:23 +02:00
Paul Eggert
bc1c2cf009 Fix some file-mode races
* lisp/emacs-lisp/autoload.el (autoload-ensure-file-writeable):
* lisp/files.el (after-find-file):
* lisp/gnus/gnus-start.el (gnus-dribble-read-file):
* lisp/htmlfontify.el (hfy-copy-and-fontify-file):
* lisp/server.el (server-ensure-safe-dir):
Avoid a race when getting file permissions.
2019-09-16 18:00:59 -07:00
Eli Zaretskii
40eb4c51a4 ; (server-goto-toplevel): Fix comment to reflect the code. 2019-09-07 12:42:52 +03:00
Eli Zaretskii
cac8152c8e Allow client connections when in recursive-edit
* lisp/server.el (server-goto-toplevel): Check minibuffer
depth, not recursion depth.  This avoids exiting
recursive-edit if a client connection is accepted during
recursive-edit.  (Bug#37176)
2019-09-07 12:33:03 +03:00
Stefan Monnier
8a2f763e5c * lisp/server.el (server-ensure-safe-dir): Revert part of b663c83724
A non-cosmetic change that was mistakenly included.
2019-07-18 11:10:05 -04:00
Michael Shields
14fc8a108b [PATCH 1/1] Pass frame-parameters to server-create-tty-frame
* lisp/server.el: Pass frame-parameters when creating frames, even
on a tty (bug#24147).
2019-06-25 14:53:51 +02:00
Paul Eggert
f744797af1 Go back to "Maintainer: emacs-devel@gnu.org"
Restore lines saying "Maintainer: emacs-devel@gnu.org" when there is
no special maintainer for a file.  Although this wasn't documented
it was common practice and removing the lines didn't have consensus.
2019-05-25 14:25:18 -07:00
Paul Eggert
bef1be8730 Fixes for "Maintainer:" and related lines
Mostly, this just removes "Maintainer: emacs-devel@gnu.org" lines,
which are not that useful.  It also cleans up and regularizes a
few similar lines.
2019-05-19 21:34:27 -07:00
Glenn Morris
5fe9375a51 Merge from origin/emacs-26
02bee78 Let dir locals for more specific modes override those from less
b1235f9 Improve documentation of Hexl mode
32d1813 Fix description of (move-to-column <n> t) when column <n> is ...
0397b7c ; Fix smtpmail-stream-type docstring
7dab3ee Recognize single quote attribute values in nxml and sgml (Bug...
e4cde42 Disable extra display of &#10; in nxml-mode (Bug#32897)
ca14dd1 Fix nxml-get-inside (Bug#32003)
e7ab351 Fix positioning client buffer as instructed by emacsclient

# Conflicts:
#	lisp/files.el
#	lisp/textmodes/sgml-mode.el
2019-05-14 17:18:18 -07:00
Eli Zaretskii
e7ab351caa Fix positioning client buffer as instructed by emacsclient
* lisp/server.el (server-switch-buffer): Let-bind
switch-to-buffer-preserve-window-point to nil when switching
to the client buffer, when the client requested a specific
position.  (Bug#35602)
2019-05-08 20:34:09 +03:00
Stefan Monnier
b663c83724 * lisp/server.el: Cosmetic changes
Remove redundant :group args.
(server-temp-file-regexp): Fix ^$ to  \`\'.
2019-05-03 09:49:38 -04:00
Stefan Monnier
e08e0880f9 Use lexical-binding by default for M-:, --eval, and *scratch*
* lisp/startup.el (command-line): Default to lexical-binding in *scratch*.
(normal-no-mouse-startup-screen, command-line-1):
Use startup--get-buffer-create-scratch.
(command-line-1):
* lisp/simple.el (eval-expression):
* lisp/server.el (server-eval-and-print): Use lexical-binding to
evaluate the expression.
(server-execute): Use startup--get-buffer-create-scratch.
* lisp/ielm.el (inferior-emacs-lisp-mode): Default to lexical-binding.
2019-04-25 14:36:03 -04:00
Paul Eggert
2a3bd6798e Avoid using obsolete accept-process-output arg
* lisp/gnus/nnheader.el (nnheader-accept-process-output):
* lisp/net/dns.el (dns-query):
* lisp/net/imap.el (imap-wait-for-tag):
* lisp/net/network-stream.el (network-stream-get-response):
* lisp/net/pop3.el (pop3-accept-process-output):
* lisp/obsolete/starttls.el (starttls-negotiate-gnutls)
(starttls-open-stream-gnutls):
* lisp/server.el (server-eval-at):
* lisp/textmodes/ispell.el (ispell-accept-output):
Do not depend on the obsolete milliseconds argument of
accept-process-output.
2019-01-15 14:09:11 -08:00
Eli Zaretskii
f6eacc468b Improve documentation of 'server-name'
* doc/emacs/misc.texi (Emacs Server, TCP Emacs server)
(emacsclient Options):
* lisp/server.el (server-name): Document the usage of
'server-name' to specify the server file as an absolute file
name.  (Bug#33934)
2019-01-04 15:55:59 +02:00
Eli Zaretskii
775517307d Improve documentation of 'server-name'
* doc/emacs/misc.texi (Emacs Server, TCP Emacs server)
(emacsclient Options):
* lisp/server.el (server-name):  Document the usage of
'server-name' to specify the server file as an absolute file
name.  Do not merge to master.  (Bug#33934)
2019-01-04 15:40:43 +02:00
Paul Eggert
ba809612c0 Merge from origin/emacs-26
2fcf2df Fix copyright years by hand
26bed8b Update copyright year to 2019
2814292 Fix value of default frame height.  (Bug#33921)
2018-12-31 17:57:29 -08:00
Paul Eggert
26bed8ba10 Update copyright year to 2019
Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
2019-01-01 01:01:13 +00:00
Paul Eggert
92282cb502 emacsclient: prefer XDG_RUNTIME_DIR (Bug#33367)
* lib-src/emacsclient.c: Disable -Wformat-truncation=2,
to avoid false alarms about the new snprintf calls.
(local_sockname): New function.
(set_local_socket): Use it.  Prefer XDG_RUNTIME_DIR (if set)
for location of socket directory.  Avoid unnecessary memory
allocation by using snprintf to destination.
* lisp/server.el (server-socket-dir): Prefer XDG_RUNTIME_DIR if set.
2018-12-01 23:08:48 -08:00
Michael Heerdegen
049bd5d267 Don't quote self-quoting pcase patterns
* admin/bzrmerge.el:
* lisp/char-fold.el:
* lisp/dired.el:
* lisp/emacs-lisp/derived.el:
* lisp/emacs-lisp/easy-mmode.el:
* lisp/emacs-lisp/easymenu.el:
* lisp/emacs-lisp/eieio-core.el:
* lisp/emacs-lisp/package.el:
* lisp/emacs-lisp/smie.el:
* lisp/faces.el:
* lisp/filesets.el:
* lisp/progmodes/modula2.el:
* lisp/progmodes/octave.el:
* lisp/progmodes/opascal.el:
* lisp/progmodes/perl-mode.el:
* lisp/progmodes/prolog.el:
* lisp/progmodes/ruby-mode.el:
* lisp/progmodes/sh-script.el:
* lisp/server.el:
* lisp/subr.el:
* lisp/textmodes/css-mode.el:
* test/lisp/emacs-lisp/pcase-tests.el: Don't quote self-quoting
'pcase' patterns.
2018-10-30 16:17:45 +01:00
Paul Eggert
662bee7d70 file-attributes cleanup
Mostly, this replaces magic-number calls like (nth 4 A) with
more-informative calls like (file-attribute-access-time A).
It also fixes some documentation and minor timestamp coding
issues that I noticed while looking into this.
* doc/lispref/files.texi (File Attributes):
* lisp/files.el (file-attribute-size)
(file-attribute-inode-number, file-attribute-device-number):
* src/dired.c (Fdirectory_files_and_attributes)
(Ffile_attributes):
Mention which attributes must be integers, or nonnegative integers,
as opposed to merely being numbers.  Remove no-longer-correct
talk about representing large integers as conses of integers.
* doc/lispref/files.texi (Magic File Names):
* doc/misc/gnus.texi (Low-level interface to the spam-stat dictionary):
* lisp/autorevert.el (auto-revert-find-file-function)
(auto-revert-tail-mode, auto-revert-handler):
* lisp/auth-source.el (auth-source-netrc-parse):
* lisp/cedet/ede/files.el (ede--inode-for-dir):
* lisp/cedet/semantic/db-file.el (object-write):
* lisp/cedet/semantic/db-mode.el (semanticdb-kill-hook):
* lisp/cedet/semantic/db.el (semanticdb-needs-refresh-p)
(semanticdb-synchronize):
* lisp/cedet/srecode/table.el (srecode-mode-table-new):
* lisp/desktop.el (desktop-save, desktop-read):
* lisp/dired-aux.el (dired-file-set-difference)
(dired-do-chxxx, dired-do-chmod, dired-copy-file-recursive)
(dired-create-files):
* lisp/dired.el (dired-directory-changed-p, dired-readin):
* lisp/dos-w32.el (w32-direct-print-region-helper):
* lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads)
(autoload-find-destination, update-directory-autoloads):
* lisp/emacs-lisp/shadow.el (load-path-shadows-same-file-or-nonexistent):
* lisp/epg.el (epg--start, epg-wait-for-completion):
* lisp/eshell/em-ls.el (eshell-ls-filetype-p)
(eshell-ls-applicable, eshell-ls-size-string)
(eshell-ls-file, eshell-ls-dir, eshell-ls-files)
(eshell-ls-entries):
* lisp/eshell/em-pred.el (eshell-predicate-alist)
(eshell-pred-file-type, eshell-pred-file-links)
(eshell-pred-file-size):
* lisp/eshell/em-unix.el (eshell-shuffle-files, eshell/cat)
(eshell-du-sum-directory, eshell/du):
* lisp/eshell/esh-util.el (eshell-read-passwd)
(eshell-read-hosts):
* lisp/files.el (remote-file-name-inhibit-cache)
(find-file-noselect, insert-file-1, dir-locals-find-file)
(dir-locals-read-from-dir, backup-buffer)
(file-ownership-preserved-p, copy-directory)
(read-file-modes):
* lisp/find-lisp.el (find-lisp-format):
* lisp/gnus/gnus-agent.el (gnus-agent-unfetch-articles)
(gnus-agent-read-agentview, gnus-agent-expire-group-1)
(gnus-agent-request-article, gnus-agent-regenerate-group)
(gnus-agent-update-files-total-fetched-for)
(gnus-agent-update-view-total-fetched-for):
* lisp/gnus/gnus-cache.el (gnus-cache-read-active)
(gnus-cache-update-file-total-fetched-for)
(gnus-cache-update-overview-total-fetched-for):
* lisp/gnus/gnus-cloud.el (gnus-cloud-file-new-p):
* lisp/gnus/gnus-score.el (gnus-score-score-files):
* lisp/gnus/gnus-start.el (gnus-save-newsrc-file)
(gnus-master-read-slave-newsrc):
* lisp/gnus/gnus-sum.el (gnus-summary-import-article):
* lisp/gnus/gnus-util.el (gnus-file-newer-than)
(gnus-cache-file-contents):
* lisp/gnus/mail-source.el (mail-source-delete-old-incoming)
(mail-source-callback, mail-source-movemail):
* lisp/gnus/nneething.el (nneething-create-mapping)
(nneething-make-head):
* lisp/gnus/nnfolder.el (nnfolder-read-folder):
* lisp/gnus/nnheader.el (nnheader-file-size)
(nnheader-insert-nov-file):
* lisp/gnus/nnmail.el (nnmail-activate):
* lisp/gnus/nnmaildir.el (nnmaildir--group-maxnum)
(nnmaildir--new-number, nnmaildir--update-nov)
(nnmaildir--scan, nnmaildir-request-scan)
(nnmaildir-request-update-info)
(nnmaildir-request-expire-articles):
* lisp/gnus/nnmh.el (nnmh-request-list-1)
(nnmh-request-expire-articles, nnmh-update-gnus-unreads):
* lisp/gnus/nnml.el (nnml-request-expire-articles):
* lisp/gnus/spam-stat.el (spam-stat-save, spam-stat-load)
(spam-stat-process-directory, spam-stat-test-directory):
* lisp/ido.el (ido-directory-too-big-p)
(ido-file-name-all-completions):
* lisp/image-dired.el (image-dired-get-thumbnail-image)
(image-dired-create-thumb-1):
* lisp/info.el (info-insert-file-contents):
* lisp/ls-lisp.el (ls-lisp-insert-directory)
(ls-lisp-handle-switches, ls-lisp-classify-file)
(ls-lisp-format):
* lisp/mail/blessmail.el:
* lisp/mail/feedmail.el (feedmail-default-date-generator)
(feedmail-default-message-id-generator):
* lisp/mail/mailabbrev.el (mail-abbrevs-sync-aliases)
(mail-abbrevs-setup):
* lisp/mail/mspools.el (mspools-size-folder):
* lisp/mail/rmail.el (rmail-insert-inbox-text):
* lisp/mail/sendmail.el (sendmail-sync-aliases):
* lisp/mh-e/mh-alias.el (mh-alias-tstamp):
* lisp/net/ange-ftp.el (ange-ftp-parse-netrc)
(ange-ftp-write-region, ange-ftp-file-newer-than-file-p)
(ange-ftp-cf1):
* lisp/net/eudcb-mab.el (eudc-mab-query-internal):
* lisp/net/eww.el (eww-read-bookmarks):
* lisp/net/netrc.el (netrc-parse):
* lisp/net/newst-backend.el (newsticker--image-get):
* lisp/nxml/rng-loc.el (rng-get-parsed-schema-locating-file):
* lisp/obsolete/fast-lock.el (fast-lock-save-cache):
* lisp/obsolete/vc-arch.el (vc-arch-state)
(vc-arch-diff3-rej-p):
* lisp/org/ob-eval.el (org-babel--shell-command-on-region):
* lisp/org/org-attach.el (org-attach-commit):
* lisp/org/org-macro.el (org-macro-initialize-templates):
* lisp/org/org.el (org-babel-load-file)
(org-file-newer-than-p):
* lisp/org/ox-html.el (org-html-format-spec):
* lisp/org/ox-publish.el (org-publish-find-date)
(org-publish-cache-ctime-of-src):
* lisp/pcmpl-gnu.el (pcomplete/tar):
* lisp/pcmpl-rpm.el (pcmpl-rpm-packages):
* lisp/play/cookie1.el (cookie-snarf):
* lisp/progmodes/cmacexp.el (c-macro-expansion):
* lisp/ps-bdf.el (bdf-file-mod-time):
* lisp/server.el (server-ensure-safe-dir):
* lisp/simple.el (shell-command-on-region):
* lisp/speedbar.el (speedbar-item-info-file-helper)
(speedbar-check-obj-this-line):
* lisp/thumbs.el (thumbs-cleanup-thumbsdir):
* lisp/time.el (display-time-mail-check-directory)
(display-time-file-nonempty-p):
* lisp/url/url-cache.el (url-is-cached):
* lisp/url/url-file.el (url-file-asynch-callback):
* lisp/vc/diff-mode.el (diff-delete-if-empty):
* lisp/vc/pcvs-info.el (cvs-fileinfo-from-entries):
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
* lisp/vc/vc-cvs.el (vc-cvs-checkout-model)
(vc-cvs-state-heuristic, vc-cvs-merge-news)
(vc-cvs-retrieve-tag, vc-cvs-parse-status, vc-cvs-parse-entry):
* lisp/vc/vc-hg.el (vc-hg--slurp-hgignore-1)
(vc-hg--ignore-patterns-valid-p)
(vc-hg--cached-dirstate-search, vc-hg-state-fast):
* lisp/vc/vc-hooks.el (vc-after-save):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
* lisp/vc/vc-svn.el (vc-svn-merge-news, vc-svn-parse-status):
* lisp/vc/vc.el (vc-checkout, vc-checkin, vc-revert-file):
* lisp/xdg.el (xdg-mime-apps):
Prefer (file-attribute-size A) to (nth 7 A), and similarly
for other file attributes accessors.
* doc/lispref/files.texi (File Attributes):
* doc/lispref/intro.texi (Version Info):
* doc/lispref/os.texi (Idle Timers):
* lisp/erc/erc.el (erc-string-to-emacs-time):
* lisp/files.el (file-attribute-access-time)
(file-attribute-modification-time)
(file-attribute-status-change-time):
* lisp/net/tramp-compat.el:
(tramp-compat-file-attribute-modification-time)
(tramp-compat-file-attribute-size):
* src/buffer.c (syms_of_buffer):
* src/editfns.c (Fget_internal_run_time):
* src/fileio.c (Fvisited_file_modtime)
(Fset_visited_file_modtime):
* src/keyboard.c (Fcurrent_idle_time):
* src/process.c (Fprocess_attributes):
Defer implementation details about timestamp format to the
section that talks about timestamp format, to make it easier
to change the documentation later if timestamp formats are
extended.
* lisp/gnus/gnus-util.el (gnus-file-newer-than):
* lisp/speedbar.el (speedbar-check-obj-this-line):
* lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer):
Prefer time-less-p to doing it by hand.
* lisp/ls-lisp.el (ls-lisp-format): Inode numbers are no longer conses.
* lisp/vc/vc-bzr.el (vc-bzr-state-heuristic):
Use eql, not eq, to compare integers that might be bignums.
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
Prefer float-time to doing time arithmetic by hand.
2018-09-23 18:32:59 -07:00
Noam Postavsky
c0f688808e Handle non-error signals in emacsclient --eval (Bug#10989)
* lisp/server.el (server-process-filter): Handle any signal, not just
errors.
2018-09-04 18:50:29 -04:00
John Shahid
ee3e432300 Optionally add argument description in minor mode DOC (bug#10754)
Add a paragraph to minor mode's docstring documenting the mode's ARG
usage if the supplied docstring doesn't already contain the word "ARG".

* easy-mmode.el (easy-mmode--arg-docstring): New const.
(easy-mmode--arg-docstring): New function.
(define-minor-mode): Use them.

Remove argument documentation from all minor modes.
2018-07-01 23:34:53 -04:00
João Távora
ce54573dac Respect s-s-b-default-predicate when killing terminal
Fixes: Bug#31951

* lisp/server.el (server-save-buffers-kill-terminal): Only pass
PRED=t to save-some-bufers if ARG in non-nil.
2018-06-27 14:19:38 +01:00
Glenn Morris
16c2f03c15 Merge from origin/emacs-26
bbc9d37 (origin/emacs-26) Fix previous change in minibuffer-default-a...
7caeef1 * src/editfns.c (Fformat): Make %x easier to spot in doc stri...
ecc29fb Improve responsiveness while in 'replace-buffer-contents'
8182d64 Improve documentation of 'server-start' and friends
decdfed Clarify wording about functions' argument lists
5abac8b * lisp/doc-view.el: Fix typos in the commentary.  (Bug#31937)
2018-06-23 07:51:00 -07:00
Eli Zaretskii
8182d648cb Improve documentation of 'server-start' and friends
* lisp/server.el (server-start, server-running-p): Document how to
reliably check that the current Emacs process started the server.
(Bug#31859)
2018-06-23 10:50:58 +03:00
Eli Zaretskii
a8be860e17 Improve support for desktop restoration in daemon mode
* lisp/server.el (server-after-make-frame-hook): New hook.
(server-execute): Call it after creating a new frame or before
switching to a buffer shown in a client frame.  (Bug#30421)

* doc/emacs/misc.texi (Saving Emacs Sessions): Adjust advice for
restoring desktop in daemon mode to the new hook.
* doc/lispref/frames.texi (Creating Frames, Standard Hooks):
Document server-after-make-frame-hook.

* etc/NEWS: Mention server-after-make-frame-hook.
2018-03-10 13:48:49 +02:00
Aaron Jensen
49fc040077 Don't flash previous buffer when connecting with emacsclient
* lisp/server.el (server-execute): Accept lambda for creating
frame rather than frame.  Ensure newly created tty frame
initially shows the correct buffer.
(server-process-filter): Pass a lambda to server-execute to create
a frame.  (Bug#24218)
2018-02-16 17:43:04 +02:00
Paul Eggert
3a718ffca0 Finish renaming to internal--daemon-sockname
* doc/lispref/processes.texi (Misc Network): Omit discussion of
internal--daemon-sockname, as non-Emacs code shouldn't rely on it.
* src/process.c (syms_of_process): Rename internal-daemon-sockname
to internal--daemon-sockname.  All uses changed.
2018-02-12 12:57:59 -08:00
Matthew Leach
99cf1bb011 Rename internal--external-sockname and document (Bug#24218)
* lisp/server.el: Rename `internal--external-sockname' to
  `internal-daemon-sockname'.
* src/process.c: Likewise.
* doc/lispref/processes.texi: Document `internal-daemon-sockname'.
2018-02-12 12:57:59 -08:00
Paul Eggert
d43a724f4e Minor cleanups for server-name fix (Bug#24218)
* lisp/server.el (server--external-socket-initialized): Rename
from server-external-socket-initialised, since it should be
private and Emacs uses American spelling.  All uses changed.
* src/emacs.c, src/lisp.h: Revert previous changes, as the
initialization is now done in src/process.c, which already
includes the relevant files.
* src/process.c (union u_sockaddr): Move decl to top level.
(external_sock_name, Fget_external_sockname): Remove, replacing
with Vinternal__external_sockname.  All uses changed.
(init_process_emacs): Deduce socket name ourselves rather than
have main.c do it.  Use conv_sockaddr_to_lisp instead of doing
it by hand.  Conditionalize it on HAVE_GETSOCKNAME.
2018-02-12 12:57:58 -08:00
Matthew Leach
e1ca0ea872 Fix server-name' and server-socket-dir' for (Bug#24218)
* lisp/server.el: (server-external-socket-initialised): New
(server-name): Compute server name from `get-external-sockname'.
(server-socket-dir): Compute socket dir from
`get-external-sockname'.
(server-start): Don't check for existing server when an
uninitialised external socket has been passed to Emacs.
* src/emacs.c: (main): Obtain socket name via getsockname and pass
to `init_process_emacs'.
* src/lisp.h: (init_process_emacs): Add second parameter.
* src/process.c: (external_sock_name): New.
(get-external-sockname): New.
(init_process_emacs): Set `external_sock_name' to `sockname'
parameter.
2018-02-12 12:57:58 -08:00
Stefan Monnier
9107cf30c0 Replace (default-value 'enable-multibyte-characters) with t
Since Emacs-24, (default-value 'enable-multibyte-characters) can't be
changed any more, so we can remove all code which checks this value.

* lisp/x-dnd.el (x-dnd-handle-file-name):
* lisp/w32-fns.el (w32-set-default-process-coding-system):
* lisp/textmodes/ispell.el (ispell-send-string):
* lisp/term/internal.el (dos-codepage-setup):
* lisp/tar-mode.el (tar-header-block-tokenize, tar--extract):
* lisp/startup.el (command-line):
* lisp/server.el (server-process-filter):
* lisp/net/browse-url.el (browse-url-file-url):
* lisp/menu-bar.el (menu-bar-options-menu, menu-bar-describe-menu):
* lisp/mail/sendmail.el (mail-setup):
* lisp/mail/rmail.el (rmail-mode, rmail-get-new-mail):
* lisp/mail/rfc2047.el (rfc2047-encode-message-header):
* lisp/mail/emacsbug.el (report-emacs-bug):
* lisp/international/mule-diag.el (mule-diag):
* lisp/files.el (find-file-noselect-1):
* lisp/dos-fns.el (dos-set-default-process-coding-system):
* lisp/arc-mode.el (archive-mode):
* lisp/international/mule-cmds.el (mule-menu-keymap)
(set-default-coding-systems, set-language-info)
(set-language-environment, standard-display-european-internal)
(set-locale-environment): Simplify code.
2018-01-25 13:35:37 -05:00
Paul Eggert
5c7dd8a783 Update copyright year to 2018
Run admin/update-copyright.
2018-01-01 00:57:59 -08:00
Noam Postavsky
dc0a25c2f9 Give a more sensible message if file-attributes fails (Bug#29070)
* lisp/server.el (server-ensure-safe-dir): Don't claim the directory
is a file if we fail to get anything from `file-attributes'.
2017-11-01 19:39:34 -04:00
Noam Postavsky
d719ea6ad5 Another fix for unsafe directory error message (Bug#865)
* lisp/server.el (server-ensure-safe-dir): Put file owner's uid, not
current user's for the wrong owner case.  Show expanded file name in
error message.
2017-10-21 15:19:14 -04:00
Noam Postavsky
43fac3beae Make "unsafe directory" error message more informative (Bug#865)
* lisp/server.el (server-ensure-safe-dir): Produce a description for
each "unsafe" condition.
2017-09-30 20:01:33 -04:00
Paul Eggert
bc511a64f6 Prefer HTTPS to FTP and HTTP in documentation
Most of this change is to boilerplate commentary such as license URLs.
This change was prompted by ftp://ftp.gnu.org's going-away party,
planned for November.  Change these FTP URLs to https://ftp.gnu.org
instead.  Make similar changes for URLs to other organizations moving
away from FTP.  Also, change HTTP to HTTPS for URLs to gnu.org and
fsf.org when this works, as this will further help defend against
man-in-the-middle attacks (for this part I omitted the MS-DOS and
MS-Windows sources and the test tarballs to keep the workload down).
HTTPS is not fully working to lists.gnu.org so I left those URLs alone
for now.
2017-09-13 15:54:37 -07:00
Mark Oteiza
7459cbec95 Remove server-buffer-clients string from minor-mode-alist
* lisp/server.el: Don't put an element for server-buffer-clients into
minor-mode-alist. (Bug#20201)
2017-02-12 11:51:19 -05:00
Paul Eggert
bcf244ef9b Merge from origin/emacs-25
2e2a806 Fix copyright years by hand
5badc81 Update copyright year to 2017
2017-01-01 01:10:47 -08:00
Paul Eggert
5badc81c1c Update copyright year to 2017
Run admin/update-copyright.
2016-12-31 19:42:26 -08:00
Eli Zaretskii
2675c79db5 Fix daemon shutdown when emacs-kill-hooks ask questions
* lisp/server.el (server-start): Put the server's kill-emacs-hook
last, to allow other hooks to have a frame to interact with the
user.  (Bug#24326)
2016-09-12 21:25:09 +03:00
Johan Bockgård
8fcf3df939 Fix bug in --eval reply message from server
* lisp/server.el (server-reply-print): Fix check for truncated quote
sequence at end of message. Problem reported in:
http://lists.gnu.org/archive/html/emacs-devel/2016-08/msg00101.html
2016-08-18 21:29:48 +02:00
Eli Zaretskii
f995fbd9dc * lisp/server.el (server-name): Add autoload cookie. (Bug#23576) 2016-05-18 22:46:32 +03:00
Matthew Leach
e390b7b546 Add external socket launching support
* src/process.c (connect_network_socket): Allow a pre-allocated socket
descriptor to be used if passed to Emacs, avoiding the call to
'socket' and 'bind'.
(Fmake_network_process): Allow users to pass ':use-external-socket' in
the parameter plist to use any sockets that have been passed to Emacs.
(wait_reading_process_output): Call 'socket' and 'bind' every time.
(syms_of_process): New symbol ':use-external-socket'.
(set_external_socket_descriptor): New function.
(external_sock_fd): New variable.
* src/lisp.h: (set_external_socket_descriptor): New declaration.
* src/emacs.c (main): Call 'sd_listen_fds' to read the number of sockets
passed and call 'set_external_socket_descriptor' to set the external
socket.
* src/Makefile.in: Add libsystemd library and C flags to the Emacs
compilation options.

* configure.ac: Add new default-on option "systemd" and check for
libsystemd at configure time.

* lisp/server.el (server-start): Set ':use-external-socket' to 't' when
calling 'make-network-process'.

* etc/NEWS: Document new socket-passing functionality and the configure
option to disable systemd interaction.

* doc/emacs/misc.texi (Emacs Server): Document systemd socket passing
functionality and provide systemd unit examples.
* doc/lispref/processes.texi (Network Processes): Document new
'make-network-process' option ':use-external-socket'.
2016-04-16 12:43:01 +03:00
Paul Eggert
0e963201d0 Update copyright year to 2016
Run admin/update-copyright.
2016-01-01 01:34:24 -08:00
Ken Brown
133ad3e200 ; * lisp/server.el (server-process-filter): Simplify last change 2015-11-18 14:16:40 -05:00
Ken Brown
ce7ef5b5e0 Silence byte-compiler warning
* lisp/server.el (server-process-filter): Silence byte-compiler
warning.
2015-11-18 13:34:47 -05:00