]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid using registerv-make in senator.el
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 14 Jun 2019 14:51:27 +0000 (16:51 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 14 Jun 2019 14:51:27 +0000 (16:51 +0200)
* lisp/cedet/semantic/senator.el (senator-register): New class.
(register-val-jump-to, register-val-describe)
(register-val-insert): New methods.
(senator-copy-tag-to-register): Use this instead of the deprecated
registerv-make function.

lisp/calendar/cal-bahai.el
lisp/cedet/semantic/senator.el

index ec491ec782f6848f922af751d4afe657d050c3c4..8aa1eed4a5dade2246e23a0cd8a794ff415e6797 100644 (file)
@@ -313,7 +313,8 @@ Prefix argument ARG will make the entry nonmarking."
                         diary-bahai-entry-symbol
                         'calendar-bahai-from-absolute))
 
-(defvar date)
+(with-suppressed-warnings ((lexical date))
+  (defvar date))
 
 ;; To be called from diary-list-sexp-entries, where DATE is bound.
 ;;;###diary-autoload
index 2d858dd985128f6e0aed2250fdc94a0567afad47..ebe171a3a7a35680f1c0c08a9786a0e931f02c4a 100644 (file)
@@ -717,6 +717,22 @@ yanked to."
             (message "Use C-y to recover the yank the text of %s."
                      (semantic-tag-name ft))))))
 
+(cl-defstruct (senator-register
+               (:constructor nil)
+               (:constructor senator-make-register (foreign-tag)))
+  foreign-tag)
+
+(cl-defmethod register-val-jump-to ((data senator-register) _arg)
+  (let ((ft (senator-register-foreign-tag data)))
+    (switch-to-buffer (semantic-tag-buffer ft))
+    (goto-char (semantic-tag-start ft))))
+
+(cl-defmethod register-val-describe ((data senator-register) _verbose)
+  (cl-prin1-to-string (senator-register-foreign-tag data)))
+
+(cl-defmethod register-val-insert ((data senator-register))
+  (semantic-insert-foreign-tag (senator-register-foreign-tag data)))
+
 ;;;###autoload
 (defun senator-copy-tag-to-register (register &optional kill-flag)
   "Copy the current tag into REGISTER.
@@ -732,13 +748,7 @@ if available."
   (semantic-fetch-tags)
   (let ((ft (semantic-obtain-foreign-tag)))
     (when ft
-      (set-register
-       register (registerv-make
-                 ft
-                 :insert-func #'semantic-insert-foreign-tag
-                 :jump-func (lambda (v)
-                              (switch-to-buffer (semantic-tag-buffer v))
-                              (goto-char (semantic-tag-start v)))))
+      (set-register register (senator-make-register ft))
       (if kill-flag
           (kill-region (semantic-tag-start ft)
                        (semantic-tag-end ft))))))