view lisp/play/studly.el @ 108806:511da81b16c5

Change delete-by-moving-to-trash so Lisp calls explicitly request trashing. * src/fileio.c (Fdelete_file): Change meaning of optional arg to mean whether to trash. (internal_delete_file, Frename_file): Callers changed. (delete_by_moving_to_trash): Doc fix. (Fdelete_directory_internal): Don't move to trash. * src/callproc.c (delete_temp_file): * src/buffer.c (Fkill_buffer): Callers changed. * src/lisp.h: Update prototype. * lisp/diff.el (diff-sentinel): * lisp/epg.el (epg--make-temp-file, epg-decrypt-string) (epg-verify-string, epg-sign-string, epg-encrypt-string): * lisp/jka-compr.el (jka-compr-partial-uncompress) (jka-compr-call-process, jka-compr-write-region): * lisp/server.el (server-sentinel): Remove optional arg from delete-file, reverting 2010-05-03 change. * lisp/dired.el (dired-delete-file): New arg TRASH. (dired-internal-do-deletions): New arg TRASH. Use progress reporter. (dired-do-flagged-delete, dired-do-delete): Use trash. * lisp/files.el (delete-directory): New arg TRASH. * lisp/speedbar.el (speedbar-item-delete): Allow trashing. * lisp/net/ange-ftp.el (ange-ftp-del-tmp-name, ange-ftp-delete-file) (ange-ftp-rename-remote-to-remote) (ange-ftp-rename-local-to-remote) (ange-ftp-rename-remote-to-local, ange-ftp-load) (ange-ftp-compress, ange-ftp-uncompress): Remove optional arg from `delete-file'. (ange-ftp-delete-directory): Add optional arg to `delete-file', to allow trashing. * lisp/net/tramp-compat.el (tramp-compat-delete-file): Rewrite to handle new TRASH arg of `delete-file'. * lisp/net/tramp-fish.el (tramp-fish-handle-delete-directory) (tramp-fish-handle-delete-file) (tramp-fish-handle-make-symbolic-link) (tramp-fish-handle-process-file): Use null TRASH arg in `tramp-compat-delete-file' call. * lisp/net/tramp-ftp.el (tramp-ftp-file-name-handler): Use null TRASH arg in `tramp-compat-delete-file' call. * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-delete-file): Rename arg. (tramp-gvfs-handle-write-region): Use null TRASH arg in `tramp-compat-delete-file' call. * lisp/net/tramp-imap.el (tramp-imap-handle-delete-file): Rename arg. (tramp-imap-do-copy-or-rename-file): Use null TRASH arg in `tramp-compat-delete-file' call. * lisp/net/tramp-smb.el (tramp-smb-handle-copy-file) (tramp-smb-handle-file-local-copy, tramp-smb-handle-rename-file) (tramp-smb-handle-write-region): Use null TRASH arg in tramp-compat-delete-file call. (tramp-smb-handle-delete-directory): Use tramp-compat-delete-file. (tramp-smb-handle-delete-file): Rename arg. * lisp/net/tramp.el (tramp-handle-delete-file): Change FORCE arg to TRASH. (tramp-handle-make-symbolic-link, tramp-handle-load) (tramp-do-copy-or-rename-file-via-buffer) (tramp-do-copy-or-rename-file-directly) (tramp-do-copy-or-rename-file-out-of-band) (tramp-handle-process-file, tramp-handle-call-process-region) (tramp-handle-shell-command, tramp-handle-file-local-copy) (tramp-handle-insert-file-contents, tramp-handle-write-region) (tramp-delete-temp-file-function): Use null TRASH arg in tramp-compat-delete-file call.
author Chong Yidong <cyd@stupidchicken.com>
date Thu, 27 May 2010 19:30:11 -0400
parents 950c45d670f2
children ef719132ddfa
line wrap: on
line source

;;; studly.el --- StudlyCaps (tm)(r)(c)(xxx)

;;; This is in the public domain, since it was distributed
;;; by its author in 1986 without a copyright notice.

;; This file is part of GNU Emacs.

;; Maintainer: FSF
;; Keywords: games

;;; Commentary:

;; Functions to studlycapsify a region, word, or buffer.  Possibly the
;; esoteric significance of studlycapsification escapes you; that is,
;; you suffer from autostudlycapsifibogotification.  Too bad.

;;; Code:

;;;###autoload
(defun studlify-region (begin end)
  "Studlify-case the region."
  (interactive "*r")
  (save-excursion
    (goto-char begin)
    (setq begin (point))
    (while (and (<= (point) end)
		(not (looking-at "\\W*\\'")))
      (forward-word 1)
      (backward-word 1)
      (setq begin (max (point) begin))
      (forward-word 1)
      (let ((offset 0)
	    (word-end (min (point) end))
	    c)
	(goto-char begin)
	(while (< (point) word-end)
	  (setq offset (+ offset (following-char)))
	  (forward-char 1))
	(setq offset (+ offset (following-char)))
	(goto-char begin)
	(while (< (point) word-end)
	  (setq c (following-char))
	  (if (and (= (% (+ c offset) 4) 2)
		   (let ((ch (following-char)))
		     (or (and (>= ch ?a) (<= ch ?z))
			 (and (>= ch ?A) (<= ch ?Z)))))
	      (progn
		(delete-char 1)
		(insert (logxor c ? ))))
	  (forward-char 1))
	(setq begin (point))))))

;;;###autoload
(defun studlify-word (count)
  "Studlify-case the current word, or COUNT words if given an argument."
  (interactive "*p")
  (let ((begin (point)) end rb re)
    (forward-word count)
    (setq end (point))
    (setq rb (min begin end) re (max begin end))
    (studlify-region rb re)))

;;;###autoload
(defun studlify-buffer ()
  "Studlify-case the current buffer."
  (interactive "*")
  (studlify-region (point-min) (point-max)))

(provide 'studly)

;; arch-tag: 0dbf5a60-d2e6-48c2-86ae-77fc8575ac67
;;; studly.el ends here