@@ -60,7 +60,7 @@ The expressions are joined as alternatives with the \\| operator."
60
60
(defconst sclang-method-name-special-regexp
61
61
(concat
62
62
" [" (regexp-quote sclang-method-name-special-chars) " ]+" )
63
- " Regular expression matching method names composed of special characters." )
63
+ " Regular expression matching method names composed of special characters." )
64
64
65
65
(defconst sclang-method-name-regexp
66
66
(sclang-regexp-concat
@@ -102,10 +102,10 @@ A block is enclosed by parentheses where the opening parenthesis must
102
102
be at the beginning of a line to avoid ambiguities." )
103
103
104
104
(defconst sclang-beginning-of-defun-regexp
105
- (sclang-regexp-concat
106
- sclang-class-definition-regexp
107
- sclang-block-regexp)
108
- " Regular expression matching the beginning of defuns.
105
+ (sclang-regexp-concat
106
+ sclang-class-definition-regexp
107
+ sclang-block-regexp)
108
+ " Regular expression matching the beginning of defuns.
109
109
110
110
The match is either the start of a class definition
111
111
\( `sclang-class-definition-regexp' ) or the beginning of a code block
@@ -251,12 +251,12 @@ low-resource systems."
251
251
(defun sclang-read-symbol (prompt &optional default predicate require-match inherit-input-method )
252
252
(if sclang-use-symbol-table
253
253
(cl-flet ((make-minibuffer-local-map
254
- (parent-keymap)
255
- (let ((map (make-sparse-keymap )))
256
- (set-keymap-parent map parent-keymap)
257
- ; ; override keys bound to valid symbols
258
- (define-key map [?? ] 'self-insert-command )
259
- map)))
254
+ (parent-keymap)
255
+ (let ((map (make-sparse-keymap )))
256
+ (set-keymap-parent map parent-keymap)
257
+ ; ; override keys bound to valid symbols
258
+ (define-key map [?? ] 'self-insert-command )
259
+ map)))
260
260
(let ((symbol (sclang-get-symbol default ))
261
261
(minibuffer-local-completion-map (make-minibuffer-local-map
262
262
minibuffer-local-completion-map))
@@ -457,9 +457,10 @@ are considered."
457
457
" Function used for `completion-at-point-functions' in `sclang-mode' ."
458
458
(let* ((end (point ))
459
459
(beg (save-excursion
460
- (backward-sexp 1 )
461
- (skip-syntax-forward " '" )
462
- (point )))
460
+ (or (ignore-errors (backward-sexp 1 )
461
+ (skip-syntax-forward " '" )
462
+ (point ))
463
+ (point ))))
463
464
(pattern (buffer-substring-no-properties beg end))
464
465
(case-fold-search nil )
465
466
(predicate (if (sclang-class-name-p pattern)
@@ -770,45 +771,45 @@ Looks for all repetitive patterns in ITEMS recursively. Therefore, it is
770
771
computationally expensive, especially when ITEMS is a long list. If you don't
771
772
want smart pattern guessing, use `sclang-format' directly to format your Pseq."
772
773
(cl-labels ((find-reps (items)
773
- (let (r)
774
- (while items
775
- (let ((ret (car items))
776
- (skip 1 )
777
- (rep (length items)))
778
- (catch 'match-found
779
- (while (>= rep 2 )
780
- (let ((i (/ (length items) rep)))
781
- (while (> i 0 )
782
- (let ((sublst (cl-subseq items 0 i)))
783
- (when (catch 'equal
784
- (let ((a items))
785
- (cl-loop repeat rep do
786
- (let ((b sublst))
787
- (while b
788
- (unless (eql (car b) (car a))
789
- (throw 'equal nil ))
790
- (setq a (cdr a)
791
- b (cdr b)))))
792
- t ))
793
- (setq ret (cons rep (if (> i 5 )
794
- (find-reps sublst)
795
- sublst))
796
- skip (* i rep))
797
- (throw 'match-found t ))
798
- (cl-decf i))))
799
- (cl-decf rep)))
800
- (accept-process-output nil 0 100 )
801
- (message " Processed...%S " ret) ; ; invent better progress info
802
- (setq r (append r (list ret))
803
- items (nthcdr skip items))))
804
- r))
774
+ (let (r)
775
+ (while items
776
+ (let ((ret (car items))
777
+ (skip 1 )
778
+ (rep (length items)))
779
+ (catch 'match-found
780
+ (while (>= rep 2 )
781
+ (let ((i (/ (length items) rep)))
782
+ (while (> i 0 )
783
+ (let ((sublst (cl-subseq items 0 i)))
784
+ (when (catch 'equal
785
+ (let ((a items))
786
+ (cl-loop repeat rep do
787
+ (let ((b sublst))
788
+ (while b
789
+ (unless (eql (car b) (car a))
790
+ (throw 'equal nil ))
791
+ (setq a (cdr a)
792
+ b (cdr b)))))
793
+ t ))
794
+ (setq ret (cons rep (if (> i 5 )
795
+ (find-reps sublst)
796
+ sublst))
797
+ skip (* i rep))
798
+ (throw 'match-found t ))
799
+ (cl-decf i))))
800
+ (cl-decf rep)))
801
+ (accept-process-output nil 0 100 )
802
+ (message " Processed...%S " ret) ; ; invent better progress info
803
+ (setq r (append r (list ret))
804
+ items (nthcdr skip items))))
805
+ r))
805
806
(elem-to-string (elem)
806
- (cond
807
- ((consp elem)
808
- (concat " Pseq([ "
809
- (mapconcat #'elem-to-string (cdr elem) " , " )
810
- (format " ], %d ) " (car elem))))
811
- (t (sclang-object-to-string elem)))))
807
+ (cond
808
+ ((consp elem)
809
+ (concat " Pseq([ "
810
+ (mapconcat #'elem-to-string (cdr elem) " , " )
811
+ (format " ], %d ) " (car elem))))
812
+ (t (sclang-object-to-string elem)))))
812
813
(let ((compressed (find-reps items)))
813
814
(if (and (= (length compressed) 1 ) (consp (car compressed)))
814
815
(elem-to-string (car compressed))
0 commit comments