help-gnu-emacs
[Top][All Lists]
Advanced

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

.emacs to keep cursor stationary when scrolling with mouse


From: JohnF
Subject: .emacs to keep cursor stationary when scrolling with mouse
Date: Fri, 29 May 2015 02:19:41 +0000 (UTC)
User-agent: tin/2.2.1-20140504 ("Tober an Righ") (UNIX) (NetBSD/6.1.5 (i386))

I'm pretty clueless about emacs lisp, and have tried to set up
an .emacs that emulates dumb editor behavior. That works mostly
the way I want, except that when running under X and scrolling 
text with mouse (both scrolling with mouse wheel and dragging the
text bar on the window's right-hand side), the cursor still jumps around.
It remains stationary when scrolling with keyboard arrow-up/down and
keyboard page-up/down, which is what I want. But I can't get the
cursor to remain stationary when scrolling with the mouse.
How's that done???  Thanks. Here's my complete .emacs...

(setq major-mode 'text-mode)
(setq auto-mode-alist '(("." . text-mode)))
(setq make-backup-files  nil) ;;; no backup files
(setq auto-save-default  nil) ;;; no auto saving

(setq scroll-step 1)
(setq scroll-margin 0)
(setq scroll-preserve-screen-position 't) ;;; scroll without moving cursor
(setq scroll-conservatively 10000) ;;; (0 or 10000 seems same)
(setq auto-window-vscroll nil)
(setq scroll-up nil)
(setq scroll-down nil)
(setq scroll-up-aggressively nil)
(setq scroll-down-aggressively nil)
(setq next-screen-context-lines 0)
(mouse-wheel-mode 't) ;;; mouse-wheel enabled
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) ;;; 1 line at a time
(setq mouse-wheel-follow-mouse 't) ;;; scroll window under mouse
(setq indent-tabs-mode nil)
(setq blink-matching-paren nil)
(setq column-number-mode 't)
(setq size-indication-mode 't)

;;; open with single window
(setq inhibit-startup-screen 't)
(add-hook 'emacs-startup-hook 'delete-other-windows)

;;; initial frame width,height,position
(set-frame-width (selected-frame) 80)        ; #chars wide
(set-frame-height (selected-frame) 52)       ; #lines ling
(set-frame-position (selected-frame) 10 10 ) ; x y from upper-left

;;; insert tab character
(defun insert-tab ()
  (interactive)
  (insert "\t"))
(global-unset-key [tab])
(global-set-key (kbd "TAB") 'insert-tab)
;;; --- end-of-file ---

Thanks again,
-- 
John Forkosh  ( mailto:  j@f.com  where j=john and f=forkosh )


reply via email to

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