From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: D. Goel Newsgroups: gmane.emacs.help Subject: xlock.el v. 0.0 Date: 01 Sep 2002 21:01:32 -0400 Organization: Posted via Supernews, http://www.supernews.com Sender: help-gnu-emacs-admin@gnu.org Message-ID: <87vg5p2oib.fsf@computer.localdomain> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1030929277 30545 127.0.0.1 (2 Sep 2002 01:14:37 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 2 Sep 2002 01:14:37 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 17lfnX-0007wY-00 for ; Mon, 02 Sep 2002 03:14:35 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10) id 17lfoy-000144-00; Sun, 01 Sep 2002 21:16:04 -0400 Original-Path: shelby.stanford.edu!nntp.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!tethys.csu.net!nntp!sn-xit-05!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Original-X-Complaints-To: newsabuse@supernews.com Original-Lines: 214 Original-Xref: nntp.stanford.edu gnu.emacs.help:104389 Original-To: help-gnu-emacs@gnu.org Errors-To: help-gnu-emacs-admin@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.0.11 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.help:955 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:955 ;;; xlock.el --- Create your own locks...cycle through xmodmap files.... INTRODUCTION: ============ xlock assists you with 'creating your own locks' by cycling through/choosing various xmodmap-specifications. This is perhaps not even worth being called an elisp libary, so not posted to g.e.sources, unless it acquires more features :) I could not figure out how to use xmodmap to create additional locks in addition to the default caps, num and scroll lock. I wanted to create a lock that 'shifts' the keys 1,2,3..9,0. Help on doing that would be appreciated .. Anyways, xlock.el is the result--> It just cycles through N different xmodmap files or allows you to choose any one of them. For the problem described above, the second xmodmap file had the shifted versions of the keys above. Those example .xmodmap files can be seen at the xlock-home-page. See also M-x xlock-quick-start. ----------------------------------------------------- ----------------CUT HERE ------------------------------- ;;; xlock.el --- Create your own locks...cycle through xmodmap files.... ;; Time-stamp: <02/09/01 20:56:59 deego> ;; Copyright (C) 2002 D. Goel ;; Emacs Lisp Archive entry ;; Filename: xlock.el ;; Package: xlock ;; Author: D. Goel ;; Version: 0.0 ;; Author's homepage: http://24.197.159.102/~deego ;; For latest version: (defvar xlock-home-page "http://24.197.159.102/~deego/pub/emacspub/lisp-mine/xlock/") ;; This file is NOT (yet) part of GNU Emacs. ;; 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 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, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;; See also: ;; Quick start: (defvar xlock-quick-start "Steps: [0] drop this in load-path and add (require 'xlock) in .emacs. [1] Create N xmodmap files, call them .xmodmap-0, .xmodmap-1... .xmodmap-\(N-1\). Or, get them from xlock-home-page :\) Note that the xmodmap specifications in these files should be 'absolute', not 'relative'... see xlock-home-page for some examples of these files. The files there also place the caps-ctrl and the alt-meta keys in the 'right' place [2] In .emacs \(setq xlock-max-num \). [3] From then on, M-x xlock-rotate will rotate between cycle through the various xmodmap files. Can also use the command M-x xlock-set to choose an arbitrary lock [4] Bind some keys, say: (global-set-key [f8 f8] 'xlock-rotate) (global-set-key [f8 f9] 'xlock-set) " ) (defun xlock-quick-start () "Provides electric help regarding variable `xlock-quick-start'." (interactive) (with-electric-help '(lambda () (insert xlock-quick-start) nil) "*doc*")) ;;; Introduction: ;; Stuff that gets posted to gnu.emacs.sources ;; as introduction (defvar xlock-introduction " xlock assists you with 'creating your own locks' by cycling through/choosing various xmodmap-specifications. This is perhaps not even worth being called an elisp libary, so not posted to g.e.sources, unless it acquires more features :) I could not figure out how to use xmodmap to create additional locks in addition to the default caps, num and scroll lock. I wanted to create a lock that 'shifts' the keys 1,2,3..9,0. Help on doing that would be appreciated .. Anyways, xlock.el is the result--> It just cycles through N different xmodmap files or allows you to choose any one of them. For the problem described above, the second xmodmap file had the shifted versions of the keys above. Those example .xmodmap files can be seen at the xlock-home-page. See also M-x xlock-quick-start. " ) ;;;###autoload (defun xlock-introduction () "Provides electric help regarding variable `xlock-introduction'." (interactive) (with-electric-help '(lambda () (insert xlock-introduction) nil) "*doc*")) ;;; Commentary: (defvar xlock-commentary "This is such a minor hack that calling this a library is perhaps a shame :\). " ) (defun xlock-commentary () "Provides electric help regarding variable `xlock-commentary'." (interactive) (with-electric-help '(lambda () (insert xlock-commentary) nil) "*doc*")) ;;; History: ;;; Bugs: ;;; New features: (defvar xlock-new-features "none.." ) (defun xlock-new-features () "Provides electric help regarding variable `xlock-new-features'." (interactive) (with-electric-help '(lambda () (insert xlock-new-features) nil) "*doc*")) ;;; TO DO: (defvar xlock-todo "none.." ) (defun xlock-todo () "Provides electric help regarding variable `xlock-todo'." (interactive) (with-electric-help '(lambda () (insert xlock-todo) nil) "*doc*")) (defvar xlock-version "0.0") ;;========================================== ;;; Code: (defgroup xlock nil "The group xlock" :group 'applications) (defcustom xlock-before-load-hooks nil "" :group 'xlock) (defcustom xlock-after-load-hooks nil "" :group 'xlock) (run-hooks 'xlock-before-load-hooks) (defvar xlock-max-num 2) (defvar xlock-current 1) ;;;###autoload (defun xlock-rotate () (interactive) (setq xlock-current (mod (+ xlock-current 1) xlock-max-num)) (xlock-set xlock-current)) ;;;###autoload (defun xlock-set (num) (interactive "n Lock number: ") (shell-command (format "xmodmap ~/.xmodmap-%S" num)) (message "Lock number %S set" num)) (provide 'xlock) (run-hooks 'xlock-after-load-hooks) ;;; xlock.el ends here