• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/emacs-93/emacs/lisp/

Lines Matching +defs:beginning +defs:of +defs:buffer

10 ;; This file is part of GNU Emacs.
13 ;; it under the terms of the GNU General Public License as published by
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;; You should have received a copy of the GNU General Public License
32 ;; binary. For full instructions, invoke `hexl-mode' on an empty buffer and
41 ;; ASCII region of the screen (if your Emacs supports this) instead of
60 and \"-de\" when dehexlifying a buffer."
90 "Face used in address area of hexl-mode buffer."
95 "Face used in ascii area of hexl-mode buffer."
99 "Maximum offset into hexl buffer.")
126 (make-variable-buffer-local 'hexl-ascii-overlay)
143 of the current mode's behavior, but not all; also, you can exit
146 This function automatically converts a buffer into the hexl format
147 using the function `hexlify-buffer'.
149 Each line in the buffer has an \"address\" (displayed in hexadecimal)
154 If any of the characters (displayed as ASCII characters) are
158 If `hexl-mode' is invoked with an argument the buffer is assumed to be
179 Movement is as simple as movement in a normal Emacs text buffer. Most
183 Advanced cursor movement commands (ala \\[hexl-beginning-of-line], \\[hexl-end-of-line], \\[hexl-beginning-of-buffer], and \\[hexl-end-of-buffer]) are
190 insert itself (actually overstrike) into the buffer.
194 of another key to insert the octal number's ASCII representation.
197 into the buffer at the current point.
200 into the buffer at the current point.
203 into the buffer at the current point.
207 Note: saving the file with any of the usual Emacs commands
215 (let ((modified (buffer-modified-p))
220 ;; If `hexl-mode' is invoked with an argument the buffer is assumed to
223 ;; If the buffer's EOL type is -dos, we need to account for
224 ;; extra CR characters added when hexlify-buffer writes the
225 ;; buffer to a file.
227 (when (eq (coding-system-eol-type buffer-file-coding-system) 1)
231 (hexlify-buffer)
232 (restore-buffer-modified-p modified))
234 (let* ((full-lines (/ (buffer-size) 68))
235 (last-line (% (buffer-size) 68))
243 ;; override most of it. That way, we can restore it perfectly.
273 (add-hook 'write-contents-functions 'hexl-save-buffer nil t)
289 (add-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer nil t)
295 (eldoc-remove-command "hexl-save-buffer"
322 (remove-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer t))
327 (defvar hexl-in-save-buffer nil)
329 (defun hexl-save-buffer ()
330 "Save a hexl format buffer as binary in visited file if modified."
332 (if hexl-in-save-buffer nil
333 (restore-buffer-modified-p
334 (if (buffer-modified-p)
335 (let ((buf (generate-new-buffer " hexl"))
336 (name (buffer-name))
340 (with-current-buffer buf
341 (insert-buffer-substring name start end)
342 (set-buffer name)
343 (dehexlify-buffer)
345 (let ((hexl-in-save-buffer t))
346 (save-buffer))
347 (setq modified (buffer-modified-p))
349 (insert-buffer-substring buf start end)
350 (kill-buffer buf)
360 Switch to a buffer visiting file FILENAME, creating one if none exists,
366 ;; Ignore the user's setting of default-major-mode.
374 With arg, don't unhexlify buffer."
377 (let ((modified (buffer-modified-p))
380 (dehexlify-buffer)
381 (remove-hook 'write-contents-functions 'hexl-save-buffer t)
382 (restore-buffer-modified-p modified)
385 (when (eq (coding-system-eol-type buffer-file-coding-system) 1)
393 (remove-hook 'change-major-mode-hook 'hexl-maybe-dehexlify-buffer t)
418 (defun hexl-maybe-dehexlify-buffer ()
419 "Convert a hexl format buffer to binary.
422 (let ((modified (buffer-modified-p))
425 (dehexlify-buffer)
426 (remove-hook 'write-contents-functions 'hexl-save-buffer t)
427 (restore-buffer-modified-p modified)
455 "Return buffer position for ADDRESS."
461 Signal error if ADDRESS is out of range."
464 (error "Out of hexl region"))
469 Signal error if HEX-ADDRESS is out of range."
517 (message "End of buffer.")
522 (message "End of buffer.")
528 (message "End of buffer.")
536 (message "Beginning of buffer.")))
556 (message "End of buffer.")
561 (message "End of buffer.")
567 (message "End of buffer.")
575 (message "Beginning of buffer.")))
596 (progn (message "Out of hexl region.")
603 (progn (message "Out of hexl region.")
610 (defun hexl-beginning-of-buffer (arg)
611 "Move to the beginning of the hexl buffer.
613 With prefix arg N, puts point N bytes of the way from the true beginning."
618 (defun hexl-end-of-buffer (arg)
624 (defun hexl-beginning-of-line ()
625 "Goto beginning of line in hexl mode."
629 (defun hexl-end-of-line ()
630 "Goto end of line in hexl mode."
638 "Scroll hexl buffer window upward ARG lines; or near full window if no ARG."
646 "Scroll hexl buffer window upward ARG lines; or near full window if no ARG.
656 ;; If possible, try to stay at the same offset from the beginning
657 ;; of the 16-byte group, even if we move to the first or last
667 (message "Out of hexl region."))
671 (defun hexl-beginning-of-1k-page ()
672 "Go to beginning of 1KB boundary."
676 (defun hexl-end-of-1k-page ()
677 "Go to end of 1KB boundary."
684 (defun hexl-beginning-of-512b-page ()
685 "Go to beginning of 512 byte boundary."
689 (defun hexl-end-of-512b-page ()
690 "Go to end of 512 byte boundary."
708 (defun hexlify-buffer ()
709 "Convert a binary buffer to hexl format.
710 This discards the buffer's undo information."
712 (and (consp buffer-undo-list)
715 (setq buffer-undo-list nil))
716 ;; Don't decode text in the ASCII part of `hexl' program output.
718 (coding-system-for-write buffer-file-coding-system)
719 (buffer-undo-list t))
724 ;; coding-system-for-write (i.e. buffer-file-coding-system) which
733 (defun dehexlify-buffer ()
734 "Convert a hexl format buffer to binary.
735 This discards the buffer's undo information."
737 (and (consp buffer-undo-list)
740 (setq buffer-undo-list nil))
742 (coding-system-for-read buffer-file-coding-system)
743 (buffer-undo-list t))
786 Non-ASCII characters are first encoded with `buffer-file-coding-system',
789 (coding (if (or (null buffer-file-coding-system)
791 (eq (coding-system-type buffer-file-coding-system) t))
792 default-buffer-file-coding-system
793 buffer-file-coding-system)))
805 ;; cannot be safely encoded with buffer-file-coding-system.
807 ;; of that character, byte by byte.
818 "Can't encode `0x%x' with this buffer's coding system; try \\[hexl-insert-hex-string]"
829 Non-ASCII characters are first encoded with `buffer-file-coding-system',
835 "Insert the character CH NUM times in a hexl buffer.
863 (beginning-of-line)
875 (error "Hex number out of range")
908 (error "Decimal number out of range")
916 (error "Decimal number out of range")
973 "Return the range of address region for the point.
976 (line-beginning-position)
978 (+ (line-beginning-position) 9)))
995 ;; regardless of the header-line face.
998 (put-text-property (match-beginning 0) pos 'display
1018 ;; inserting them into the buffer.
1032 (define-key hexl-mode-map [home] 'hexl-beginning-of-line)
1033 (define-key hexl-mode-map [end] 'hexl-end-of-line)
1034 (define-key hexl-mode-map [C-home] 'hexl-beginning-of-buffer)
1035 (define-key hexl-mode-map [C-end] 'hexl-end-of-buffer)
1042 (define-key hexl-mode-map "\C-a" 'hexl-beginning-of-line)
1045 (define-key hexl-mode-map "\C-e" 'hexl-end-of-line)
1064 (define-key hexl-mode-map "\e\C-a" 'hexl-beginning-of-512b-page)
1067 (define-key hexl-mode-map "\e\C-e" 'hexl-end-of-512b-page)
1092 (define-key hexl-mode-map "\e<" 'hexl-beginning-of-buffer)
1093 (define-key hexl-mode-map "\e>" 'hexl-end-of-buffer)
1101 (define-key hexl-mode-map "\C-x[" 'hexl-beginning-of-1k-page)
1102 (define-key hexl-mode-map "\C-x]" 'hexl-end-of-1k-page)
1104 (define-key hexl-mode-map "\C-x\C-s" 'hexl-save-buffer)