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

Bug#170773: marked as done ([max-appolo@mail.ru: CWEB Emacs mode])



Your message dated Tue, 26 Aug 2008 16:39:41 +0200
with message-id <20080826143941.GA3876@PC23>
and subject line Re: [max-appolo@mail.ru: CWEB Emacs mode]
has caused the Debian Bug report #170773,
regarding [max-appolo@mail.ru: CWEB Emacs mode]
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
170773: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=170773
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: cweb
Version: 3.64-3

A reminder to myself....

Also, c++lib.w should be included in the package....

   Julian

----- Forwarded message from Max Vasin <max-appolo@mail.ru> -----

Date: Mon, 25 Nov 2002 19:05:16 +0300
From: Max Vasin <max-appolo@mail.ru>
Subject: CWEB Emacs mode
To: jdg@debian.org

Hello,
 I've modified original Knuth's cweb.el to make it mode suitable (in my 
opinion) for Emacs 20 - 21, added some customisation
options and changed (and made customisable) keybindings not to conflict 
with standard Emacs key bindings. Would you like
to include this CWEB mode in cweb package?

-- 
With best regards,
Max Vasin.

----- End forwarded message -----

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

        Julian Gilbey, website: http://www.polya.uklinux.net/
   Debian GNU/Linux Developer, see: http://people.debian.org/~jdg/
     Visit http://www.thehungersite.com/ to help feed the hungry
;; This file contains extensions to GNU-Emacs, to wit:
; (1) some WEB-oriented functions that are also of general use
; (2) changes to the GNU-distributed TeX mode
; (3) definitions of simple WEB and CWEB modes

; To use: Put this in your EMACS-lisp library and say (load-library "cweb")
; in your .emacs init file.

; Contributed by Don Knuth, July 1990

;; OK, here's part (1): some WEB-oriented functions whose main purpose is
; to maintain a stack of module names that are "pending" as you are writing
; a program. When you first think of a module that needs to be written later,
; put it into the pending list (by typing CTL-Z instead of @> after the
; name). Later you can say CTL-\ to retrieve a pending name (and if
; you want to cycle through the pending names, ESC-y after CTL-\ will
; do it, just as ESC-y works after a yank).
; After you've said CTL-\, the current region is the name just removed from
; the pending list. If you change your mind, you can put it back again by
; saying ESC-\. If you had put it into the pending list by mistake, you
; can get rid of it by using the normal CTL-W operation (kill-region).
; The following code binds the new commands to CTL-Z, CTL-\, and ESC-\
; in all modes. You may prefer other bindings, of course.
; CTL-Z is normally "suspend emacs", but it is best not used when emacs
; has its own window as it usually does nowadays; if you need the
; old CTL-Z, you might rather bind it to CTL-X CTL-Z.
; CTL-\ is normally undefined.
; ESC-\ is normally "delete space", but ESC-space DEL does that easily too.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; 
;;      $Id: cwebm.el,v 1.3 2002/11/20 18:12:48 max Exp $
;;
;; Modifications by Max Vasin <max-appolo@mail.ru>, September - November 2002.
;; Key bindings:
;;   1. C-\ --> C-cwy
;;   2. M-\ --> C-cws
;;   3. C-z --> C-cwr
;; The first and second modifications are important for me because:
;;   1. C-\ switches keyboard layout (on my Linux box English <--> Russian).
;;   2. I've used to use M-\.
;; The third modification was made to unify key bindings.
;;
;; Base mode modified form plain-TeX to latex, since I use cweb-latex.
;;
;; Base keybings are now taken from the latex mode, instead of creaing 
;; them from scratch.
;;
;; Key bindings for commands operating on module names pending list
;; made local.
;;
;; `TeX-validate-paragraph' function is now beeing defined in this package,
;; since it is defined in the file auc-old.el, which is provided for 
;; compatability with AUC-TeX 6.x. `TeX-validate-paragraph' renamed to
;; `cwebm-validate-paragraph'.
;;
;; Package was renamed to cwebm.el
;; Suffix `cwebm-' added to function names, `TeX-' suffix chaged to `cwebm-'.
;;
;; Added customisation support.
;;
;; $Log: cwebm.el,v $
;; Revision 1.3  2002/11/20 18:12:48  max
;; cwebm-make-common-settings: New function.
;; Comments start and end are set up correctly.
;; cwebm-base-mode: New customisation variable.
;; Customisation type 'sexp changed to 'string.
;;
;; Revision 1.2  2002/11/09 11:44:39  max
;; Added customisation support.
;; Paragraph validation made conditional.
;;
;; Revision 1.1  2002/10/13 16:02:21  max
;; Initial revision
;;
;;

(require 'tex)

(defgroup CWEBm nil
  "Major mode for editing CWEB and WEB programs"
  :prefix "cwebm-"
  :group 'languages)

(defcustom cwebm-validate-paragraph nil
  "Specifies whether to validate paragraph when you leave it."
  :type 'boolean
  :group 'CWEBm)

(defcustom cwebm-base-mode "latex-mode"
  "Specifies base mode for CWEBm"
  :type 'string
  :group 'CWEBm)

(defcustom cwebm-new-module-name-key-binding "\\C-cwr"
  "Specifies key binding for adding new module name into pending list."
  :type 'string
  :group 'CWEBm)

(defcustom cwebm-new-module-name-key-binding "\\C-cwr"
  "Specifies key binding for adding new module name into pending list."
  :type 'string
  :group 'CWEBm)

(defcustom cwebm-pop-module-name-key-binding "\\C-cwy"
  "Specifies key binding to remove first element from pending list
and insert it as current region."
  :type 'string
  :group 'CWEBm)

(defcustom cwebm-into-pending-list-key-binding "\\C-cws"
  "Specifies key binding to copy region into pending-list."
  :type 'string
  :group 'CWEBm)

(defcustom cwebm-into-pending-list-key-binding "\\C-cws"
  "Specifies key binding to copy region into pending-list."
  :type 'string
  :group 'CWEBm)

(defcustom cwebm-ditto-key-binding "\\M-\\\""
  "Specifies key binding to copy characters from the line above"
  :type 'string
  :group 'CWEBm)

(defun cwebm-process-key-binding (string)
  "Process a string representation of key binding to allow easy key binding
customisation."
  (read (concat "\"" string "\"")))

(defvar cwebm-pending-list nil
 "List of strings (usually WEB module names) still pending.")

(defun cwebm-into-pending-list (beg end)
 "Copy region into cwebm-pending-list."
 (interactive "r")
 (cwebm-indicate-region)
 (setq cwebm-pending-list (cons (buffer-substring beg end) cwebm-pending-list)))

(defun cwebm-new-module-name-pending ()
 "Insert @> to complete a module name, then put it into cwebm-pending-list."
 (interactive)
 (insert "@>")
 (push-mark)
 (if (search-backward "@<" nil t)
     (progn
       (exchange-point-and-mark)
       (cwebm-into-pending-list (point) (mark)))
   (message "There's no @< to begin the module name!")))

(defun cwebm-pop-pending-list (arg)
 "Remove first element of cwebm-pending-list and insert it as current region.
With argument, put point at left; otherwise point will follow the insertion.
Say \\[cwebm-new-yank-pop] to replace this by another element of the list.
Say \\[cwebm-into-pending-list] to put it back in the list."
 (interactive "*P")
 (if (consp cwebm-pending-list)
     (progn
       (push-mark (point))
       (insert (car cwebm-pending-list))
       (setq cwebm-pending-list (cdr cwebm-pending-list))
       (if arg
           (exchange-point-and-mark)))
   (message "Nothing is pending.")
   (setq this-command nil)))

(defun cwebm-new-yank-pop (arg)
 "If previous command was \\[cwebm-pop-pending-list], pop a different string;
otherwise do an ordinary Meta-y."
 (interactive "*p")
 (if (eq last-command 'cwebm-pop-pending-list)
     (let (xch)
       (setq xch (< (point) (mark)))
       (setq cwebm-pending-list (append cwebm-pending-list
                                 (list (buffer-substring (point) (mark)))))
       (delete-region (point) (mark))
       (setq this-command 'cwebm-pop-pending-list)
       (cwebm-pop-pending-list xch))
   (yank-pop arg)))
(global-set-key "\M-y" 'cwebm-new-yank-pop)

(defun cwebm-indicate-region ()
  "Bounce cursor to mark and back again"
  (let ((point-save (point)))
    (unwind-protect
        (progn (goto-char (mark))
               (sit-for 0 300)) ;; wait 300 milliseconds
      (goto-char point-save))))

; I prefer to change the standard copy-region command to the following,
; which gives me visual feedback about what I've copied to the kill ring:
(defun cwebm-indicate-and-copy-region (beg end)
  "Indicate current region, then copy it to the kill ring."
  (interactive "r")
  (cwebm-indicate-region)
  (copy-region-as-kill beg end))
(global-set-key "\M-w" 'cwebm-indicate-and-copy-region)

; Here's another convenient command, bound to the usually unused ESC-".
(defun cwebm-ditto (arg)
  "Copy ARG characters from the line above."
  (interactive "*p")
  (let (ch)
    (while (> arg 0)
      (setq temporary-goal-column (current-column))
      (save-excursion
        (previous-line 1)
        (setq ch (following-char)))
      (insert ch)
      (setq arg (1- arg)))))
(global-set-key (cwebm-process-key-binding cwebm-ditto-key-binding) 'cwebm-ditto)

;; OK, here's part (2): Changes to TeX mode.
; The WEB modes below are very much like TeX mode, but some improvements were
; desirable in TeX mode:
; I made newline act as it does in indented-text mode, since this
; works nicely for both TeX and WEB (Pascal or C code).
; I made RET check for unmatched delimiters if it ends a paragraph.
; Otherwise TeX mode remains as it was before.

(define-key TeX-mode-map "\C-c\C-k" 'TeX-kill-job)
(define-key TeX-mode-map "\C-c\C-l" 'TeX-recenter-output-buffer)
(define-key TeX-mode-map "\C-c\C-p" 'TeX-print)
(define-key TeX-mode-map "\e}" 'up-list)
(define-key TeX-mode-map "\e{" 'TeX-insert-braces)
(define-key TeX-mode-map "\C-c\C-r" 'TeX-region)
(define-key TeX-mode-map "\C-c\C-b" 'TeX-buffer)
(define-key TeX-mode-map "\r" 'cwebm-newline)
(define-key TeX-mode-map "\t" 'LaTeX-indent-line)
(setq TeX-mode-hook '(lambda ()
  (make-local-variable 'indent-line-function)
  (setq indent-line-function 'indent-relative-maybe)))

(defun cwebm-newline (arg)
"If previous character is newline and no ARG, check for unbalanced braces
and/or dollar signs in previous paragraph. If ARG is \\[universal-argument],
do a single newline; otherwise do ordinary newline."
 (interactive "*P")
 (if (and (eq (preceding-char) ?\n) (not arg) cwebm-validate-paragraph)
     (cwebm-check-paragraph)
   (if (listp arg)
       (newline)
     (newline arg))))

(defun cwebm-validate-paragraph (start end)
  (condition-case ()
      (save-excursion
	(save-restriction
	  (narrow-to-region start end)
	  (goto-char start)
	  (forward-sexp (- end start))
	  t))
    (error nil)))

(defun cwebm-check-paragraph ()
"Insert a newline following a newline, breaking a paragraph for TeX.
Check for mismatched delimiters in paragraph being terminated."
  (interactive)
  (if (cwebm-validate-paragraph
           (save-excursion
             (search-backward "\n\n" nil 'move)
             (point))
           (point))
      (insert ?\n)
    (insert ?\n)
    (error "Mismatched delimiters in that paragraph?")))

;; and now, part (3): WEB and CWEB modes.
; These are like plain TeX mode except that the automatic conversion of
; " to `` or '' is disabled. (Personally I never liked that feature anyway,
; since it's easy to get used to typing `` and ''. In WEB modes, the
; feature soon becomes intolerable, unless you never use string constants!)
; Another thing distinguishing WEB mode from TeX is ESC-p and ESC-n, to
; move to previous or next module. These keys are usually unbound, except
; when processing email.

(defun cwebm-forward-module (arg)
"Advance past next WEB module beginning; with ARG, repeat ARG times."
 (interactive "p")
 (cwebm-move-to-module arg))
(defun cwebm-backward-module (arg)
"Advance to previous WEB module beginning; with ARG, repeat ARG times."
 (interactive "p")
 (cwebm-move-to-module (- arg)))
(defun cwebm-move-to-module (arg)
 (while (> arg 0)
   (re-search-forward "@ \\|@\\*\\|@\n")
   (setq arg (1- arg)))
 (while (< arg 0)
   (re-search-backward "@ \\|@\\*\\|@\n")
   (setq arg (1+ arg))))

(defun cwebm-make-common-settings ()
  "Make settings common for both WEBm and CWEBm modes"
  ;; house-keeping first
  (kill-all-local-variables)

  ;; set base mode
  (funcall (intern cwebm-base-mode))

  ;; install local keybindings
  (local-set-key (cwebm-process-key-binding cwebm-new-module-name-key-binding) 'cwebm-new-module-name-pending)
  (local-set-key (cwebm-process-key-binding cwebm-pop-module-name-key-binding) 'cwebm-pop-pending-list)
  (local-set-key (cwebm-process-key-binding cwebm-into-pending-list-key-binding) 'cwebm-into-pending-list)
  (local-set-key "\M-n" 'cwebm-forward-module)
  (local-set-key "\M-p" 'cwebm-backward-module)
  (local-set-key "\"" 'self-insert-command)

  ;; set comments start and end
  (make-local-variable 'comment-start)
  (setq comment-start "%")
  (make-local-variable 'comment-end)
  (setq comment-end ""))  

(defun webm-mode ()
  "Major mode like TeX mode plus \\[forward-module] and \\[backward-module]
for relative module movement. The automatic \" feature is disabled."
  (interactive)

  ;; make settings common for both CWEBm and WEBm modes
  (cwebm-make-common-settings)

  ;; let emacs know who we are
  (setq mode-name "WEBm")
  (setq major-mode 'web-mode)

  ;; run a hook if it exists
  (run-hooks 'web-mode-hook))
(setq auto-mode-alist (cons '("\\.web$" . web-mode) auto-mode-alist))

(defun cwebm-mode ()
  "Major mode like LaTeX mode plus \\[forward-module] and \\[backward-module]
for relative module movement. The automatic \" feature is disabled."
  (interactive)

  ;; make settings common for both CWEBm and WEBm modes
  (cwebm-make-common-settings)

  ;; let emacs know who we are
  (setq mode-name "CWEBm")
  (setq major-mode 'cwebm-mode)

  ;; run a hook if it exists
  (run-hooks 'cwebm-mode-hook))

(setq auto-mode-alist (cons '("\\.w$" . cwebm-mode) auto-mode-alist))
(setq auto-mode-alist (cons '("\\.ch$" . cwebm-mode) auto-mode-alist))

(provide 'cwebm)

--- End Message ---
--- Begin Message ---
On 26.11.02 Julian Gilbey (jdg@debian.org) wrote:

> Package: cweb
> Version: 3.64-3
> 
> A reminder to myself....
> 
> Also, c++lib.w should be included in the package....
> 
The new module is provided by emacs-goodies-el since 25.1-1 (see
#326772) -> Closing.

H.
-- 
sigmentation fault


--- End Message ---

Reply to: