ENH remove excess ampl mode functions

This commit is contained in:
Nathan Dwarshuis 2021-03-28 11:44:15 -04:00
parent 934736390f
commit 35a9eb2e63
1 changed files with 6 additions and 58 deletions

View File

@ -1465,11 +1465,6 @@ Code shamelessly ripped off from [[https://github.com/dpo/ampl-mode/blob/master/
(if ampl-mode-map (if ampl-mode-map
nil nil
(setq ampl-mode-map (make-sparse-keymap)) (setq ampl-mode-map (make-sparse-keymap))
(define-key ampl-mode-map "(" 'ampl-insert-parens)
(define-key ampl-mode-map "[" 'ampl-insert-sqbrackets)
(define-key ampl-mode-map "{" 'ampl-insert-curlies)
(define-key ampl-mode-map "\"" 'ampl-insert-double-quotes)
(define-key ampl-mode-map "'" 'ampl-insert-single-quotes)
(define-key ampl-mode-map "\C-co" 'ampl-insert-comment)) (define-key ampl-mode-map "\C-co" 'ampl-insert-comment))
(setq auto-mode-alist (setq auto-mode-alist
@ -1625,64 +1620,17 @@ Code shamelessly ripped off from [[https://github.com/dpo/ampl-mode/blob/master/
"Insert a comment template defined by `ampl-user-comment'." "Insert a comment template defined by `ampl-user-comment'."
(interactive) (interactive)
(let ((point-a (point)) (let ((point-a (point))
(use-comment ampl-user-comment) (use-comment ampl-user-comment)
point-b point-c) point-b point-c)
(insert ampl-user-comment) (insert ampl-user-comment)
(setq point-b (point)) (setq point-b (point))
(goto-char point-a) (goto-char point-a)
(if (re-search-forward "%" point-b t) (if (re-search-forward "%" point-b t)
(progn (progn
(setq point-c (match-beginning 0)) (setq point-c (match-beginning 0))
(replace-match "")) (replace-match ""))
(goto-char point-b)))) (goto-char point-b))))
(defun ampl-insert-parens (arg)
"Insert parenthesis pair. See ampl-auto-close-parenthesis."
(interactive "p")
(if ampl-auto-close-parenthesis
(progn
(insert "()")
(backward-char 1))
(insert "(")))
(defun ampl-insert-sqbrackets (arg)
"Insert square brackets pair. See ampl-auto-close-brackets."
(interactive "p")
(if ampl-auto-close-brackets
(progn
(insert "[]")
(backward-char 1))
(insert "[")))
(defun ampl-insert-curlies (arg)
"Insert curly braces pair. See ampl-auto-close-curlies."
(interactive "p")
(if ampl-auto-close-curlies
(progn
(insert "{}")
(backward-char 1))
(insert "{")))
(defun ampl-insert-double-quotes (arg)
"Insert double quotes pair. See ampl-auto-close-double-quotes."
(interactive "p")
(if ampl-auto-close-double-quote
(progn
(insert "\"\"")
(backward-char 1))
(insert "\"")))
(defun ampl-insert-single-quotes (arg)
"Insert single quotes pair. See ampl-auto-close-single-quotes."
(interactive "p")
(if ampl-auto-close-single-quote
(progn
(insert "''")
(backward-char 1))
(insert "'")))
;; End of user commands
(setq major-mode 'ampl-mode) (setq major-mode 'ampl-mode)
(setq mode-name "Ampl") (setq mode-name "Ampl")