Fix a number of overlooked obsolete aliases

For some reason, these slipped my attention.  Sorry about that.
Also:
* `nconc' is more efficient then `append' if destructive modification is not
  an issue.
* Emacs 26 actually deprecated `string-as-multibyte' in favour of
  `decode-coding-string' since the latter actually forces the user to
  specify an encoding.
This commit is contained in:
Mario Lang 2019-12-26 11:12:53 +01:00
parent 4ef3185647
commit e43da1aa99
4 changed files with 13 additions and 12 deletions

View file

@ -284,7 +284,7 @@ If EOB-P is non-nil, positions cursor at end of buffer."
(defun sclang-make-options () (defun sclang-make-options ()
(let ((default-directory "")) (let ((default-directory ""))
(append (nconc
(when (and sclang-runtime-directory (when (and sclang-runtime-directory
(file-directory-p sclang-runtime-directory)) (file-directory-p sclang-runtime-directory))
(list "-d" (expand-file-name sclang-runtime-directory))) (list "-d" (expand-file-name sclang-runtime-directory)))
@ -337,7 +337,7 @@ If EOB-P is non-nil, positions cursor at end of buffer."
(i 0)) (i 0))
(while (and (sclang-get-process) (while (and (sclang-get-process)
(< i tries)) (< i tries))
(incf i) (cl-incf i)
(sit-for 0.5)))) (sit-for 0.5))))
(sclang-kill) (sclang-kill)
(sclang-stop-command-process)) (sclang-stop-command-process))
@ -441,7 +441,7 @@ Change this if \"cat\" has a non-standard name or location."
(>= (length string) (>= (length string)
(setq end (+ 4 (sclang-string-to-int32 string))))) (setq end (+ 4 (sclang-string-to-int32 string)))))
(sclang-handle-command-result (sclang-handle-command-result
(read (string-as-multibyte (substring string 4 end)))) (read (decode-coding-string (substring string 4 end) 'utf-8)))
(setq string (substring string end)))) (setq string (substring string end))))
(setq sclang-command-process-previous string)) (setq sclang-command-process-previous string))
@ -590,7 +590,7 @@ if PRINT-P is non-nil. Return STRING if successful, otherwise nil."
(if (and (processp proc) (eq (process-status proc) 'run)) (if (and (processp proc) (eq (process-status proc) 'run))
(let ((time (current-time)) (tick 10000) elt) (let ((time (current-time)) (tick 10000) elt)
(sclang-perform-command 'evalSCLang string time) (sclang-perform-command 'evalSCLang string time)
(while (and (> (decf tick) 0) (while (and (> (cl-decf tick) 0)
(not (setq elt (assoc time sclang-eval-results)))) (not (setq elt (assoc time sclang-eval-results))))
(accept-process-output proc 0 100)) (accept-process-output proc 0 100))
(if elt (if elt

View file

@ -391,7 +391,7 @@ A defun may either be a class definition or a code block, see
`sclang-beginning-of-defun-regexp'." `sclang-beginning-of-defun-regexp'."
(save-excursion (save-excursion
(with-syntax-table sclang-mode-syntax-table (with-syntax-table sclang-mode-syntax-table
(multiple-value-bind (beg end) (sclang-point-in-defun-p) (cl-multiple-value-bind (beg end) (sclang-point-in-defun-p)
(and beg end (buffer-substring-no-properties beg end)))))) (and beg end (buffer-substring-no-properties beg end))))))
;; ===================================================================== ;; =====================================================================

View file

@ -535,7 +535,7 @@ Returns the column to indent to."
(sclang-set-command-handler (sclang-set-command-handler
'_documentOpen '_documentOpen
(lambda (arg) (lambda (arg)
(multiple-value-bind (file-name region-start region-length) arg (cl-multiple-value-bind (file-name region-start region-length) arg
(let ((buffer (get-file-buffer file-name))) (let ((buffer (get-file-buffer file-name)))
(unless buffer (unless buffer
(setf buffer (find-file-noselect file-name))) (setf buffer (find-file-noselect file-name)))
@ -549,7 +549,7 @@ Returns the column to indent to."
(sclang-set-command-handler (sclang-set-command-handler
'_documentNew '_documentNew
(lambda (arg) (lambda (arg)
(multiple-value-bind (name str make-listener) arg (cl-multiple-value-bind (name str make-listener) arg
(let ((buffer (generate-new-buffer name))) (let ((buffer (generate-new-buffer name)))
(with-current-buffer buffer (with-current-buffer buffer
(insert str) (insert str)
@ -567,7 +567,7 @@ Returns the column to indent to."
(sclang-set-command-handler (sclang-set-command-handler
'_documentRename '_documentRename
(lambda (arg) (lambda (arg)
(multiple-value-bind (id name) arg (cl-multiple-value-bind (id name) arg
(when (stringp name) (when (stringp name)
(let ((doc (and (integerp id) (sclang-get-document id)))) (let ((doc (and (integerp id) (sclang-get-document id))))
(when doc (when doc
@ -579,7 +579,7 @@ Returns the column to indent to."
(sclang-set-command-handler (sclang-set-command-handler
'_documentSetEditable '_documentSetEditable
(lambda (arg) (lambda (arg)
(multiple-value-bind (id flag) arg (cl-multiple-value-bind (id flag) arg
(let ((doc (and (integerp id) (sclang-get-document id)))) (let ((doc (and (integerp id) (sclang-get-document id))))
(when doc (when doc
(with-current-buffer doc (with-current-buffer doc
@ -597,7 +597,7 @@ Returns the column to indent to."
(sclang-set-command-handler (sclang-set-command-handler
'_documentPutString '_documentPutString
(lambda (arg) (lambda (arg)
(multiple-value-bind (id str) arg (cl-multiple-value-bind (id str) arg
(let ((doc (and (integerp id) (sclang-get-document id)))) (let ((doc (and (integerp id) (sclang-get-document id))))
(when doc (when doc
(with-current-buffer doc (with-current-buffer doc

View file

@ -26,6 +26,7 @@
;;; Code: ;;; Code:
(require 'cl-lib)
(eval-when-compile (require 'sclang-util) (eval-when-compile (require 'sclang-util)
(require 'sclang-language)) (require 'sclang-language))
(eval-and-compile (require 'sclang-interp)) (eval-and-compile (require 'sclang-interp))
@ -76,9 +77,9 @@
(sclang-set-command-handler (sclang-set-command-handler
'_widgetSetStates '_widgetSetStates
(lambda (arg) (lambda (arg)
(multiple-value-bind (buffer id states value) arg (cl-multiple-value-bind (buffer id states value) arg
(with-current-buffer (get-buffer buffer) (with-current-buffer (get-buffer buffer)
(let ((widget (cdr (find id sclang-widgets :key 'car)))) (let ((widget (cdr (cl-find id sclang-widgets :key 'car))))
(widget-put widget :states states) (widget-put widget :states states)
(widget-value-set widget value) (widget-value-set widget value)
value))))) value)))))