Commit ab8e678c authored by Stefan Monnier's avatar Stefan Monnier
Browse files

Remove spurious * in docstrings.

(snmp-rfc1155-types, snmp-rfc1213-types, snmp-rfc1902-types)
(snmp-rfc1903-types, snmp-rfc1155-access, snmp-rfc1902-access)
(snmp-rfc1212-status, snmp-rfc1902-status): Remove list wrappers now
that completion accepts lists of strings.
(snmp-mode-syntax-table): Move initialization into declaration.
(snmp-mode-map): Likewise and remove \t binding.
(snmp-common-mode): Set tab-always-indent according to snmp-t-a-i.
(snmp-indent-line, snmp-mode-imenu-create-index): Remove unused var.
(snmp-indent-command): Remove.
parent b608e302
2007-09-19 Stefan Monnier <monnier@iro.umontreal.ca> 2007-09-19 Stefan Monnier <monnier@iro.umontreal.ca>
* net/snmp-mode.el: Remove spurious * in docstrings.
(snmp-rfc1155-types, snmp-rfc1213-types, snmp-rfc1902-types)
(snmp-rfc1903-types, snmp-rfc1155-access, snmp-rfc1902-access)
(snmp-rfc1212-status, snmp-rfc1902-status): Remove list wrappers now
that completion accepts lists of strings.
(snmp-mode-syntax-table): Move initialization into declaration.
(snmp-mode-map): Likewise and remove \t binding.
(snmp-common-mode): Set tab-always-indent according to snmp-t-a-i.
(snmp-indent-line, snmp-mode-imenu-create-index): Remove unused var.
(snmp-indent-command): Remove.
* emacs-lisp/lisp-mode.el (lisp-mode-shared-map): Use the default TAB * emacs-lisp/lisp-mode.el (lisp-mode-shared-map): Use the default TAB
binding, so tab-always-indent works right. binding, so tab-always-indent works right.
......
...@@ -88,6 +88,8 @@ ...@@ -88,6 +88,8 @@
;;; Code: ;;; Code:
(eval-when-compile (eval-when-compile
(require 'cl)
(require 'imenu) ; Need this stuff when compiling for imenu macros, etc.
(require 'tempo)) (require 'tempo))
;;;---------------------------------------------------------------------------- ;;;----------------------------------------------------------------------------
...@@ -102,42 +104,42 @@ ...@@ -102,42 +104,42 @@
:version "20.4") :version "20.4")
(defcustom snmp-special-indent t (defcustom snmp-special-indent t
"*If non-nil, use a simple heuristic to try to guess the right indentation. "If non-nil, use a simple heuristic to try to guess the right indentation.
If nil, then no special indentation is attempted." If nil, then no special indentation is attempted."
:type 'boolean :type 'boolean
:group 'snmp) :group 'snmp)
(defcustom snmp-indent-level 4 (defcustom snmp-indent-level 4
"*Indentation level for SNMP MIBs." "Indentation level for SNMP MIBs."
:type 'integer :type 'integer
:group 'snmp) :group 'snmp)
(defcustom snmp-tab-always-indent nil (defcustom snmp-tab-always-indent nil
"*Non-nil means TAB should always reindent the current line. "Non-nil means TAB should always reindent the current line.
A value of nil means reindent if point is within the initial line indentation; A value of nil means reindent if point is within the initial line indentation;
otherwise insert a TAB." otherwise insert a TAB."
:type 'boolean :type 'boolean
:group 'snmp) :group 'snmp)
(defcustom snmp-completion-ignore-case t (defcustom snmp-completion-ignore-case t
"*Non-nil means that case differences are ignored during completion. "Non-nil means that case differences are ignored during completion.
A value of nil means that case is significant. A value of nil means that case is significant.
This is used during Tempo template completion." This is used during Tempo template completion."
:type 'boolean :type 'boolean
:group 'snmp) :group 'snmp)
(defcustom snmp-common-mode-hook nil (defcustom snmp-common-mode-hook nil
"*Hook(s) evaluated when a buffer enters either SNMP or SNMPv2 mode." "Hook(s) evaluated when a buffer enters either SNMP or SNMPv2 mode."
:type 'hook :type 'hook
:group 'snmp) :group 'snmp)
(defcustom snmp-mode-hook nil (defcustom snmp-mode-hook nil
"*Hook(s) evaluated when a buffer enters SNMP mode." "Hook(s) evaluated when a buffer enters SNMP mode."
:type 'hook :type 'hook
:group 'snmp) :group 'snmp)
(defcustom snmpv2-mode-hook nil (defcustom snmpv2-mode-hook nil
"*Hook(s) evaluated when a buffer enters SNMPv2 mode." "Hook(s) evaluated when a buffer enters SNMPv2 mode."
:type 'hook :type 'hook
:group 'snmp) :group 'snmp)
...@@ -195,26 +197,26 @@ This is used during Tempo template completion." ...@@ -195,26 +197,26 @@ This is used during Tempo template completion."
"Predefined types for SYNTAX clauses.") "Predefined types for SYNTAX clauses.")
(defvar snmp-rfc1155-types (defvar snmp-rfc1155-types
'(("INTEGER") ("OCTET STRING") ("OBJECT IDENTIFIER") ("NULL") ("IpAddress") '("INTEGER" "OCTET STRING" "OBJECT IDENTIFIER" "NULL" "IpAddress"
("NetworkAddress") ("Counter") ("Gauge") ("TimeTicks") ("Opaque")) "NetworkAddress" "Counter" "Gauge" "TimeTicks" "Opaque")
"Types from RFC 1155 v1 SMI.") "Types from RFC 1155 v1 SMI.")
(defvar snmp-rfc1213-types (defvar snmp-rfc1213-types
'(("DisplayString")) '("DisplayString")
"Types from RFC 1213 MIB-II.") "Types from RFC 1213 MIB-II.")
(defvar snmp-rfc1902-types (defvar snmp-rfc1902-types
'(("INTEGER") ("OCTET STRING") ("OBJECT IDENTIFIER") ("Integer32") '("INTEGER" "OCTET STRING" "OBJECT IDENTIFIER" "Integer32"
("IpAddress") ("Counter32") ("Gauge32") ("Unsigned32") ("TimeTicks") "IpAddress" "Counter32" "Gauge32" "Unsigned32" "TimeTicks"
("Opaque") ("Counter64")) "Opaque" "Counter64")
"Types from RFC 1902 v2 SMI.") "Types from RFC 1902 v2 SMI.")
(defvar snmp-rfc1903-types (defvar snmp-rfc1903-types
'(("DisplayString") ("PhysAddress") ("MacAddress") ("TruthValue") '("DisplayString" "PhysAddress" "MacAddress" "TruthValue"
("TestAndIncr") ("AutonomousType") ("InstancePointer") "TestAndIncr" "AutonomousType" "InstancePointer"
("VariablePointer") ("RowPointer") ("RowStatus") ("TimeStamp") "VariablePointer" "RowPointer" "RowStatus" "TimeStamp"
("TimeInterval") ("DateAndTime") ("StorageType") ("TDomain") "TimeInterval" "DateAndTime" "StorageType" "TDomain"
("TAddress")) "TAddress")
"Types from RFC 1903 Textual Conventions.") "Types from RFC 1903 Textual Conventions.")
...@@ -222,12 +224,12 @@ This is used during Tempo template completion." ...@@ -222,12 +224,12 @@ This is used during Tempo template completion."
"Predefined values for ACCESS clauses.") "Predefined values for ACCESS clauses.")
(defvar snmp-rfc1155-access (defvar snmp-rfc1155-access
'(("read-only") ("read-write") ("write-only") ("not-accessible")) '("read-only" "read-write" "write-only" "not-accessible")
"ACCESS values from RFC 1155 v1 SMI.") "ACCESS values from RFC 1155 v1 SMI.")
(defvar snmp-rfc1902-access (defvar snmp-rfc1902-access
'(("read-only") ("read-write") ("read-create") ("not-accessible") '("read-only" "read-write" "read-create" "not-accessible"
("accessible-for-notify")) "accessible-for-notify")
"ACCESS values from RFC 1155 v1 SMI.") "ACCESS values from RFC 1155 v1 SMI.")
...@@ -235,11 +237,11 @@ This is used during Tempo template completion." ...@@ -235,11 +237,11 @@ This is used during Tempo template completion."
"Predefined values for STATUS clauses.") "Predefined values for STATUS clauses.")
(defvar snmp-rfc1212-status (defvar snmp-rfc1212-status
'(("mandatory") ("obsolete") ("deprecated")) '("mandatory" "obsolete" "deprecated")
"STATUS values from RFC 1212 v1 SMI.") "STATUS values from RFC 1212 v1 SMI.")
(defvar snmp-rfc1902-status (defvar snmp-rfc1902-status
'(("current") ("obsolete") ("deprecated")) '("current" "obsolete" "deprecated")
"STATUS values from RFC 1902 v2 SMI.") "STATUS values from RFC 1902 v2 SMI.")
...@@ -252,13 +254,6 @@ This is used during Tempo template completion." ...@@ -252,13 +254,6 @@ This is used during Tempo template completion."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Need this stuff when compiling for imenu macros, etc.
;;
(eval-when-compile
(require 'cl)
(require 'imenu))
;; Create abbrev table for SNMP MIB mode ;; Create abbrev table for SNMP MIB mode
;; ;;
(defvar snmp-mode-abbrev-table nil (defvar snmp-mode-abbrev-table nil
...@@ -275,33 +270,30 @@ This is used during Tempo template completion." ...@@ -275,33 +270,30 @@ This is used during Tempo template completion."
;; Set up our keymap ;; Set up our keymap
;; ;;
(defvar snmp-mode-map (make-sparse-keymap) (defvar snmp-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "\177" 'backward-delete-char-untabify)
(define-key map "\C-c\C-i" 'tempo-complete-tag)
(define-key map "\C-c\C-f" 'tempo-forward-mark)
(define-key map "\C-c\C-b" 'tempo-backward-mark)
map)
"Keymap used in SNMP mode.") "Keymap used in SNMP mode.")
(define-key snmp-mode-map "\t" 'snmp-indent-command)
(define-key snmp-mode-map "\177" 'backward-delete-char-untabify)
(define-key snmp-mode-map "\C-c\C-i" 'tempo-complete-tag)
(define-key snmp-mode-map "\C-c\C-f" 'tempo-forward-mark)
(define-key snmp-mode-map "\C-c\C-b" 'tempo-backward-mark)
;; Set up our syntax table ;; Set up our syntax table
;; ;;
(defvar snmp-mode-syntax-table nil (defvar snmp-mode-syntax-table
(let ((st (make-syntax-table)))
(modify-syntax-entry ?\\ "\\" st)
(modify-syntax-entry ?- "_ 1234" st)
(modify-syntax-entry ?\n ">" st)
(modify-syntax-entry ?\^m ">" st)
(modify-syntax-entry ?_ "." st)
(modify-syntax-entry ?: "." st)
(modify-syntax-entry ?= "." st)
st)
"Syntax table used for buffers in SNMP mode.") "Syntax table used for buffers in SNMP mode.")
(if snmp-mode-syntax-table
()
(setq snmp-mode-syntax-table (make-syntax-table))
(modify-syntax-entry ?\\ "\\" snmp-mode-syntax-table)
(modify-syntax-entry ?- "_ 1234" snmp-mode-syntax-table)
(modify-syntax-entry ?\n ">" snmp-mode-syntax-table)
(modify-syntax-entry ?\^m ">" snmp-mode-syntax-table)
(modify-syntax-entry ?_ "." snmp-mode-syntax-table)
(modify-syntax-entry ?: "." snmp-mode-syntax-table)
(modify-syntax-entry ?= "." snmp-mode-syntax-table))
;; Set up the stuff that's common between snmp-mode and snmpv2-mode ;; Set up the stuff that's common between snmp-mode and snmpv2-mode
;; ;;
(defun snmp-common-mode (name mode abbrev font-keywords imenu-index tempo-tags) (defun snmp-common-mode (name mode abbrev font-keywords imenu-index tempo-tags)
...@@ -335,10 +327,9 @@ This is used during Tempo template completion." ...@@ -335,10 +327,9 @@ This is used during Tempo template completion."
(setq parse-sexp-ignore-comments t) (setq parse-sexp-ignore-comments t)
;; Set up indentation ;; Set up indentation
(make-local-variable 'indent-line-function) (if snmp-special-indent
(setq indent-line-function (if snmp-special-indent (set (make-local-variable 'indent-line-function) 'snmp-indent-line))
'snmp-indent-line (set (make-local-variable 'tab-always-indent) snmp-tab-always-indent)
'indent-to-left-margin))
;; Font Lock ;; Font Lock
(make-local-variable 'font-lock-defaults) (make-local-variable 'font-lock-defaults)
...@@ -474,7 +465,7 @@ lines for the purposes of this function." ...@@ -474,7 +465,7 @@ lines for the purposes of this function."
"Indent current line as SNMP MIB code." "Indent current line as SNMP MIB code."
(let ((indent (snmp-calculate-indent)) (let ((indent (snmp-calculate-indent))
(pos (- (point-max) (point))) (pos (- (point-max) (point)))
shift-amt beg end) shift-amt beg)
(beginning-of-line) (beginning-of-line)
(setq beg (point)) (setq beg (point))
(skip-chars-forward " \t") (skip-chars-forward " \t")
...@@ -488,20 +479,6 @@ lines for the purposes of this function." ...@@ -488,20 +479,6 @@ lines for the purposes of this function."
(if (> (- (point-max) pos) (point)) (if (> (- (point-max) pos) (point))
(goto-char (- (point-max) pos))))) (goto-char (- (point-max) pos)))))
(defun snmp-indent-command ()
"Indent current line as SNMP MIB code, or sometimes insert a TAB.
If `snmp-tab-always-indent' is t, always reindent the current line when
this command is run.
If `snmp-tab-always-indent' is nil, reindent the current line if point is
in the initial indentation. Otherwise, insert a TAB."
(interactive)
(if (and (not snmp-tab-always-indent)
(save-excursion
(skip-chars-backward " \t")
(not (bolp))))
(insert-tab)
(snmp-indent-line)))
;;;---------------------------------------------------------------------------- ;;;----------------------------------------------------------------------------
;; ;;
...@@ -520,7 +497,7 @@ in the initial indentation. Otherwise, insert a TAB." ...@@ -520,7 +497,7 @@ in the initial indentation. Otherwise, insert a TAB."
(index-table-alist '()) (index-table-alist '())
(index-trap-alist '()) (index-trap-alist '())
(case-fold-search nil) ; keywords must be uppercase (case-fold-search nil) ; keywords must be uppercase
prev-pos token marker end) prev-pos token end)
(goto-char (point-min)) (goto-char (point-min))
(imenu-progress-message prev-pos 0) (imenu-progress-message prev-pos 0)
;; Search for a useful MIB item (that's not in a comment) ;; Search for a useful MIB item (that's not in a comment)
...@@ -529,7 +506,7 @@ in the initial indentation. Otherwise, insert a TAB." ...@@ -529,7 +506,7 @@ in the initial indentation. Otherwise, insert a TAB."
(imenu-progress-message prev-pos) (imenu-progress-message prev-pos)
(setq (setq
end (match-end 0) end (match-end 0)
token (cons (buffer-substring (match-beginning 1) (match-end 1)) token (cons (match-string 1)
(set-marker (make-marker) (match-beginning 1)))) (set-marker (make-marker) (match-beginning 1))))
(goto-char (match-beginning 2)) (goto-char (match-beginning 2))
(cond ((looking-at "OBJECT-TYPE[ \t\n]+SYNTAX") (cond ((looking-at "OBJECT-TYPE[ \t\n]+SYNTAX")
...@@ -719,5 +696,5 @@ controls whether case is significant." ...@@ -719,5 +696,5 @@ controls whether case is significant."
(provide 'snmp-mode) (provide 'snmp-mode)
;;; arch-tag: eb6cc0f9-1e47-4023-8625-bc9aae6c3527 ;; arch-tag: eb6cc0f9-1e47-4023-8625-bc9aae6c3527
;;; snmp-mode.el ends here ;;; snmp-mode.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment