emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/hexl.el


From: Kim F. Storm
Subject: [Emacs-diffs] Changes to emacs/lisp/hexl.el
Date: Thu, 07 Nov 2002 18:15:02 -0500

Index: emacs/lisp/hexl.el
diff -c emacs/lisp/hexl.el:1.74 emacs/lisp/hexl.el:1.75
*** emacs/lisp/hexl.el:1.74     Tue Jul  9 05:05:19 2002
--- emacs/lisp/hexl.el  Mon Oct 21 18:45:20 2002
***************
*** 84,90 ****
  (defvar hexl-mode-old-local-map)
  (defvar hexl-mode-old-mode-name)
  (defvar hexl-mode-old-major-mode)
! (defvar hexl-mode-old-write-contents-hooks)
  (defvar hexl-mode-old-require-final-newline)
  (defvar hexl-mode-old-syntax-table)
  
--- 84,90 ----
  (defvar hexl-mode-old-local-map)
  (defvar hexl-mode-old-mode-name)
  (defvar hexl-mode-old-major-mode)
! (defvar hexl-mode-old-isearch-search-fun-function)
  (defvar hexl-mode-old-require-final-newline)
  (defvar hexl-mode-old-syntax-table)
  
***************
*** 174,180 ****
    (unless (eq major-mode 'hexl-mode)
      (let ((modified (buffer-modified-p))
          (inhibit-read-only t)
!         (original-point (1- (point)))
          max-address)
        (and (eobp) (not (bobp))
           (setq original-point (1- original-point)))
--- 174,180 ----
    (unless (eq major-mode 'hexl-mode)
      (let ((modified (buffer-modified-p))
          (inhibit-read-only t)
!         (original-point (- (point) (point-min)))
          max-address)
        (and (eobp) (not (bobp))
           (setq original-point (1- original-point)))
***************
*** 211,216 ****
--- 211,221 ----
      (setq hexl-mode-old-mode-name mode-name)
      (setq mode-name "Hexl")
  
+     (set (make-local-variable 'hexl-mode-old-isearch-search-fun-function)
+        isearch-search-fun-function)
+     (set (make-local-variable 'isearch-search-fun-function)
+        'hexl-isearch-search-function)
+ 
      (make-local-variable 'hexl-mode-old-major-mode)
      (setq hexl-mode-old-major-mode major-mode)
      (setq major-mode 'hexl-mode)
***************
*** 219,228 ****
      (setq hexl-mode-old-syntax-table (syntax-table))
      (set-syntax-table (standard-syntax-table))
  
!     (make-local-variable 'hexl-mode-old-write-contents-hooks)
!     (setq hexl-mode-old-write-contents-hooks write-contents-hooks)
!     (make-local-variable 'write-contents-hooks)
!     (add-hook 'write-contents-hooks 'hexl-save-buffer)
  
      (make-local-variable 'hexl-mode-old-require-final-newline)
      (setq hexl-mode-old-require-final-newline require-final-newline)
--- 224,230 ----
      (setq hexl-mode-old-syntax-table (syntax-table))
      (set-syntax-table (standard-syntax-table))
  
!     (add-hook 'write-contents-functions 'hexl-save-buffer nil t)
  
      (make-local-variable 'hexl-mode-old-require-final-newline)
      (setq hexl-mode-old-require-final-newline require-final-newline)
***************
*** 237,242 ****
--- 239,257 ----
      (if hexl-follow-ascii (hexl-follow-ascii 1)))
    (run-hooks 'hexl-mode-hook))
  
+ 
+ (defun hexl-isearch-search-function ()
+   (if (and (not isearch-regexp) (not isearch-word))
+       (lambda (string &optional bound noerror count)
+       (funcall
+        (if isearch-forward 're-search-forward 're-search-backward)
+        (if (> (length string) 80)
+            (regexp-quote string)
+          (mapconcat 'string string "\\(?:\n\\(?:[:a-f0-9]+ \\)+ \\)?"))
+        bound noerror count))
+     (let ((isearch-search-fun-function nil))
+       (isearch-search-fun))))
+ 
  (defun hexl-after-revert-hook ()
    (setq hexl-max-address (1- (buffer-size)))
    (hexlify-buffer)
***************
*** 294,300 ****
            (inhibit-read-only t)
            (original-point (1+ (hexl-current-address))))
        (dehexlify-buffer)
!       (remove-hook 'write-contents-hooks 'hexl-save-buffer)
        (set-buffer-modified-p modified)
        (goto-char original-point)
        ;; Maybe adjust point for the removed CR characters.
--- 309,315 ----
            (inhibit-read-only t)
            (original-point (1+ (hexl-current-address))))
        (dehexlify-buffer)
!       (remove-hook 'write-contents-functions 'hexl-save-buffer t)
        (set-buffer-modified-p modified)
        (goto-char original-point)
        ;; Maybe adjust point for the removed CR characters.
***************
*** 309,317 ****
    (remove-hook 'post-command-hook 'hexl-follow-ascii-find t)
    (setq hexl-ascii-overlay nil)
  
-   (setq write-contents-hooks hexl-mode-old-write-contents-hooks)
    (setq require-final-newline hexl-mode-old-require-final-newline)
    (setq mode-name hexl-mode-old-mode-name)
    (use-local-map hexl-mode-old-local-map)
    (set-syntax-table hexl-mode-old-syntax-table)
    (setq major-mode hexl-mode-old-major-mode)
--- 324,332 ----
    (remove-hook 'post-command-hook 'hexl-follow-ascii-find t)
    (setq hexl-ascii-overlay nil)
  
    (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 major-mode hexl-mode-old-major-mode)
***************
*** 325,345 ****
            (inhibit-read-only t)
            (original-point (1+ (hexl-current-address))))
        (dehexlify-buffer)
!       (remove-hook 'write-contents-hooks 'hexl-save-buffer)
        (set-buffer-modified-p modified)
        (goto-char original-point))))
  
  (defun hexl-current-address (&optional validate)
    "Return current hexl-address."
    (interactive)
!   (let ((current-column (- (% (point) 68) 11))
        (hexl-address 0))
      (if (< current-column 0)
        (if validate
            (error "Point is not on a character in the file")
          (setq current-column 0)))
      (setq hexl-address
!         (+ (* (/ (point) 68) 16)
             (if (>= current-column 41)
                 (- current-column 41)
               (/ (- current-column  (/ current-column 5)) 2))))
--- 340,360 ----
            (inhibit-read-only t)
            (original-point (1+ (hexl-current-address))))
        (dehexlify-buffer)
!       (remove-hook 'write-contents-functions 'hexl-save-buffer t)
        (set-buffer-modified-p modified)
        (goto-char original-point))))
  
  (defun hexl-current-address (&optional validate)
    "Return current hexl-address."
    (interactive)
!   (let ((current-column (- (% (- (point) (point-min) -1) 68) 11))
        (hexl-address 0))
      (if (< current-column 0)
        (if validate
            (error "Point is not on a character in the file")
          (setq current-column 0)))
      (setq hexl-address
!         (+ (* (/ (- (point) (point-min) -1) 68) 16)
             (if (>= current-column 41)
                 (- current-column 41)
               (/ (- current-column  (/ current-column 5)) 2))))
***************
*** 350,356 ****
  (defun hexl-address-to-marker (address)
    "Return buffer position for ADDRESS."
    (interactive "nAddress: ")
!   (+ (* (/ address 16) 68) 11 (/ (* (% address 16) 5) 2)))
  
  (defun hexl-goto-address (address)
    "Goto hexl-mode (decimal) address ADDRESS.
--- 365,371 ----
  (defun hexl-address-to-marker (address)
    "Return buffer position for ADDRESS."
    (interactive "nAddress: ")
!   (+ (* (/ address 16) 68) 10 (point-min) (/ (* (% address 16) 5) 2)))
  
  (defun hexl-goto-address (address)
    "Goto hexl-mode (decimal) address ADDRESS.
***************
*** 730,740 ****
      (while (> num 0)
        (let ((hex-position
             (+ (* (/ address 16) 68)
!               11
                (* 2 (% address 16))
                (/ (% address 16) 2)))
            (ascii-position
!            (+ (* (/ address 16) 68) 52 (% address 16)))
            at-ascii-position)
        (if (= (point) ascii-position)
            (setq at-ascii-position t))
--- 745,755 ----
      (while (> num 0)
        (let ((hex-position
             (+ (* (/ address 16) 68)
!               10 (point-min)
                (* 2 (% address 16))
                (/ (% address 16) 2)))
            (ascii-position
!            (+ (* (/ address 16) 68) 51 (point-min) (% address 16)))
            at-ascii-position)
        (if (= (point) ascii-position)
            (setq at-ascii-position t))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]