- (if (and (boundp 'ruler-mode) ruler-mode (not hexl-mode-old-ruler-mode))
- (ruler-mode 0))
- (when (boundp 'hexl-mode-old-ruler-function)
- (setq ruler-mode-ruler-function hexl-mode-old-ruler-function))
-
- (if (and (boundp 'hl-line-mode) hl-line-mode (not hexl-mode-old-hl-line-mode))
- (hl-line-mode 0))
- (when (boundp 'hexl-mode-old-hl-line-range-function)
- (setq hl-line-range-function hexl-mode-old-hl-line-range-function))
- (when (boundp 'hexl-mode-old-hl-line-face)
- (setq hl-line-face hexl-mode-old-hl-line-face))
-
- (when (boundp 'hexl-mode-old-eldoc-documentation-function)
- (setq eldoc-documentation-function
- hexl-mode-old-eldoc-documentation-function))
-
- (setq require-final-newline hexl-mode-old-require-final-newline)
- (setq mode-name hexl-mode-old-mode-name)
- (setq isearch-search-fun-function hexl-mode-old-isearch-search-fun-function)
- (use-local-map hexl-mode-old-local-map)
- (set-syntax-table hexl-mode-old-syntax-table)
- (setq font-lock-defaults hexl-mode-old-font-lock-keywords)
- (setq major-mode hexl-mode-old-major-mode)
- (setq revert-buffer-function hexl-mode-old-revert-buffer-function)
+ (let ((mms ()))
+ (dolist (varval hexl-mode--old-var-vals)
+ (let* ((bound (consp varval))
+ (var (if bound (car varval) varval))
+ (val (cdr-safe varval)))
+ (cond
+ ((consp var) (funcall (cdr var) val))
+ ((hexl-mode--minor-mode-p var) (push (cons var val) mms))
+ (bound (set (make-local-variable var) val))
+ (t (kill-local-variable var)))))
+ (kill-local-variable 'hexl-mode--old-var-vals)
+ ;; Enable/disable minor modes. Do it after having reset the other vars,
+ ;; since some of them may affect the minor modes.
+ (dolist (mm mms)
+ (funcall (car mm) (if (cdr mm) 1 -1))))
+