- (cond ((or (<= end start) (<= end 0)
- (<= vlf-file-size start))
- (when (or (not (buffer-modified-p))
- (y-or-n-p "Chunk modified, are you sure? "))
- (erase-buffer)
- (set-buffer-modified-p nil)
- (let ((place (if (<= vlf-file-size start)
- vlf-file-size
- 0)))
- (setq vlf-start-pos place
- vlf-end-pos place)
- (or minimal (vlf-update-buffer-name))
- (cons (- start place) (- place end)))))
- ((or (/= start vlf-start-pos)
- (/= end vlf-end-pos))
- (let ((shifts (vlf-move-to-chunk-1 start end)))
- (and shifts (not minimal)
- (vlf-update-buffer-name))
- shifts))))
+ (if (or (<= end start) (<= end 0)
+ (<= vlf-file-size start))
+ (when (or (not (buffer-modified-p))
+ (y-or-n-p "Chunk modified, are you sure? "))
+ (erase-buffer)
+ (set-buffer-modified-p nil)
+ (let ((place (if (<= vlf-file-size start)
+ vlf-file-size
+ 0)))
+ (setq vlf-start-pos place
+ vlf-end-pos place)
+ (cons (- start place) (- place end))))
+ (if (derived-mode-p 'hexl-mode)
+ (setq start (- start (mod start hexl-bits))
+ end (+ end (- hexl-bits (mod end hexl-bits)))))
+ (if (or (/= start vlf-start-pos)
+ (/= end vlf-end-pos))
+ (vlf-move-to-chunk-1 start end))))