Skip to content

Commit 8b78975

Browse files
committed
Merge from origin/emacs-26
1c6484e (origin/emacs-26) Fix incorrect cloning of eieio-instance-inh... 37436fe Fix cloning of eieio-named objects (Bug#22840) fb65a36 Fix ibuffer-unmark-backward synopsis (bug#35572) f77bd2b ; * src/lisp.h (DEFSYM): Fix inaccurate comment. 3b86e0b Clarify handling of long options (Bug#24949) 04340a8 Improve documentation of the daemon and emacsclient 3e29de2 * etc/NEWS.24: Belatedly announce delete-consecutive-dups.
2 parents 6734f21 + 1c6484e commit 8b78975

File tree

7 files changed

+102
-34
lines changed

7 files changed

+102
-34
lines changed

doc/emacs/cmdargs.texi

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ corresponding long form.
3939

4040
The long forms with @samp{--} are easier to remember, but longer to
4141
type. However, you don't have to spell out the whole option name; any
42-
unambiguous abbreviation is enough. When a long option takes an
42+
unambiguous abbreviation is enough. When a long option requires an
4343
argument, you can use either a space or an equal sign to separate the
4444
option name and the argument. Thus, for the option @samp{--display},
4545
you can write either @samp{--display sugar-bombs:0.0} or
@@ -347,13 +347,15 @@ Start Emacs with minimum customizations. This is similar to using
347347
@itemx --bg-daemon[=@var{name}]
348348
@itemx --fg-daemon[=@var{name}]
349349
Start Emacs as a daemon: after Emacs starts up, it starts the Emacs
350-
server without opening any frames.
351-
(Optionally, you can specify an explicit @var{name} for the server.)
352-
You can then use the @command{emacsclient} command to connect to Emacs
353-
for editing. @xref{Emacs Server}, for information about using Emacs
354-
as a daemon. A ``background'' daemon disconnects from the terminal
355-
and runs in the background (@samp{--daemon} is an alias for
356-
@samp{--bg-daemon}).
350+
server without opening any frames. You can then use the
351+
@command{emacsclient} command to connect to Emacs for editing.
352+
(Optionally, you can specify an explicit @var{name} for the server; if
353+
you do, you will need to specify the same @var{name} when you invoke
354+
@command{emacsclient}, via its @option{--socket-name} option, see
355+
@ref{emacsclient Options}.) @xref{Emacs Server}, for information
356+
about using Emacs as a daemon. A ``background'' daemon disconnects
357+
from the terminal and runs in the background (@samp{--daemon} is an
358+
alias for @samp{--bg-daemon}).
357359

358360
@item --no-desktop
359361
@opindex --no-desktop

doc/emacs/misc.texi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,6 +1983,9 @@ omitted, @command{emacsclient} connects to the first server it finds.
19831983
If you set @code{server-name} of the Emacs server to an absolute file
19841984
name, give the same absolute file name as @var{server-name} to this
19851985
option to instruct @command{emacsclient} to connect to that server.
1986+
You need to use this option if you started Emacs as daemon
1987+
(@pxref{Initial Options}) and specified the name for the server
1988+
started by the daemon.
19861989

19871990
Alternatively, you can set the @env{EMACS_SOCKET_NAME} environment
19881991
variable to point to the server socket. (The command-line option

etc/NEWS.24

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,8 @@ a non-nil `interactive-only' property.
11171117
The value, if non-nil, is a regexp that specifies what to trim from
11181118
the start and end of each substring.
11191119

1120+
** New function `delete-consecutive-dups'.
1121+
11201122
** Completion
11211123

11221124
*** The separator used by `completing-read-multiple' is now a regexp.

lisp/emacs-lisp/eieio-base.el

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,18 @@ SLOT-NAME is the offending slot. FN is the function signaling the error."
6464
;; Throw the regular signal.
6565
(cl-call-next-method)))
6666

67-
(cl-defmethod clone ((obj eieio-instance-inheritor) &rest _params)
67+
(cl-defmethod clone ((obj eieio-instance-inheritor) &rest params)
6868
"Clone OBJ, initializing `:parent' to OBJ.
6969
All slots are unbound, except those initialized with PARAMS."
70-
(let ((nobj (cl-call-next-method)))
70+
;; call next method without params as we makeunbound slots anyhow
71+
(let ((nobj (if (stringp (car params))
72+
(cl-call-next-method obj (pop params))
73+
(cl-call-next-method obj))))
74+
(dolist (descriptor (eieio-class-slots (class-of nobj)))
75+
(let ((slot (eieio-slot-descriptor-name descriptor)))
76+
(slot-makeunbound nobj slot)))
77+
(when params
78+
(shared-initialize nobj params))
7179
(oset nobj parent-instance obj)
7280
nobj))
7381

@@ -510,16 +518,18 @@ instance."
510518
All slots are unbound, except those initialized with PARAMS."
511519
(let* ((newname (and (stringp (car params)) (pop params)))
512520
(nobj (apply #'cl-call-next-method obj params))
513-
(nm (slot-value obj 'object-name)))
514-
(eieio-oset obj 'object-name
521+
(nm (slot-value nobj 'object-name)))
522+
(eieio-oset nobj 'object-name
515523
(or newname
516-
(save-match-data
517-
(if (and nm (string-match "-\\([0-9]+\\)" nm))
518-
(let ((num (1+ (string-to-number
519-
(match-string 1 nm)))))
520-
(concat (substring nm 0 (match-beginning 0))
521-
"-" (int-to-string num)))
522-
(concat nm "-1")))))
524+
(if (equal nm (slot-value obj 'object-name))
525+
(save-match-data
526+
(if (and nm (string-match "-\\([0-9]+\\)" nm))
527+
(let ((num (1+ (string-to-number
528+
(match-string 1 nm)))))
529+
(concat (substring nm 0 (match-beginning 0))
530+
"-" (int-to-string num)))
531+
(concat nm "-1")))
532+
nm)))
523533
nobj))
524534

525535
(cl-defmethod make-instance ((class (subclass eieio-named)) &rest args)

lisp/ibuffer.el

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2507,8 +2507,8 @@ particular subset of them, and sorting by various criteria.
25072507
25082508
Operations on marked buffers:
25092509
\\<ibuffer-mode-map>
2510-
`\\[ibuffer-do-save]' - Save the marked buffers
2511-
`\\[ibuffer-do-view]' - View the marked buffers in this frame.
2510+
`\\[ibuffer-do-save]' - Save the marked buffers.
2511+
`\\[ibuffer-do-view]' - View the marked buffers in the selected frame.
25122512
`\\[ibuffer-do-view-other-frame]' - View the marked buffers in another frame.
25132513
`\\[ibuffer-do-revert]' - Revert the marked buffers.
25142514
`\\[ibuffer-do-toggle-read-only]' - Toggle read-only state of marked buffers.
@@ -2531,7 +2531,7 @@ Operations on marked buffers:
25312531
buffer's file as an argument.
25322532
`\\[ibuffer-do-eval]' - Evaluate a form in each of the marked buffers. This
25332533
is a very flexible command. For example, if you want to make all
2534-
of the marked buffers read only, try using (read-only-mode 1) as
2534+
of the marked buffers read-only, try using (read-only-mode 1) as
25352535
the input form.
25362536
`\\[ibuffer-do-view-and-eval]' - As above, but view each buffer while the form
25372537
is evaluated.
@@ -2546,21 +2546,20 @@ Marking commands:
25462546
all unmarked buffers.
25472547
`\\[ibuffer-change-marks]' - Change the mark used on marked buffers.
25482548
`\\[ibuffer-unmark-forward]' - Unmark the buffer at point.
2549-
`\\[ibuffer-unmark-backward]' - Unmark the buffer at point, and move to the
2550-
previous line.
2549+
`\\[ibuffer-unmark-backward]' - Unmark the previous buffer.
25512550
`\\[ibuffer-unmark-all]' - Unmark buffers marked with MARK.
25522551
`\\[ibuffer-unmark-all-marks]' - Unmark all marked buffers.
25532552
`\\[ibuffer-mark-by-mode]' - Mark buffers by major mode.
25542553
`\\[ibuffer-mark-unsaved-buffers]' - Mark all \"unsaved\" buffers.
25552554
This means that the buffer is modified, and has an associated file.
25562555
`\\[ibuffer-mark-modified-buffers]' - Mark all modified buffers,
2557-
regardless of whether or not they have an associated file.
2556+
regardless of whether they have an associated file.
25582557
`\\[ibuffer-mark-special-buffers]' - Mark all buffers whose name begins and
25592558
ends with `*'.
25602559
`\\[ibuffer-mark-dissociated-buffers]' - Mark all buffers which have
25612560
an associated file, but that file doesn't currently exist.
25622561
`\\[ibuffer-mark-read-only-buffers]' - Mark all read-only buffers.
2563-
`\\[ibuffer-mark-dired-buffers]' - Mark buffers in `dired' mode.
2562+
`\\[ibuffer-mark-dired-buffers]' - Mark buffers in `dired-mode'.
25642563
`\\[ibuffer-mark-help-buffers]' - Mark buffers in `help-mode', `apropos-mode', etc.
25652564
`\\[ibuffer-mark-old-buffers]' - Mark buffers older than `ibuffer-old-time'.
25662565
`\\[ibuffer-mark-for-delete]' - Mark the buffer at point for deletion.
@@ -2639,17 +2638,17 @@ Other commands:
26392638
26402639
** Information on Filtering:
26412640
2642-
You can filter your ibuffer view via different criteria. Each Ibuffer
2641+
You can filter your Ibuffer view via different criteria. Each Ibuffer
26432642
buffer has its own stack of active filters. For example, suppose you
26442643
are working on an Emacs Lisp project. You can create an Ibuffer
2645-
buffer displays buffers in just `emacs-lisp' modes via
2644+
buffer displaying only `emacs-lisp-mode' buffers via
26462645
`\\[ibuffer-filter-by-mode] emacs-lisp-mode RET'. In this case, there
26472646
is just one entry on the filtering stack.
26482647
26492648
You can also combine filters. The various filtering commands push a
26502649
new filter onto the stack, and the filters combine to show just
26512650
buffers which satisfy ALL criteria on the stack. For example, suppose
2652-
you only want to see buffers in `emacs-lisp' mode, whose names begin
2651+
you only want to see buffers in `emacs-lisp-mode', whose names begin
26532652
with \"gnus\". You can accomplish this via:
26542653
26552654
\\[ibuffer-filter-by-mode] emacs-lisp-mode RET
@@ -2693,8 +2692,8 @@ will not be displayed multiple times if they would be included in
26932692
multiple filter groups; instead, the first filter group is used. The
26942693
filter groups are displayed in this order of precedence.
26952694
2696-
You may rearrange filter groups by using the regular
2697-
`\\[ibuffer-kill-line]' and `\\[ibuffer-yank]' pair. Yanked groups
2695+
You may rearrange filter groups by using the usual pair
2696+
`\\[ibuffer-kill-line]' and `\\[ibuffer-yank]'. Yanked groups
26982697
will be inserted before the group at point."
26992698
;; Include state info next to the mode name.
27002699
(set (make-local-variable 'mode-line-process)

src/lisp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2236,7 +2236,7 @@ INLINE int
22362236
}
22372237

22382238
/* Placeholder for make-docfile to process. The actual symbol
2239-
definition is done by lread.c's defsym. */
2239+
definition is done by lread.c's define_symbol. */
22402240
#define DEFSYM(sym, name) /* empty */
22412241

22422242

test/lisp/emacs-lisp/eieio-tests/eieio-tests.el

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,17 @@ Do not override for `prot-2'."
696696
(setq eitest-II3 (clone eitest-II2 "eitest-II3 Test."))
697697
(oset eitest-II3 slot3 'penguin)
698698

699+
;; Test that slots are non-initialized slots are unbounded
700+
(oref eitest-II2 slot1)
701+
(should (slot-boundp eitest-II2 'slot1))
702+
(should-not (slot-boundp eitest-II2 'slot2))
703+
(should-not (slot-boundp eitest-II2 'slot3))
704+
(should-not (slot-boundp eitest-II3 'slot2))
705+
(should-not (slot-boundp eitest-II3 'slot1))
706+
(should-not (slot-boundp eitest-II3 'slot2))
707+
(should (eieio-instance-inheritor-slot-boundp eitest-II3 'slot2))
708+
(should (slot-boundp eitest-II3 'slot3))
709+
699710
;; Test level 1 inheritance
700711
(should (eq (oref eitest-II3 slot1) 'moose))
701712
;; Test level 2 inheritance
@@ -862,8 +873,7 @@ Subclasses to override slot attributes.")
862873
(should (oref obj1 a-slot))))
863874

864875
(defclass NAMED (eieio-named)
865-
((some-slot :initform nil)
866-
)
876+
((some-slot :initform nil))
867877
"A class inheriting from eieio-named.")
868878

869879
(ert-deftest eieio-test-35-named-object ()
@@ -902,6 +912,48 @@ Subclasses to override slot attributes.")
902912
(should
903913
(fboundp 'eieio--defalias)))
904914

915+
(ert-deftest eieio-test-38-clone-named-object ()
916+
(let* ((A (NAMED :object-name "aa"))
917+
(B (clone A :object-name "bb"))
918+
(C (clone A "cc"))
919+
(D (clone A))
920+
(E (clone D)))
921+
(should (string= "aa" (oref A object-name)))
922+
(should (string= "bb" (oref B object-name)))
923+
(should (string= "cc" (oref C object-name)))
924+
(should (string= "aa-1" (oref D object-name)))
925+
(should (string= "aa-2" (oref E object-name)))))
926+
927+
(defclass TII (eieio-instance-inheritor)
928+
((a :initform 1 :initarg :a)
929+
(b :initarg :b)
930+
(c :initarg :c))
931+
"Instance Inheritor test class.")
932+
933+
(ert-deftest eieio-test-39-clone-instance-inheritor-with-args ()
934+
(let* ((A (TII))
935+
(B (clone A :b "bb"))
936+
(C (clone B :a "aa")))
937+
938+
(should (string= "aa" (oref C :a)))
939+
(should (string= "bb" (oref C :b)))
940+
941+
(should (slot-boundp A :a))
942+
(should-not (slot-boundp A :b))
943+
(should-not (slot-boundp A :c))
944+
945+
(should-not (slot-boundp B :a))
946+
(should (slot-boundp B :b))
947+
(should-not (slot-boundp A :c))
948+
949+
(should (slot-boundp C :a))
950+
(should-not (slot-boundp C :b))
951+
(should-not (slot-boundp C :c))
952+
953+
(should (eieio-instance-inheritor-slot-boundp C :a))
954+
(should (eieio-instance-inheritor-slot-boundp C :b))
955+
(should-not (eieio-instance-inheritor-slot-boundp C :c))))
956+
905957

906958
(provide 'eieio-tests)
907959

0 commit comments

Comments
 (0)