Changeset b8d197 in git


Ignore:
Timestamp:
Jul 15, 1999, 9:03:09 AM (24 years ago)
Author:
Tim Wichmann <wichmann@…>
Branches:
(u'spielwiese', '828514cf6e480e4bafc26df99217bf2a1ed1ef45')
Children:
457bd7daf379c8a6dd5fa01fc2193ed676a5f9f3
Parents:
6652179b387ece88868cec40491432e4e627d7fc
Message:
	* singular.el: Added function singular-dynamic-complete
	Added new variable singular-completion-addsuffix
	Added define key for singular-dynamic-complete
	Remark: Loading of completion-files not ready!

	* singular.el: font-lock-levels extended to 3 levels
	Removed font-lock error in prompt fontifying
	Removed font-lock error in keywords fontifying


git-svn-id: file:///usr/local/Singular/svn/trunk@3274 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • emacs/singular.el

    r665217 rb8d197  
    11;;; singular.el --- Emacs support for Computer Algebra System Singular
    22
    3 ;; $Id: singular.el,v 1.27 1999-07-02 13:45:24 obachman Exp $
     3;; $Id: singular.el,v 1.28 1999-07-15 07:03:09 wichmann Exp $
    44
    55;;; Commentary:
     
    216216;              "ring" "string" "vector"))
    217217
    218 (defvar singular-font-lock-keywords-0
     218(defvar singular-font-lock-keywords-1
    219219  '(
    220     ("^\\(> \\|. \\)" . font-lock-singular-prompt-face)
     220    ("^\\(> \\|\\. \\)" . font-lock-singular-prompt-face)
    221221    ("^   [\\?].*" 0 font-lock-singular-error-face t)
    222222    ("^// \\(\\*\\*.*\\)" 1 font-lock-singular-warn-face t)
     
    224224  "Subdued level for highlighting in singular-(interactive)-mode")
    225225
    226 (defvar singular-font-lock-keywords-1
    227   '(
    228     ("\\<def\\|i\\(deal\\|nt\\(\\|mat\\|vec\\)\\)\\|li\\(nk\\|st\\)\\|m\\(a\\(p\\|trix\\)\\|odule\\)\\|number\\|p\\(oly\\|roc\\)\\|qring\\|r\\(esolution\\|ing\\)\\|string\\|vector\\>" . font-lock-type-face)
    229     ("^\\(> \\|. \\)" . font-lock-singular-prompt-face)
    230     ("^   [\\?].*" 0 font-lock-singular-error-face t)
    231     ("^// \\(\\*\\*.*\\)" 1 font-lock-singular-warn-face t)
    232     )
    233   "Subdued level for highlighting in singular-(interactive)-mode")
    234 
    235 (defvar singular-font-lock-keywords-2
     226(defvar singular-font-lock-keywords-2
    236227  (append
    237228   singular-font-lock-keywords-1
     229   '(
     230     ("\\<\\(def\\|i\\(deal\\|nt\\(\\|mat\\|vec\\)\\)\\|li\\(nk\\|st\\)\\|m\\(a\\(p\\|trix\\)\\|odule\\)\\|number\\|p\\(oly\\|roc\\)\\|qring\\|r\\(esolution\\|ing\\)\\|string\\|vector\\)\\>" . font-lock-type-face)
     231     ))
     232  "Medium level for highlighting in singular-(interactive)-mode")
     233
     234(defvar singular-font-lock-keywords-3
     235  (append
     236   singular-font-lock-keywords-2
    238237   '(
    239238     ("^   [\\?].*`\\(\\sw\\sw+\\)`" 1 font-lock-reference-name-face t)
     
    242241  "Gaudy level for highlihgting in singular-(interactive)-mode")
    243242
    244 (defvar singular-font-lock-keywords singular-font-lock-keywords-0
     243(defvar singular-font-lock-keywords singular-font-lock-keywords-1
    245244  "Default highlighting for singular-(interactive)-mode")
    246245
    247246(defvar singular-font-lock-defaults
    248247  '((singular-font-lock-keywords
    249      singular-font-lock-keywords-0
    250      singular-font-lock-keywords-0)
     248     singular-font-lock-keywords-1 singular-font-lock-keywords-2
     249     singular-font-lock-keywords-3)
    251250    nil                   ;; KEYWORDS-ONLY
    252251    nil                   ;; CASE-FOLD (ignore case when non-nil)
     
    262261       singular-font-lock-defaults)))
    263262;;}}}
     263
    264264;;}}}
    265265
    266266;;{{{ Singular interactive mode
     267
    267268;;{{{ Key map and menus
    268269(defvar singular-interactive-mode-map ()
     
    283284                     'singular-interactive-mode-map)))
    284285  (define-key singular-interactive-mode-map "\C-m" 'singular-send-or-copy-input)
     286  (define-key singular-interactive-mode-map "\t" 'singular-dynamic-complete)
    285287  (define-key singular-interactive-mode-map "\C-c\C-f" 'singular-load-file)
    286288  (define-key singular-interactive-mode-map "\C-c\C-l" 'singular-load-library)
     
    381383      (add-submenu nil
    382384                   singular-start-menu-definition))))
     385;;}}}
    383386
    384387;;{{{ Syntax table
     
    551554
    552555This variable is used to initialize `comint-input-filter' when
     556Singular interactive mode starts up.")
     557
     558(defvar singular-completion-addsuffix '("/" . "")
     559  "*Specifies suffixes to be added on completed file names and directories.
     560If a cons pair, it should be of the form (DIRSUFFIX . FILESUFFIX) where
     561DIRSUFFIX and FILESUFFIX are strings added on unambiguous or exact completion.
     562If non-nil, add a `/' to completed directories, ` ' to file names.
     563This mirrors the optional behavior of tcsh.
     564
     565This variable is used to initialize `comint-completion-addsuffix' when
    553566Singular interactive mode starts up.")
    554567;;}}}
     
    18671880;;}}}
    18681881
     1882;;{{{ Filename, Command, and Help Completion
     1883;; NOT READY
     1884;; how to find and load the completion files?
     1885(load-file "cmd-cmpl.el")
     1886(load-file "hlp-cmpl.el")
     1887
     1888(defun singular-dynamic-complete ()
     1889  "NOT READY: docu"
     1890  (interactive)
     1891  (if (eq (buffer-syntactic-context) 'string)
     1892      ;; then: expand filename
     1893      (comint-dynamic-complete-as-filename)
     1894    ;; else: expand command or help
     1895    (let ((end (point))
     1896          beg
     1897          pattern
     1898          completion-list
     1899          completion)
     1900      (save-excursion
     1901        (beginning-of-line)
     1902        (if (re-search-forward (concat singular-prompt-regexp
     1903                                       "[ \t]*\\([\\?]\\|help \\)[ \t]*\\(.*\\)")
     1904                               end t)
     1905            (setq pattern (match-string 2)
     1906                  beg (match-beginning 2)
     1907                  completion-list singular-completion-help-list)
     1908          (goto-char end)
     1909          (skip-chars-backward "a-zA-Z0-9")
     1910          (setq pattern (buffer-substring (point) end)
     1911                beg (point)
     1912                completion-list singular-completion-command-list)))
     1913     
     1914      (setq completion (try-completion pattern
     1915                                       completion-list))
     1916      (cond ((eq completion t)
     1917             (message "[Sole completion]"))  ;; nothing to complete
     1918            ((null completion)               ;; no completion found
     1919             (message "Can't find completion for \"%s\"" pattern)
     1920             (ding))
     1921            ((not (string= pattern completion))
     1922             (delete-region beg end)
     1923             (insert completion))
     1924            (t
     1925             (message "Making completion list...")
     1926             (let ((list (all-completions pattern
     1927                                          completion-list)))
     1928               (with-output-to-temp-buffer "*Completions*"
     1929                 (display-completion-list list)))
     1930             (message "Making completion list...%s" "done"))))))
     1931;;}}}
     1932
    18691933;;{{{ Singular interactive mode
    18701934(defun singular-interactive-mode ()
     
    19191983  (setq comint-input-ring-size singular-input-ring-size)
    19201984  (setq comint-input-filter singular-history-filter)
     1985  (setq comint-completion-addsuffix singular-completion-addsuffix)
    19211986
    19221987  ;; get name of history file (if any)
Note: See TracChangeset for help on using the changeset viewer.