Commit 6c0554cf authored by David Byers's avatar David Byers

Workaround for pos-visible-in-window-p bug in Emacs (bug 1639).

Detailed changes:
> 2007-07-07  David Byers  <davby@sysinst-gw.sysinst.ida.liu.se>
>
> 	* edit-text.el (lyskom-edit-insert-buglist): Don't use interactive
> 	functions for non-interactive work (replace-regexp).
>
> 	* compatibility.el (lyskom-pos-visible-in-window-p-22-1):
> 	Workaround for bug in Gnu Emacs 22.1 pos-visible-in-window-p
>
parent 3a3219fd
2007-07-07 David Byers <davby@sysinst-gw.sysinst.ida.liu.se>
* edit-text.el (lyskom-edit-insert-buglist): Don't use interactive
functions for non-interactive work (replace-regexp).
* compatibility.el (lyskom-pos-visible-in-window-p-22-1):
Workaround for bug in Gnu Emacs 22.1 pos-visible-in-window-p
2007-06-30 <David Byers@GULAG>
* lyskom-rest.el (lyskom-do-insert): Support format state directly
......
......@@ -639,7 +639,7 @@ chosen according to this"
(t (format "%S" lyskom-current-prompt)))
t)))
(setq mode-line-process (lyskom-get-string 'mode-line-working))
(if (pos-visible-in-window-p (point-max))
(if (lyskom-pos-visible-in-window-p (point-max))
(save-excursion
(goto-char (point-max))
(lyskom-set-last-viewed)))
......@@ -650,7 +650,7 @@ chosen according to this"
(if (and (eq (window-buffer (selected-window))
(current-buffer)))
(progn
(if (pos-visible-in-window-p (1- (point-max)))
(if (lyskom-pos-visible-in-window-p (1- (point-max)))
(goto-char (point-max)))
(sit-for 0)))
(run-hooks 'lyskom-before-command-hook)
......@@ -676,7 +676,7 @@ chosen according to this"
(setq lyskom-current-prompt nil) ; Already set in s-o-c really
(lyskom-scroll)
(setq mode-line-process (lyskom-get-string 'mode-line-waiting))
(if (pos-visible-in-window-p (point-max) (selected-window))
(if (lyskom-pos-visible-in-window-p (point-max) (selected-window))
(lyskom-set-last-viewed))
(lyskom-prefetch-and-print-prompt)
(run-hooks 'lyskom-after-command-hook)
......
......@@ -1901,7 +1901,7 @@ See `kom-allow-incompleteness'."
(lyskom-format-insert 'no-created-confs pers)
(let ((window (get-buffer-window (current-buffer))))
(if (and window was-at-max)
(if (pos-visible-in-window-p (point-max) window)
(if (lyskom-pos-visible-in-window-p (point-max) window)
(goto-char (point-max))
(and kom-continuous-scrolling (lyskom-scroll)))))))
(quit (aset counter 0 t)
......
......@@ -686,6 +686,9 @@ send. If DONTSHOW is non-nil, don't display the sent message."
(t (setq lyskom-message-string (substring lyskom-message-string
0 size)))))))
(lyskom-with-external-functions (resize-minibuffer-setup
resize-minibuffer-mode)
(defun lyskom-send-message-turn-off-resize-on-exit ()
(resize-minibuffer-mode -1)
(remove-hook 'kom-send-message-exit-hook
......@@ -694,8 +697,6 @@ send. If DONTSHOW is non-nil, don't display the sent message."
;; USER-HOOK: lyskom-send-message-resize-minibuffer
(defvar resize-minibuffer-mode)
(lyskom-with-external-functions (resize-minibuffer-setup)
(defun lyskom-send-message-resize-minibuffer ()
"Temporarily turn on resizing of minibuffer"
(unless resize-minibuffer-mode
......
......@@ -688,6 +688,25 @@ Emacsen."
(defalias 'lyskom-string-to-number 'string-to-number)
(defalias 'lyskom-string-to-number 'string-to-int))
(defun lyskom-pos-visible-in-window-p-22-1 (&optional pos window)
"Workaround for the buggy pos-visible-in-window-p in Gnu Emacs"
(setq pos (or pos (point)))
(condition-case nil
(cond ((/= pos (point-max))
(pos-visible-in-window-p pos window))
((eq ?\n (char-after (1- (point-max))))
(pos-visible-in-window-p pos window))
(t (pos-visible-in-window-p (1- pos) window)))
(pos-visible-in-window-p pos window)))
(defalias 'lyskom-pos-visible-in-window-p 'pos-visible-in-window-p)
(when (and (not window-system)
(not (featurep 'xemacs))
(eq emacs-major-version 22)
(<= emacs-minor-version 1))
(defalias 'lyskom-pos-visible-in-window-p
'lyskom-pos-visible-in-window-p-22-1))
;;; ================================================================
;;; ================================================================
......
......@@ -135,7 +135,7 @@ The insertion will be at (point)."
nil
(let ((window (get-buffer-window lyskom-buffer)))
(if window
(if (pos-visible-in-window-p (point-max) window)
(if (lyskom-pos-visible-in-window-p (point-max) window)
nil
;; This means that this insertion moved point out of the
;; window. The scrolling becomes tricky. One big problem is
......
......@@ -1997,8 +1997,8 @@ buglist style, automating the removal of closed subjects and change-marks."
;; with a space wherever some form of "[ ]" follows
;; (and X:s, since some morons were too inept to
;; handle these highly advanced syntactic rules)
(while (re-search-backward "^\\s-*[!X][ \t(]*\\[" nil t)
(replace-regexp "^\\(\\s-*\\)[!X]\\([ \t(]*\\[\\)" "\\1 \\2"))
(while (re-search-backward "^\\(\\s-*\\)[!X]\\([ \t(]*\\[\\)" nil t)
(replace-match "\\1 \\2"))
(goto-char pb)
;; new pass; leave all [ ], [/] and [\] subjects untouched,
;; but remove the rest, except for category headers, who remain.
......
......@@ -156,7 +156,7 @@ same element's cdr."
(overlay-put lyskom-keyboard-menu-overlay
'face kom-mark-face))))
(save-excursion
(unless (pos-visible-in-window-p pos)
(unless (lyskom-pos-visible-in-window-p pos)
(recenter)))))
......
......@@ -217,7 +217,7 @@ interactively, all caches are cleared and the membership is re-read."
(defun kom-page-next-command ()
"Scroll the bottom to the top and run the next command if it should be run"
(interactive)
(if (pos-visible-in-window-p (point-max))
(if (lyskom-pos-visible-in-window-p (point-max))
(progn
(goto-char (point-max))
(recenter 0)
......@@ -234,7 +234,7 @@ interactively, all caches are cleared and the membership is re-read."
(defun kom-next-command ()
"Run next command or scroll one page."
(interactive)
(if (pos-visible-in-window-p (point-max))
(if (lyskom-pos-visible-in-window-p (point-max))
(lyskom-next-command)
(move-to-window-line -1)
(lyskom-set-last-viewed)
......@@ -268,7 +268,7 @@ interactively, all caches are cleared and the membership is re-read."
(defun kom-line-next-command ()
"Run next command or scroll one line."
(interactive)
(if (pos-visible-in-window-p (point-max))
(if (lyskom-pos-visible-in-window-p (point-max))
(lyskom-next-command)
(move-to-window-line 1)
(lyskom-set-last-viewed)
......@@ -1209,14 +1209,14 @@ The position lyskom-last-viewed will always remain visible."
(let ((win (cond ((eq (window-buffer (selected-window)) (current-buffer))
(selected-window))
(t nil))))
(when (and win (not (pos-visible-in-window-p (point-max))))
(when (and win (not (lyskom-pos-visible-in-window-p (point-max))))
(goto-char (point-max))
(recenter -1)
(unless (pos-visible-in-window-p lyskom-last-viewed)
(unless (lyskom-pos-visible-in-window-p lyskom-last-viewed)
(set-window-start win lyskom-last-viewed)
(move-to-window-line -1)
(vertical-motion 1)
(when (not (pos-visible-in-window-p))
(when (not (lyskom-pos-visible-in-window-p))
(forward-char -1)
(when (> (current-column) (window-width))
(backward-char (+ (- (current-column) (window-width)) 6)))
......@@ -1293,7 +1293,7 @@ is not on screen then doesn't move point."
(lyskom-trim-buffer))
(let ((window (get-buffer-window (current-buffer))))
(if (and window was-at-max)
(if (pos-visible-in-window-p (point-max) window)
(if (lyskom-pos-visible-in-window-p (point-max) window)
(goto-char (point-max))
(and kom-continuous-scrolling (lyskom-scroll)))))))
......@@ -1349,7 +1349,7 @@ The strings buffered are printed before the prompt by lyskom-update-prompt."
(set-marker oldpoint nil))
(let ((window (get-buffer-window (current-buffer))))
(if (and window
(not (pos-visible-in-window-p (point) window)))
(not (lyskom-pos-visible-in-window-p (point) window)))
;; This mease that the prompt has been pushed off the bottom
(save-selected-window
(select-window window)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment