[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/rudel d1e1c39: Replace some deprecated constructs with
From: |
Stefan Monnier |
Subject: |
[elpa] externals/rudel d1e1c39: Replace some deprecated constructs with their successors |
Date: |
Wed, 12 Sep 2018 17:36:31 -0400 (EDT) |
branch: externals/rudel
commit d1e1c399013fec5c4fb1f904872bc338a8fb146a
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>
Replace some deprecated constructs with their successors
* rudel-debug.el (rudel-join-session, rudel-host-session): Use nadvice.
(rudel-debug-write-to-stream, rudel-send): Avoid `object-print`.
(rudel-set-filter): Avoid `oset`.
* rudel-obby-state.el (rudel-accept, rudel-obby/obby_document):
* rudel-obby-client.el (rudel-obby/obby_document/record):
* rudel-infinote-group.el (rudel-accept): Avoid `object-print`.
* rudel-mode.el (global-rudel-header-subscriptions-mode): Use the
mode-hook rather than an advice.
* rudel.el: Require cl-print.
---
rudel-debug.el | 27 ++++++++------------
rudel-infinote-group.el | 4 +--
rudel-mode.el | 65 +++++++++++++++++++++++++------------------------
rudel-obby-client.el | 4 +--
rudel-obby-state.el | 6 ++---
rudel.el | 4 +--
6 files changed, 52 insertions(+), 58 deletions(-)
diff --git a/rudel-debug.el b/rudel-debug.el
index 396bfaa..6c1fd63 100644
--- a/rudel-debug.el
+++ b/rudel-debug.el
@@ -1,6 +1,6 @@
;;; rudel-debug.el --- Debugging functions for Rudel -*- lexical-binding:t -*-
;;
-;; Copyright (C) 2009, 2010, 2014, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
;;
;; Author: Jan Moringen <address@hidden>
;; Keywords: rudel, debugging
@@ -43,7 +43,7 @@
(require 'eieio)
(require 'data-debug)
(require 'eieio-datadebug)
-
+(require 'rudel)
(require 'rudel-util)
(require 'rudel-state-machine)
(require 'rudel-transport-util)
@@ -119,15 +119,15 @@
;;; Advice stuff
;;
-(defadvice rudel-join-session (after rudel-debug last activate)
+(advice-add 'rudel-join-session :after #'rudel--debug-join-session)
+(defun rudel--debug-join-session (&rest _)
"Run data-debug inspection on newly created session objects."
- (require 'rudel-debug)
(rudel-adebug-session))
-(defadvice rudel-host-session (after rudel-debug last activate)
+(advice-add 'rudel-host-session :around #'rudel--debug-host-session)
+(defun rudel--debug-host-session (orig-fun &rest args)
"Run data-debug inspection on newly created server objects."
- (require 'rudel-debug)
- (rudel-adebug-server ad-return-value))
+ (rudel-adebug-server (apply orig-fun args)))
;;; Network functions
@@ -202,10 +202,8 @@
(string (cond
((stringp data)
data)
- ((object-p data)
- (object-print data))
(t
- (prin1-to-string data)))))
+ (cl-prin1-to-string data)))))
(with-current-buffer buffer
(goto-char 0)
(insert prefix
@@ -355,12 +353,8 @@ TAG and LABEL determine the logging style."
(let ((formatted (cond
((stringp string-or-data)
string-or-data)
-
- ((object-p string-or-data)
- (object-print string-or-data))
-
(t
- (format "%s" string-or-data)))))
+ (cl-prin1-to-string string-or-data)))))
(rudel-debug-write
this
:sent
@@ -376,8 +370,7 @@ TAG and LABEL determine the logging style."
(cl-defmethod rudel-set-filter ((this rudel-socket-transport)
filter)
"Log DATA as it goes through THIS."
- (oset
- this :filter
+ (setf (slot-value this :filter)
(lambda (data)
(rudel-debug-write this :received "SOCKET" data)
(funcall filter data))))
diff --git a/rudel-infinote-group.el b/rudel-infinote-group.el
index 028c2a4..b59fee4 100644
--- a/rudel-infinote-group.el
+++ b/rudel-infinote-group.el
@@ -1,6 +1,6 @@
;;; rudel-infinote-group.el --- Common aspects of infinote communication
groups -*- lexical-binding:t -*-
;;
-;; Copyright (C) 2009, 2010, 2014, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
;;
;; Author: Jan Moringen <address@hidden>
;; Keywords: rudel, infinote, group, communication
@@ -111,7 +111,7 @@ domain: `%s', code: `%s'"
(display-warning
'(rudel infinote)
(format "%s: no method (%s: %s): `%s/%s'; arguments: %s"
- (object-print this) (car error) (cdr error)
+ (cl-prin1-to-string this) (car error) (cdr error)
"rudel-infinote" name arguments)
:warning)
nil)))))))
diff --git a/rudel-mode.el b/rudel-mode.el
index 7468423..e8816eb 100644
--- a/rudel-mode.el
+++ b/rudel-mode.el
@@ -1,6 +1,6 @@
;;; rudel-mode.el --- Global and buffer-local Rudel minor modes -*-
lexical-binding:t -*-
;;
-;; Copyright (C) 2008-2010, 2014, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
;;
;; Author: Jan Moringen <address@hidden>
;; Keywords: rudel, mode
@@ -320,38 +320,39 @@ subscriptions mode; otherwise, turn it off."
rudel-header-subscriptions-minor-mode
:group 'rudel)
-(defadvice global-rudel-header-subscriptions-mode
- (around track-subscriptions activate)
+;; FIXME: This should be part of global-rudel-header-subscriptions-mode
+;; rather than being relegated to a hook.
+(add-hook 'global-rudel-header-subscriptions-mode-hook
+ #'rudel--global-hsm-tracking)
+(defun rudel--global-hsm-tracking ()
"Start/stop tracking subscriptions when the mode is (de)activated."
- (let ((value ad-do-it))
- (if value
-
- ;; Add handlers to session start and end hooks and run the
- ;; start handler on already started sessions.
- (progn
-
- ;; Go through all existing sessions.
- (mapc #'rudel-header-subscriptions--session-start
- (when rudel-current-session
- (list rudel-current-session)))
-
- ;; Watch for new/ended sessions.
- (add-hook 'rudel-session-start-hook
- #'rudel-header-subscriptions--session-start)
- (add-hook 'rudel-session-end-hook
- #'rudel-header-subscriptions--session-end))
-
- ;; Remove handlers from session start and end hooks and run the
- ;; end handler on active sessions.
- (mapc #'rudel-header-subscriptions--session-end
- (when rudel-current-session
- (list rudel-current-session)))
-
- (remove-hook 'rudel-session-start-hook
- #'rudel-header-subscriptions--session-start)
- (remove-hook 'rudel-session-end-hook
- #'rudel-header-subscriptions--session-end)))
- )
+ (if global-rudel-header-subscriptions-mode
+
+ ;; Add handlers to session start and end hooks and run the
+ ;; start handler on already started sessions.
+ (progn
+
+ ;; Go through all existing sessions.
+ (mapc #'rudel-header-subscriptions--session-start
+ (when rudel-current-session
+ (list rudel-current-session)))
+
+ ;; Watch for new/ended sessions.
+ (add-hook 'rudel-session-start-hook
+ #'rudel-header-subscriptions--session-start)
+ (add-hook 'rudel-session-end-hook
+ #'rudel-header-subscriptions--session-end))
+
+ ;; Remove handlers from session start and end hooks and run the
+ ;; end handler on active sessions.
+ (mapc #'rudel-header-subscriptions--session-end
+ (when rudel-current-session
+ (list rudel-current-session)))
+
+ (remove-hook 'rudel-session-start-hook
+ #'rudel-header-subscriptions--session-start)
+ (remove-hook 'rudel-session-end-hook
+ #'rudel-header-subscriptions--session-end)))
;;; Mode line indication of buffer state
diff --git a/rudel-obby-client.el b/rudel-obby-client.el
index 07bfd2a..0049740 100644
--- a/rudel-obby-client.el
+++ b/rudel-obby-client.el
@@ -1,6 +1,6 @@
;;; rudel-obby-client.el --- Client functions of the Rudel obby backend -*-
lexical-binding:t -*-
;;
-;; Copyright (C) 2008-2011, 2014, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
;;
;; Author: Jan Moringen <address@hidden>
;; Keywords: Rudel, obby, backend, client
@@ -443,7 +443,7 @@ failure."))
(display-warning
'(rudel obby)
(format "%s: no method (%s: %s): `%s:%s'; arguments: %s"
- (object-print this) (car error) (cdr error)
+ (cl-prin1-to-string this) (car error) (cdr error)
"rudel-obby/obby_document/record/" action arguments)
:debug)
nil)))
diff --git a/rudel-obby-state.el b/rudel-obby-state.el
index ee42434..25ebfbc 100644
--- a/rudel-obby-state.el
+++ b/rudel-obby-state.el
@@ -1,6 +1,6 @@
;;; rudel-obby-state.el --- Base class for states used in the obby backend
-*- lexical-binding:t -*-
;;
-;; Copyright (C) 2009, 2010, 2014, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
;;
;; Author: Jan Moringen <address@hidden>
;; Keywords: rudel, obby, state machine
@@ -86,7 +86,7 @@ Display a warning if no such handler is found."
(display-warning
'(rudel obby)
(format "%s: no method (%s: %s): `%s/%s'; arguments: %s"
- (object-print this) (car error) (cdr error)
+ (cl-prin1-to-string this) (car error) (cdr error)
"rudel-obby" name arguments)
:debug)
nil))))
@@ -160,7 +160,7 @@ obby 'document' messages."
(display-warning
'(rudel obby)
(format "%s: no method (%s: %s): `%s/%s'; arguments: %s"
- (object-print this) (car error) (cdr error)
+ (cl-prin1-to-string this) (car error) (cdr error)
"rudel-obby/obby_document/" action arguments)
:debug)
nil)))
diff --git a/rudel.el b/rudel.el
index 56e7a5a..9fc3626 100644
--- a/rudel.el
+++ b/rudel.el
@@ -1,12 +1,12 @@
;;; rudel.el --- A collaborative editing framework for Emacs -*-
lexical-binding:t -*-
;;
-;; Copyright (C) 2008-2010, 2014, 2016 Free Software Foundation, Inc.
+;; Copyright (C) 2018 Free Software Foundation, Inc.
;;
;; Author: Jan Moringen <address@hidden>
;; Keywords: rudel, collaboration
;; Version: 0.3.1
;; URL: http://rudel.sourceforge.net/
-;; Package-Requires: ((emacs "24") (cl-lib "0.5") (cl-generic "0.3"))
+;; Package-Requires: ((emacs "24") (cl-lib "0.5") (cl-generic "0.3") (cl-print
"1.0"))
;; X-RCS: $Id:$
;;
;; This file is part of Rudel.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/rudel d1e1c39: Replace some deprecated constructs with their successors,
Stefan Monnier <=