aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1992-06-02 02:33:00 +0000
committerRichard M. Stallman1992-06-02 02:33:00 +0000
commit31c75fa7308daa14eb7d36f8c266ec5e2985ba7f (patch)
treeb15ae63ef045805f74b244d2baafc284da985088
parent9c50f912085d060637d239a9417e70513a89b736 (diff)
downloademacs-31c75fa7308daa14eb7d36f8c266ec5e2985ba7f.tar.gz
emacs-31c75fa7308daa14eb7d36f8c266ec5e2985ba7f.zip
*** empty log message ***
-rw-r--r--lisp/hexl.el23
-rw-r--r--lisp/textmodes/fill.el7
2 files changed, 20 insertions, 10 deletions
diff --git a/lisp/hexl.el b/lisp/hexl.el
index b736f28fa40..4656a9e7c0c 100644
--- a/lisp/hexl.el
+++ b/lisp/hexl.el
@@ -68,6 +68,7 @@ and \"-de\" when dehexlfying a buffer.")
68 68
69;; routines 69;; routines
70 70
71;;;###autoload
71(defun hexl-mode (&optional arg) 72(defun hexl-mode (&optional arg)
72 "\\<hexl-mode-map> 73 "\\<hexl-mode-map>
73A major mode for editting binary files in hex dump format. 74A major mode for editting binary files in hex dump format.
@@ -131,11 +132,10 @@ into the buffer at the current point.
131\\[hexl-insert-decimal-char] will insert a given decimal value (if it is between 0 and 255) 132\\[hexl-insert-decimal-char] will insert a given decimal value (if it is between 0 and 255)
132into the buffer at the current point. 133into the buffer at the current point.
133 134
134\\[hexl-save-buffer] will save the buffer in is binary format.
135
136\\[hexl-mode-exit] will exit hexl-mode. 135\\[hexl-mode-exit] will exit hexl-mode.
137 136
138Note: \\[write-file] will write the file out in HEXL FORMAT. 137Note: saving the file with any of the usual Emacs commands
138will actually convert it back to binary format while saving.
139 139
140You can use \\[hexl-find-file] to visit a file in hexl-mode. 140You can use \\[hexl-find-file] to visit a file in hexl-mode.
141 141
@@ -156,6 +156,10 @@ You can use \\[hexl-find-file] to visit a file in hexl-mode.
156 (setq hexl-mode-old-major-mode major-mode) 156 (setq hexl-mode-old-major-mode major-mode)
157 (setq major-mode 'hexl-mode) 157 (setq major-mode 'hexl-mode)
158 158
159 (make-local-variable 'write-contents-hooks)
160 (setq write-contents-hooks
161 (cons 'hexl-save-buffer write-contents-hooks))
162
159 (let ((modified (buffer-modified-p)) 163 (let ((modified (buffer-modified-p))
160 (read-only buffer-read-only) 164 (read-only buffer-read-only)
161 (original-point (1- (point)))) 165 (original-point (1- (point))))
@@ -191,8 +195,11 @@ You can use \\[hexl-find-file] to visit a file in hexl-mode.
191 (kill-buffer buf) 195 (kill-buffer buf)
192 modified)) 196 modified))
193 (message "(No changes need to be saved)") 197 (message "(No changes need to be saved)")
194 nil))) 198 nil))
199 ;; Return t to indicate we have saved t
200 t)
195 201
202;;;###autoload
196(defun hexl-find-file (filename) 203(defun hexl-find-file (filename)
197 "Edit file FILENAME in hexl-mode. 204 "Edit file FILENAME in hexl-mode.
198Switch to a buffer visiting file FILENAME, creating one in none exists." 205Switch to a buffer visiting file FILENAME, creating one in none exists."
@@ -202,7 +209,7 @@ Switch to a buffer visiting file FILENAME, creating one in none exists."
202 (hexl-mode))) 209 (hexl-mode)))
203 210
204(defun hexl-mode-exit (&optional arg) 211(defun hexl-mode-exit (&optional arg)
205 "Exit hexl-mode returning to previous mode. 212 "Exit Hexl mode, returning to previous mode.
206With arg, don't unhexlify buffer." 213With arg, don't unhexlify buffer."
207 (interactive "p") 214 (interactive "p")
208 (if (or (eq arg 1) (not arg)) 215 (if (or (eq arg 1) (not arg))
@@ -623,11 +630,11 @@ You may also type up to 3 octal digits, to insert a character with that code"
623 (define-key hexl-mode-map "\e\C-x" 'hexl-insert-hex-char) 630 (define-key hexl-mode-map "\e\C-x" 'hexl-insert-hex-char)
624 (define-key hexl-mode-map "\e\C-y" 'undefined) 631 (define-key hexl-mode-map "\e\C-y" 'undefined)
625 632
626 (define-key hexl-mode-map "\ea" 'hexl-beginning-of-1k-page) 633 (define-key hexl-mode-map "\ea" 'undefined)
627 (define-key hexl-mode-map "\eb" 'hexl-backward-word) 634 (define-key hexl-mode-map "\eb" 'hexl-backward-word)
628 (define-key hexl-mode-map "\ec" 'undefined) 635 (define-key hexl-mode-map "\ec" 'undefined)
629 (define-key hexl-mode-map "\ed" 'undefined) 636 (define-key hexl-mode-map "\ed" 'undefined)
630 (define-key hexl-mode-map "\ee" 'hexl-end-of-1k-page) 637 (define-key hexl-mode-map "\ee" 'undefined)
631 (define-key hexl-mode-map "\ef" 'hexl-forward-word) 638 (define-key hexl-mode-map "\ef" 'hexl-forward-word)
632 (define-key hexl-mode-map "\eg" 'hexl-goto-hex-address) 639 (define-key hexl-mode-map "\eg" 'hexl-goto-hex-address)
633 (define-key hexl-mode-map "\eh" 'undefined) 640 (define-key hexl-mode-map "\eh" 'undefined)
@@ -652,6 +659,8 @@ You may also type up to 3 octal digits, to insert a character with that code"
652 659
653 (define-key hexl-mode-map "\C-c\C-c" 'hexl-mode-exit) 660 (define-key hexl-mode-map "\C-c\C-c" 'hexl-mode-exit)
654 661
662 (define-key hexl-mode-map "\C-x[" 'hexl-beginning-of-1k-page)
663 (define-key hexl-mode-map "\C-x]" 'hexl-end-of-1k-page)
655 (define-key hexl-mode-map "\C-x\C-p" 'undefined) 664 (define-key hexl-mode-map "\C-x\C-p" 'undefined)
656 (define-key hexl-mode-map "\C-x\C-s" 'hexl-save-buffer) 665 (define-key hexl-mode-map "\C-x\C-s" 'hexl-save-buffer)
657 (define-key hexl-mode-map "\C-x\C-t" 'undefined)) 666 (define-key hexl-mode-map "\C-x\C-t" 'undefined))
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 9940d59ea9d..bc6ae99bae8 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -57,7 +57,8 @@ From program, pass args FROM, TO and JUSTIFY-FLAG."
57 ;; Don't let Adaptive Fill mode alter the fill prefix permanently. 57 ;; Don't let Adaptive Fill mode alter the fill prefix permanently.
58 (let ((fill-prefix fill-prefix)) 58 (let ((fill-prefix fill-prefix))
59 ;; Figure out how this paragraph is indented, if desired. 59 ;; Figure out how this paragraph is indented, if desired.
60 (if adaptive-fill-mode 60 (if (and adaptive-fill-mode
61 (or (null fill-prefix) (string= fill-prefix "")))
61 (save-excursion 62 (save-excursion
62 (goto-char (min from to)) 63 (goto-char (min from to))
63 (if (eolp) (forward-line 1)) 64 (if (eolp) (forward-line 1))
@@ -105,7 +106,7 @@ From program, pass args FROM, TO and JUSTIFY-FLAG."
105 ;; Make sure sentences ending at end of line get an extra space. 106 ;; Make sure sentences ending at end of line get an extra space.
106 ;; loses on split abbrevs ("Mr.\nSmith") 107 ;; loses on split abbrevs ("Mr.\nSmith")
107 (goto-char from) 108 (goto-char from)
108 (while (re-search-forward "[.?!][])\"']*$" nil t) 109 (while (re-search-forward "[.?!][])}\"']*$" nil t)
109 (insert ? )) 110 (insert ? ))
110 111
111 ;; Then change all newlines to spaces. 112 ;; Then change all newlines to spaces.
@@ -123,7 +124,7 @@ From program, pass args FROM, TO and JUSTIFY-FLAG."
123 (delete-region 124 (delete-region
124 (+ (match-beginning 0) 125 (+ (match-beginning 0)
125 (if (save-excursion 126 (if (save-excursion
126 (skip-chars-backward " ])\"'") 127 (skip-chars-backward " ]})\"'")
127 (memq (preceding-char) '(?. ?? ?!))) 128 (memq (preceding-char) '(?. ?? ?!)))
128 2 1)) 129 2 1))
129 (match-end 0))) 130 (match-end 0)))