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

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

xlock.el v. 0.0


From: D . Goel
Subject: xlock.el v. 0.0
Date: 01 Sep 2002 21:01:32 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

;;; 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 <address@hidden>
;; 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 <N>\).

[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


reply via email to

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