Skip to content

Commit 389be23

Browse files
committed
bugfix release 0.2.1
1 parent f4bc923 commit 389be23

12 files changed

+1844
-1787
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,6 @@ flycheck_*.el
4747
#in development
4848
csound-interaction.el
4949
releases
50+
51+
#clj
52+
.nrepl-port

CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## [0.2.1]
4+
### Minor Changes
5+
- bytecode compilation errors fixed
6+
- non-rainbow score syntax highlight improved
7+
- minidocs and syopsis updated
8+
- requiring highligh for missing hlt-highlight symbols
9+
- new flash colors
10+
311
## [0.2.0]
412
### Major Changes
513
- Csound API Removed in favour of UDP (requires Csound 6.10+)
@@ -10,7 +18,7 @@
1018
- Repl: +/. in p2 score snippets supported
1119
- Repl: + in p3 score snippet supported
1220
- Score: `csound-score--align-cols` improved to decrease col width as well
13-
- Indentation: `csound-indentation-aggressive-score` customizeable variable added
21+
- Indentation: `csound-indentation-aggressive-score` customizeable variable added
1422
- Font-lock: Bug causing slower font-locking fixed
1523
- Keybinding `C-c C-c` added for region evaluation
1624
- Repl: Newline in the prompt supported via <Ctrl-Return>

csound-eldoc.el

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
;; Copyright (C) 2017 Hlöðver Sigurðsson
33

44
;; Author: Hlöðver Sigurðsson <hlolli@gmail.com>
5-
;; Version: 0.2.0
6-
;; Package-Requires: ((emacs "25") (shut-up "0.3.2") (multi "2.0.1"))
5+
;; Version: 0.2.1
6+
;; Package-Requires: ((emacs "25") (shut-up "0.3.2") (multi "2.0.1") (highlight "0"))
77
;; URL: https://github.com/hlolli/csound-mode
88

99
;; This program is free software; you can redistribute it and/or modify
@@ -28,6 +28,7 @@
2828

2929
(require 'csound-opcodes)
3030
(require 'csound-util)
31+
(require 'cl-lib)
3132

3233
(defun csound-eldoc-get-template (opcode-list)
3334
(let ((templ nil)
@@ -55,13 +56,11 @@
5556
(line-beginning-position countback)
5657
(csound-util-line-boundry)))))
5758

58-
5959
(defun csound-eldoc-statement-list (string-statement)
6060
(split-string
6161
(csound-util-untab (csound-util-chomp string-statement))
6262
"\\(,+\s*\\)+\\|\\(\s+,*\\)+"))
6363

64-
6564
(defun csound-eldoc-template-lookup (statement-list)
6665
(let ((result nil)
6766
(opdoce nil)
@@ -80,11 +79,11 @@
8079
(save-excursion (progn (setq cand (thing-at-point 'symbol (search-backward-regexp "(" (line-beginning-position) t 1)))
8180
(when (= 1 (length cand))
8281
(setq rate-cand cand))
83-
(while (or (and (not cand)
82+
(while (or (and (not cand)
8483
(not (eq (point) (line-beginning-position))))
8584
(= 1 (length cand)))
8685
(setq cand (thing-at-point 'symbol))
87-
(backward-char))
86+
(backward-char))
8887
(when (gethash cand csdoc-opcode-database)
8988
(setq result (csound-eldoc-get-template
9089
(gethash cand csdoc-opcode-database))
@@ -148,8 +147,8 @@
148147

149148
;;;###autoload
150149
(defun csound-eldoc-function ()
151-
"Returns a doc string appropriate for the current context, or nil."
152-
(let* ((csound-statement (csound-eldoc-statement))
150+
"Returns a doc string appropriate for the current context, or nil."
151+
(let* ((csound-statement (csound-eldoc-statement))
153152
(statement-list (csound-eldoc-statement-list csound-statement))
154153
(template-lookup (csound-eldoc-template-lookup statement-list)))
155154
(when template-lookup
@@ -160,11 +159,11 @@
160159
(replace-regexp-in-string
161160
"\\[, " "["
162161
(nth 1 template-lookup))))
163-
(template-list (csound-eldoc-statement-list csound-template))
162+
(template-list (csound-eldoc-statement-list csound-template))
164163
(template-list-length (1- (length template-list)))
165164
(opcode-index (csound-eldoc-opcode-index opcode-match template-list))
166165
(template-list (if (nth 2 template-lookup)
167-
(subseq template-list opcode-index)
166+
(cl-subseq template-list opcode-index)
168167
template-list))
169168
(argument-index (csound-eldoc-argument-index opcode-match opcode-index point-on-opcode?))
170169
(infinite-args? (string= "[...]" (car (last template-list))))
@@ -173,7 +172,7 @@
173172
(eldocstr "")
174173
(inf-arg nil))
175174
(dolist (arg template-list)
176-
(setq
175+
(setq
177176
inf-arg (if (and infinite-args?
178177
(< template-list-length argument-index))
179178
t nil)
@@ -203,7 +202,7 @@
203202
(if (> 0 indx)
204203
(1- indx)
205204
(1+ indx))))
206-
list-index (1+ list-index)))
205+
list-index (1+ list-index)))
207206
eldocstr))))
208207

209208

csound-font-lock.el

Lines changed: 46 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
;; Copyright (C) 2017 Hlöðver Sigurðsson
33

44
;; Author: Hlöðver Sigurðsson <hlolli@gmail.com>
5-
;; Version: 0.2.0
6-
;; Package-Requires: ((emacs "25") (shut-up "0.3.2") (multi "2.0.1"))
5+
;; Version: 0.2.1
6+
;; Package-Requires: ((emacs "25") (shut-up "0.3.2") (multi "2.0.1") (highlight "0"))
77
;; URL: https://github.com/hlolli/csound-mode
88

99
;; This program is free software; you can redistribute it and/or modify
@@ -31,20 +31,21 @@
3131

3232
(defvar csound-font-lock--missing-faces '())
3333

34-
(defcustom csound-font-lock-rainbow-score-parameters-p t
34+
(defcustom csound-font-lock-rainbow-score-parameters-p nil
3535
"Color each parameter field for
3636
not events within CsScore/.sco"
3737
:type 'boolean
3838
:group 'csound-mode-font-lock)
3939

4040
(defface csound-font-lock-eval-flash
41-
'((((class color)) (:background "#0AD600" :foreground "white" :bold t))
41+
'((((class color) (background light)) (:foreground "#999601" :background "#42ff42"))
42+
(((class color) (background dark)) (:background "#637863" :foreground "#00e4f0"))
4243
(t (:inverse-video t)))
4344
"Face for highlighting during evaluation."
4445
:group 'csound-mode-font-lock)
4546

4647
(defface csound-font-lock-eval-flash-error
47-
'((((class color)) (:foreground "#D60000" :bold t))
48+
'((((class color)) (:foreground "#5e0d0d" :bold t))
4849
(t (:inverse-video t)))
4950
"Face for highlighting signaled errors during evaluation."
5051
:group 'csound-mode-font-lock)
@@ -162,14 +163,15 @@
162163
csound-font-lock-strings
163164
csound-font-lock-xml-tags))
164165

166+
;;;###autoload
165167
(defvar csound-font-lock-list '())
166168

167169
(defconst csound-font-lock-keywords
168170
(ignore-errors
169171
(eval-when-compile
170172
;; Regex for i-rates
171173
(push '("\\<i+\\w*" . csound-font-lock-i-rate) csound-font-lock-list)
172-
174+
173175
;; Regex for global i-rates
174176
(push '("\\<\\(gi\\)+\\w*" . csound-font-lock-global-i-rate) csound-font-lock-list)
175177

@@ -209,7 +211,7 @@
209211
;; Regex for csound macros types
210212
(push '("\\#\\w*\\|\\$\\w*" . csound-font-lock-macros) csound-font-lock-list)
211213

212-
;; Regex for csound string types (use syntactic fontification?)
214+
;; Regex for csound string types (use syntactic fontification?)
213215
;; (push '("\\s\"\\(.*?\\)[^\\]\\s\"" . csound-font-lock-strings) csound-font-lock-list)
214216

215217
;; Regex for core csound xml tags
@@ -268,16 +270,11 @@
268270
"-face")))
269271

270272
(defun csound-font-lock--fontify-score (beg end)
271-
(let ((backward-search-limit (if (string-match-p ".sco$" (buffer-name (current-buffer)))
272-
0
273-
(save-excursion
274-
(end-of-buffer)
275-
(or (search-backward "<CsScore" nil t 1) 0))))
276-
;; (score-end-line-num (or (search-forward "</CsScore" nil t 1) (line-number-at-pos (point-max))))
277-
(beg-line-num (line-number-at-pos beg))
278-
(end-line-num (1+ (line-number-at-pos end))))
273+
(let ((beg-line-num (line-number-at-pos beg))
274+
(end-line-num (min (line-number-at-pos (max-char))
275+
(+ 2 (line-number-at-pos end)))))
279276
(save-excursion
280-
(goto-line beg-line-num)
277+
(beginning-of-line)
281278
(while (< (line-number-at-pos) end-line-num)
282279
(let* ((beg-word nil)
283280
(end-word nil)
@@ -306,61 +303,60 @@
306303
(setq depth (1+ depth)))
307304
;; If passed i marker
308305
(progn
309-
;; (message "line: %d" (line-number-at-pos))
310-
(setq beg-word (min (1- (or (save-excursion (search-forward-regexp "[-?0-9a-zA-Z\\[\\.\\+\\<\\>\"]" (line-end-position) t 1))
306+
(setq beg-word (min (1- (or (save-excursion (search-forward-regexp "[-?0-9a-zA-Z\\[\\.\\+\\<\\>\"]" (line-end-position) t 1))
311307
(line-end-position))))
312308
end-word (save-excursion
313309
(goto-char beg-word)
314310
(let ((e (search-forward-regexp "\\s-\\|$" (line-end-position))))
315311
(if (< e end-line)
316312
e end-line))))
317-
;; (message "beg: %d end: %d" beg-word end-word)
318313
(goto-char end-word)
319-
;; (add-text-properties beg-word end-word `(face ,(funcall #'csound-font-lock-param-delimiters-default-pick-face depth)))
320314
(font-lock-prepend-text-property beg-word end-word 'face (funcall #'csound-font-lock-param-delimiters-default-pick-face depth))
321315
(setq depth (1+ depth)))))))
322-
(next-line)))))
316+
(forward-line)))))
323317

324318
(defun csound-font-lock-fontify-region (beg end &optional loud)
325-
(shut-up
326-
(save-excursion
327-
(let ((within-score-p (or (save-excursion (search-backward "<CsScore" nil t 1))
328-
(string-match-p ".sco$" (buffer-name (current-buffer)))))
329-
(score-boundry (if (string-match-p ".sco$" (buffer-name (current-buffer)))
330-
0
331-
(or (save-excursion (beginning-of-buffer)
332-
(search-forward-regexp "<CsScore" end t 1))
333-
0)))
334-
(orchestra-boundry (if (or (string-match-p ".orc$" (buffer-name (current-buffer)))
335-
(string-match-p ".udo$" (buffer-name (current-buffer))))
336-
(buffer-size)
337-
(or (save-excursion (beginning-of-buffer)
338-
(search-forward-regexp "</CsInstruments>" end t 1))
339-
(buffer-size)))))
340-
(if (and within-score-p csound-font-lock-rainbow-score-parameters-p)
341-
(csound-font-lock--fontify-score (max score-boundry beg) end)
342-
;; All normal font-lock calls
343-
(let ((end-line (line-number-at-pos (min end orchestra-boundry))))
344-
(goto-char beg)
345-
(beginning-of-line)
346-
(while (< (line-number-at-pos) (1+ end-line))
347-
(save-excursion
348-
(font-lock-default-fontify-region (line-beginning-position) (line-end-position) nil))
349-
(next-line))))))))
319+
(save-excursion
320+
(let ((within-score-p (or (save-excursion (search-backward "<CsScore" nil t 1))
321+
(string-match-p ".sco$" (buffer-name (current-buffer)))))
322+
(score-boundry (if (string-match-p ".sco$" (buffer-name (current-buffer)))
323+
(max-char)
324+
(or (save-excursion (goto-char (point-min))
325+
(search-forward-regexp "<CsScore" nil t 1))
326+
nil)))
327+
(orchestra-boundry (if (or (string-match-p ".orc$" (buffer-name (current-buffer)))
328+
(string-match-p ".udo$" (buffer-name (current-buffer))))
329+
(buffer-size)
330+
(or (save-excursion (goto-char (point-min))
331+
(search-forward-regexp "</CsInstruments>" end t 1))
332+
(buffer-size)))))
333+
(if (and within-score-p score-boundry csound-font-lock-rainbow-score-parameters-p)
334+
(csound-font-lock--fontify-score (max score-boundry beg) (min end (max-char)))
335+
;; All normal font-lock calls, but let's keep rainbow delimited fonts untouched
336+
(let ((end-line (1- (line-number-at-pos (min end (point-max)))))
337+
(end-line (if (and score-boundry csound-font-lock-rainbow-score-parameters-p)
338+
(line-number-at-pos score-boundry)
339+
end-line)))
340+
(goto-char beg)
341+
(beginning-of-line)
342+
(while (< (line-number-at-pos) (1+ end-line))
343+
(save-excursion
344+
(font-lock-default-fontify-region (line-beginning-position) (line-end-position) nil))
345+
(forward-line)))))))
350346

351347
(defun csound-font-lock--flush-buffer ()
352348
(save-excursion
353-
(end-of-buffer)
349+
(goto-char (point-max))
354350
(let ((line-count (line-number-at-pos)))
355-
(beginning-of-buffer)
351+
(goto-char (point-min))
356352
(while (< (line-number-at-pos) line-count)
357353
(save-excursion (font-lock-default-fontify-region (line-beginning-position) (line-end-position) nil))
358-
(next-line)))))
354+
(forward-line)))))
359355

360356
(defun csound-font-lock--flush-score ()
361357
(when csound-font-lock-rainbow-score-parameters-p
362358
(save-excursion
363-
(beginning-of-buffer)
359+
(goto-char (point-min))
364360
(let ((score-beg (if (string-match-p ".sco$" (buffer-name (current-buffer)))
365361
0
366362
(save-excursion (search-forward "<CsScore" nil t 1))))

csound-indentation.el

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
;; Copyright (C) 2017 Hlöðver Sigurðsson
44

55
;; Author: Hlöðver Sigurðsson <hlolli@gmail.com>
6-
;; Version: 0.2.0
7-
;; Package-Requires: ((emacs "25") (shut-up "0.3.2") (multi "2.0.1"))
6+
;; Version: 0.2.1
7+
;; Package-Requires: ((emacs "25") (shut-up "0.3.2") (multi "2.0.1") (highlight "0"))
88
;; URL: https://github.com/hlolli/csound-mode
99

1010
;; This program is free software; you can redistribute it and/or modify
@@ -247,7 +247,7 @@
247247
(defun csound-indentation--for-each-line (start end fn)
248248
(while (< (point) end)
249249
(funcall fn)
250-
(next-line)))
250+
(forward-line)))
251251

252252
(defun csound-indentation-line ()
253253
"Indent current line."

csound-mode.el

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
;; Copyright (C) 2017 Hlöðver Sigurðsson
33

44
;; Author: Hlöðver Sigurðsson <hlolli@gmail.com>
5-
;; Version: 0.2.0
6-
;; Package-Requires: ((emacs "25") (shut-up "0.3.2") (multi "2.0.1"))
5+
;; Version: 0.2.1
6+
;; Package-Requires: ((emacs "25") (shut-up "0.3.2") (multi "2.0.1") (highlight "0"))
77
;; URL: https://github.com/hlolli/csound-mode
88

99
;; This program is free software; you can redistribute it and/or modify
@@ -29,7 +29,7 @@
2929

3030

3131
(require 'font-lock)
32-
(require 'cl)
32+
(require 'cl-lib)
3333
(require 'csound-eldoc)
3434
(require 'csound-font-lock)
3535
(require 'csound-repl)
@@ -106,9 +106,9 @@
106106
(if (and csound-repl-start-server-p
107107
(not (executable-find "csound")))
108108
(error "Csound is not installed on your computer")
109-
(csound-repl--buffer-create))
109+
(csound-repl--buffer-create)))
110110

111-
(defvar csound-mode-map nil))
111+
(defvar csound-mode-map nil)
112112

113113
(setq csound-mode-map
114114
(let ((map (make-sparse-keymap)))

0 commit comments

Comments
 (0)