🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.misc.discuss
Article #2161

Re: About emacs (and anything else if you want :-)

#2161
From: Erik Naggum
Date: Thu, 06 Jul 1995 00:00
112 lines
5457 bytes
[reposted to correct a bug and to add copyright]

[Francesco Potorti`]

|   Most people use workstations with graphical consoles, but terminal
|   emulators are used too, and you don't want to use X over a SLIP line
|   from home.

I do that.  it's not too slow or painful.  leased line, 14400 modems, 38400
between modem and computer and modem and the Portmaster at the other end,
so compression is pretty good.  the only thing that's painfully slow is
graphics.  granted, when I need to do a lot of editing, I use ange-ftp.
(thanks, Ange!  it's indispensible.)

oh, while I'm at it: I have disabled the interaction with the X cut buffers
when killing with keyboard commands.  the speed improvement is noticeable,
and I don't think I want cut buffers unless I use the mouse, anyway.

[I have cross-posted this to gnu.emacs.sources because of the code.
followups are restricted back to gnu.misc.discuss.]

;;; x-toggle.el --- toggle use of X cut buffer for keyboard kills

;; Copyright (C) 1995 Free Software Foundation, Inc.

;; Author: Erik Naggum
;; Maintainer: Erik Naggum <erik@naggum.no>
;; Keywords: extensions

;; This file is not part of GNU Emacs, but is a customization to it.

;; This is free software; you can redistribute it and/or modify it under
;; the terms of the GNU General Public License as published by the Free
;; Software Foundation; either version 2, or (at your option) any later
;; version.

;; This code is distributed in the hope that it will be useful, but WITHOUT
;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
;; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
;; for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

;;; Commentary:

;; When using Emacs with X over slow lines, cut and paste operations take
;; much time.  When used with mouse operations, such delays may be
;; tolerated, but it becomes a burden with keyboard functions that kill or
;; paste text.  This file contains a function, `toggle-cut/paste-mode',
;; that dynamically binds the variables that control the use of the cut
;; buffer, `interprogram-cut-function' and `interprogram-paste-function',
;; such that keyboard functions do not affect the X cut buffer, but mouse
;; operations continue to use them.  This is done by binding the functions
;; to a wrapper function that uses the property `original-value' of the
;; variables, and the property `original-function' for the redefined
;; functions.

;;; Code:

(defvar mouse-function-list
  '(mouse-set-region mouse-drag-region mouse-kill mouse-yank-at-click
    mouse-kill-ring-save mouse-save-then-kill mouse-start-secondary
    mouse-set-secondary mouse-drag-secondary mouse-yank-secondary
    mouse-secondary-save-then-kill)
  "List of functions modified by `toggle-cut/paste-mode', q.v.")

(defun toggle-cut/paste-mode ()
  "Toggle the use of the X cut buffer (selection) in keyboard kill functions.
Mouse operations will use the X facilities regardless of the mode setting.
Returns nil if the original functions are in operations, t if modified."
  (interactive)
  (if window-system
    (let ((original-cut-function (get 'interprogram-cut-function 'original-value))
	  (original-paste-function (get 'interprogram-paste-function 'original-value)))
      (cond (interprogram-cut-function
	     (put 'interprogram-cut-function 'original-value interprogram-cut-function)
	     (put 'interprogram-paste-function 'original-value interprogram-paste-function)
	     (setq interprogram-cut-function nil
		   interprogram-paste-function nil)
	     (mapcar
	      (lambda (symbol)
		(put symbol 'original-function (symbol-function symbol))
		(fset symbol
		      (lambda (&rest ignore-arguments)
			(let ((interprogram-cut-function
			       (get 'interprogram-cut-function 'original-value))
			      (interprogram-paste-function
			       (get 'interprogram-paste-function 'original-value)))
			  (call-interactively (get this-command 'original-function)))
			)))
	      mouse-function-list)
	     t)
	    (t
	     (setq interprogram-cut-function original-cut-function
		   interprogram-paste-function original-paste-function)
	     (mapcar
	      (lambda (symbol)
		(fset symbol (get symbol 'original-function)))
	      mouse-function-list)
	     nil)))))

(toggle-cut/paste-mode)

;;; float.el ends here

#<Erik 3014032287>
-- 
NETSCAPISM /net-'sca-,pi-z*m/ n (1995): habitual diversion of the mind to
    purely imaginative activity or entertainment as an escape from the
    realization that the Internet was built by and for someone else.
Technical Details
Message-ID: <19950706T151127Z@naggum.no>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <1995Jul6.074742@cantva> <m0sTmyT-0003zcC@fly.CNUCE.CNR.IT>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1025b4,c461e14f187bd364
X-Google-Attributes: gid1025b4,public
X-Google-Thread: 107729,233a01b99d6c7c1,start
X-Google-Attributes: gid107729,public
From: erik@naggum.no (Erik Naggum)
Subject: Re: About emacs (and anything else if you want :-)
Date: 1995/07/06
Message-ID: <19950706T151127Z@naggum.no>
X-Deja-AN: 105759417
references: <1995Jul6.074742@cantva> <m0sTmyT-0003zcC@fly.CNUCE.CNR.IT>
supersedes: <19950706T132947Z@naggum.no>
followup-to: gnu.misc.discuss
organization: Naggum Software; +47 2295 0313
newsgroups: gnu.misc.discuss,gnu.emacs.sources