Merge branch 'master' of git.informatimago.com:/srv/git/public/emacs

Pascal J. Bourguignon [2016-10-31 12:42]
Merge branch 'master' of git.informatimago.com:/srv/git/public/emacs
Filename
insulte.el
pjb-animate.el
pjb-emacs.el
pjb-objc-edit.el
pjb-sources.el
trustonic.el
diff --git a/insulte.el b/insulte.el
new file mode 100644
index 0000000..cbb37f5
--- /dev/null
+++ b/insulte.el
@@ -0,0 +1,322 @@
+;;;; -*- mode:emacs-lisp;coding:utf-8;lexical-binding:t -*-
+;;;;**************************************************************************
+;;;;FILE:               insulte.el
+;;;;LANGUAGE:           emacs lisp
+;;;;SYSTEM:             POSIX
+;;;;USER-INTERFACE:     NONE
+;;;;DESCRIPTION
+;;;;
+;;;;    Captain Haddock's insults generator.
+;;;;
+;;;;AUTHORS
+;;;;    <PJB> Pascal J. Bourguignon <pjb@informatimago.com>
+;;;;MODIFICATIONS
+;;;;    2016-06-05 <PJB> Added distinction between ga and gap.
+;;;;    2015-06-17 <PJB> Translated from Common Lisp.
+;;;;BUGS
+;;;;LEGAL
+;;;;    AGPL3
+;;;;
+;;;;    Copyright Pascal J. Bourguignon 2015 - 2016
+;;;;
+;;;;    This program is free software: you can redistribute it and/or modify
+;;;;    it under the terms of the GNU Affero General Public License as published by
+;;;;    the Free Software Foundation, either version 3 of the License, or
+;;;;    (at your option) any later version.
+;;;;
+;;;;    This program 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 Affero General Public License for more details.
+;;;;
+;;;;    You should have received a copy of the GNU Affero General Public License
+;;;;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+;;;;**************************************************************************
+
+(require 'cl)
+(defvar *insulte-insults*)
+(defvar *insulte-nm*)
+(defvar *insulte-nf*)
+(defvar *insulte-ad*)
+
+(setf *insulte-insults* '(
+                          ("accapareur" (nm))
+                          ("aérolithe" (nm))
+                          ("amiral de bateau­lavoir" (gnm))
+                          ("amphitryon" (nm))
+                          ("anacoluthe" (nf))
+                          ("analphabète" (n a))
+                          ("anthracite" (nm))
+                          ("anthropophage" (nm a))
+                          ("anthropopithèque" (nm))
+                          ("apache" (nm))
+                          ("apprenti dictateur à la noix de coco" (gnm))
+                          ("arlequin" (nm))
+                          ("astronaute d'eau douce" (gn))
+                          ("athlète complet" (n))
+                          ("autocrate" (nm))
+                          ("autodidacte" (n a))
+                          ("azteque" (nm))
+                          ("babouin" (nm))
+                          ("bachi­bouzouk" (nm))
+                          ("bande de" (|...|))
+                          ("bandit" (nm))
+                          ("bayadère" (nf))
+                          ("bibendum" (nm))
+                          ("boit­sans­soif" (ni))
+                          ("brontosaure" (nm))
+                          ("bougre de" (|...|))
+                          ("brute" (nf))
+                          ("bulldozer à réaction" (gnm))
+                          ("vieux" (a p))
+                          ("cachalot" (nm))
+                          ("canaille" (nf))
+                          ("canaque" (nm a))
+                          ("cannibale" (nm))
+                          ("carnaval" (nm))
+                          ("catachrèse" (nf))
+                          ("cataplasme" (nm))
+                          ("cercopithèque" (nm))
+                          ("chauffard" (nm))
+                          ("chenapan" (nm))
+                          ("choléra" (nm))
+                          ("chouette mal empaillée" (gnf))
+                          ("cloporte" (nm))
+                          ("clysopompe" (nm))
+                          ("coléoptère" (nm))
+                          ("coloquinte" (nf))
+                          ("coquin" (n a))
+                          ("cornemuse" (nf))
+                          ("cornichon" (nm))
+                          ("corsaire" (nm))
+                          ("coupe­jarret" (nm))
+                          ("cow­boy de la route" (gnm))
+                          ("crétin des Alpes" (gnm))
+                          ("Cro­magnon" (np))
+                          ("cyanure" (nm))
+                          ("cyclone" (nm))
+                          ("cyclotron" (nm))
+                          ("Cyrano à quatre pattes" (gnm))
+                          ("diablesse" (nf))
+                          ("diplodocus" (nm))
+                          ("doryphore" (nm))
+                          ("dynamiteur" (nm))
+                          ("ecornifleur" (nm))
+                          ("ecraseur" (nm))
+                          ("ectoplasme" (nm))
+                          ("egoïste" (nm))
+                          ("emplatre" (nm))
+                          ("empoisonneur" (nm a))
+                          ("enragé" (nm a))
+                          ("épouvantail" (nm))
+                          ("équilibriste" (nm))
+                          ("esclavagiste" (nm))
+                          ("escogriffe" (nm))
+                          ("espèce de" (|...|))
+                          ("extrait de" (|...|))
+                          ("faux jeton" (nm))
+                          ("flibustier" (nm))
+                          ("forban" (nm))
+                          ("frères de la côte" (gnm))
+                          ("froussard" (nm a))
+                          ("galopin" (nm))
+                          ("gangster" (nm))
+                          ("garde­côte à la mie de pain" (gnm))
+                          ("gargarisme" (nm))
+                          ("garnement" (nm))
+                          ("gibier de potence" (nm))
+                          ("goujat" (nm))
+                          ("gredin" (nm))
+                          ("grenouille" (nf))
+                          ("gros plein de soupe" (gnm))
+                          ("gyroscope" (nm))
+                          ("hérétique" (n a))
+                          ("hors­la­loi" (nm))
+                          ("huluberlu" (nm))
+                          ("hydrocarbure" (nm))
+                          ("iconoclaste" (nm a))
+                          ("incas de carnaval" (gnmp))
+                          ("individou de général" (gnm))
+                          ("invertébré" (nm))
+                          ("ivrogne" (n))
+                          ("jet d'eau ambulant" (gnm))
+                          ("jocrisse" (nm))
+                          ("judas" (nm))
+                          ("jus de réglisse" (gnm))
+                          ("kroumir" (nm))
+                          ("ku klux klan" (gnm))
+                          ("lâche" (nm))
+                          ("lépidoptère" (nm))
+                          ("logarithme" (nm))
+                          ("loup­garou à la graisse de renoncule" (gnm))
+                          ("macaque" (nm))
+                          ("macrocéphale" (nm))
+                          ("malappris" (n a))
+                          ("malotru" (n))
+                          ("mamelouk" (nm))
+                          ("marchand de guano" (gnm))
+                          ("marchand de tapis" (gnm))
+                          ("marin d'eau douce" (gnm))
+                          ("marmotte" (nf))
+                          ("mégalomane" (nm a))
+                          ("mégacycle" (nm))
+                          ("mercanti" (nm))
+                          ("mercenaire" (nm a))
+                          ("mérinos" (nm))
+                          ("mille sabords" (gnmp))
+                          ("misérable" (a))
+                          ("mitrailleur à bavette" (gnm))
+                          ("moratorium" (nm))
+                          ("moricaud" (nm a))
+                          ("mouchard" (nm))
+                          ("moujik" (nm))
+                          ("moule à gaufres" (gnm))
+                          ("moussaillon" (nm))
+                          ("mrkrpxzkrmtfrz" (nm))
+                          ("mufle" (nm))
+                          ("Mussolini de carnaval" (nm))
+                          ("naufrageur" (nm))
+                          ("négrier" (nm))
+                          ("noix de coco" (gnm))
+                          ("nyctalope" (n a))
+                          ("olibrius" (nm))
+                          ("ophicléïde" (nm))
+                          ("ornithorynque" (nm))
+                          ("oryctérope" (nm))
+                          ("ostrogoth" (n a))
+                          ("ours mal lèché" (gnm))
+                          ("pacte à quatre" (gnm))
+                          ("paltoquet" (nm))
+                          ("pantoufle" (nf))
+                          ("Papous" (nm))
+                          ("paranoïaque" (nm a))
+                          ("parasite" (nm a))
+                          ("Patagon" (nm))
+                          ("patapouf" (nm))
+                          ("patate" (nf))
+                          ("péronnelle" (nf))
+                          ("perruche bavarde" (gnf))
+                          ("phénomène" (nm))
+                          ("phlébotome" (nm))
+                          ("phylactère" (nm))
+                          ("phylloxéra" (nm))
+                          ("pignouf" (nm))
+                          ("pirate" (nm))
+                          ("Polichinelle" (nm))
+                          ("polygraphe" (nm))
+                          ("porc­épic mal embouché" (gnm))
+                          ("potentat emplumé" (gnm))
+                          ("poussière" (nf))
+                          ("profiteur" (nm))
+                          ("projectile guidé" (gnm))
+                          ("protozoaire" (nm))
+                          ("pyromane" (nm))
+                          ("pyrophore" (nm))
+                          ("rapace" (nm))
+                          ("rat" (nm))
+                          ("Ravachol" (nm))
+                          ("renégat" (nm))
+                          ("rhizopode" (nm))
+                          ("Rocambole" (nm))
+                          ("sacripant" (nm))
+                          ("sajou" (nm))
+                          ("saltimbanque" (nm))
+                          ("sapajou" (nm))
+                          ("satané bazar de fourbi de truc" (gnm))
+                          ("satrape" (nm))
+                          ("sauvage" (n a))
+                          ("scélérat" (nm))
+                          ("schizophrène" (n a))
+                          ("scolopendre" (nf))
+                          ("scorpion" (nm))
+                          ("serpent" (nm))
+                          ("simili martien à la graisse de cabestan" (gnm))
+                          ("sinapisme" (nm))
+                          ("soulographe" (nm))
+                          ("squatter" (nm))
+                          ("tchouk­tchouk­nougat" (nm))
+                          ("technocrate" (nm))
+                          ("tête de lard" (gnf))
+                          ("tête de mule" (gnf))
+                          ("tigresse" (nf))
+                          ("tonnerre de Brest" (gnm))
+                          ("topinanbour" (nm))
+                          ("tortionnaire" (nm))
+                          ("traficant de chair humaine" (gnm))
+                          ("traine­potence" (nm))
+                          ("traitre" (nm a))
+                          ("troglodyte" (nm))
+                          ("trompe­la­mort" (nm))
+                          ("vampire" (nm))
+                          ("vandale" (nm a))
+                          ("va­nu­pieds" (nm))
+                          ("vaurien" (nm))
+                          ("végétarien" (nm))
+                          ("Vercingétorix de carnaval" (nm))
+                          ("ver de terre" (gnm))
+                          ("vermicelle" (nm))
+                          ("vermine" (nm))
+                          ("vipère" (nf))
+                          ("vivisectionniste" (nm))
+                          ("voleur" (nm))
+                          ("wisigoth" (n a))
+                          ("zapotèque" (nm))
+                          ("zèbre" (nm))
+                          ("zigomar" (nm))
+                          ("zouave" (nm))
+                          ("Zoulou" (nm))
+                          )
+      *insulte-nm* (remove-if-not (lambda (x) (intersection '(n np nm gnm) (second x))) *insulte-insults*)
+      *insulte-nf* (remove-if-not (lambda (x) (intersection '(nf np) (second x))) *insulte-insults*)
+      *insulte-ad* (remove-if-not (lambda (x) (member 'a (second x))) *insulte-insults*))
+
+(defun insulte ()
+  (let* ((a   (elt *insulte-ad* (random (length *insulte-ad*))))
+         (ad  (first a))
+         (gn (let ((n (random (+ (length *insulte-nf*) (length *insulte-nm*)))))
+               (if (>= n (length *insulte-nm*))
+                   (prog1
+                       (first (elt *insulte-nf* (- n (length *insulte-nm*))))
+                     (cond
+                       ((= 0 (length ad)))
+                       ((string= "e"     (subseq ad   (- (length ad) 1)) ))
+                       ((string= "eux"   (subseq ad   (- (length ad) 3)))
+                        (setf ad (concat (subseq ad 0 (- (length ad) 2)) "ille")))
+                       ((string= "eur"   (subseq ad   (- (length ad) 3)))
+                        (setf ad (concat (subseq ad 0 (- (length ad) 1)) "se")))
+                       (t
+                        (setf ad (concat ad "e")))))
+                   (first (elt *insulte-nm* n)))))
+         (ga  (if (member 'p (second a))
+                  ""
+                  (format " %s" ad)))
+         (gap (if (member 'p (second a))
+                  (format "%s " ad)
+                  ""))
+         (conj (if (position (aref (concat gap gn) 0) "aeiouyh") "d'" "de "))
+         (ins  (case (random 4)
+                 ((0)       (concat "espèce " conj gap gn ga))
+                 ((1)       (concat "bande "  conj gap gn ga))
+                 (otherwise (concat gap gn ga)))))
+    (concat (capitalize (subseq ins 0 1)) (subseq ins 1) " !")))
+
+
+(defun insulte-moi ()
+  (interactive)
+  (message "%s" (insulte)))
+
+;; (loop repeat 10 do (princ (insulte)) (terpri))
+;; Vieux saltimbanque !
+;; Zapotèque ostrogoth !
+;; Potentat emplumé sauvage !
+;; Espèce de végétarien moricaud !
+;; Vieux hors­la­loi !
+;; Vieux moricaud !
+;; Coléoptère moricaud !
+;; Paltoquet canaque !
+;; Bande de rat paranoïaque !
+;; Cachalot misérable !
+;; nil
+
+(provide 'insulte)
+;;;; THE END ;;;;
diff --git a/pjb-animate.el b/pjb-animate.el
new file mode 100644
index 0000000..084e931
--- /dev/null
+++ b/pjb-animate.el
@@ -0,0 +1,17 @@
+(defun pjb-animate (speed)
+  (interactive "nSpeed: ")
+  (let ((delay (/ 1.0  speed))
+        (done  nil))
+    (widen)
+    (goto-char (point-min))
+    (message "Animating...")
+    (while (not done)
+      (widen)
+      (if (search-forward "\f" nil 'at-limit)
+          nil
+        (goto-char (point-max))
+        (setq done t))
+      (narrow-to-page)
+      (sit-for delay)
+      (force-mode-line-update t))
+    (message "Done.")))
diff --git a/pjb-emacs.el b/pjb-emacs.el
index 3401af4..5528259 100644
--- a/pjb-emacs.el
+++ b/pjb-emacs.el
@@ -10,7 +10,7 @@
 ;;;;    emacs sessions.
 ;;;;
 ;;;;AUTHORS
-;;;;    <PJB> Pascal J. Bourguignon
+;;;;    <PJB> Pascal J. Bourguignon
 ;;;;MODIFICATIONS
 ;;;;    2010-10-30 <PJB> Renamed multifile-replace-string to recursive-replace-string,
 ;;;;                     Added recursive-replace-regexp and multifile-replace-regexp.
@@ -119,7 +119,7 @@
 ;;;----------------------------------------------------------------------------

 (unless (fboundp 'symbol-value-in-buffer)
-
+
   (defun symbol-value-in-buffer (symbol buffer &optional default)
     (save-excursion
      (set-buffer buffer)
@@ -166,7 +166,7 @@ RETURN: the buffer which has as name `name'.
   (or (gethash name buffer-name-map)
       (gethash (truename name) buffer-name-map)))

-
+
 (defun old-buffer-named (name)
   "
 RETURN: the buffer which has as name `name'.
@@ -178,10 +178,10 @@ RETURN: the buffer which has as name `name'.
                 (when (buffer-file-name (car buffers))
                   (string-equal name (buffer-file-name (car buffers))))
                 (when (and (truename name) (buffer-name      (car buffers)))
-                  (string-equal (truename name)
+                  (string-equal (truename name)
                                 (buffer-name      (car buffers))))
                 (when (and (truename name) (buffer-file-name (car buffers)))
-                  (string-equal (truename name)
+                  (string-equal (truename name)
                                 (buffer-file-name (car buffers)))))
         (setq result (car buffers))
         (setq buffers nil))
@@ -324,7 +324,7 @@ RETURN: A list of integer coordinates approximating the whole ellipse
 DO:     Draw a function in the given rectangle region.
 "
   (interactive "*r
-xFunction f:[0,1]->[0,1]/x|-->f(x):
+xFunction f:[0,1]->[0,1]/x|-->f(x):
 cPlot character: ") ;; start <= end
   (let* ((sl     (picture-current-line))
          (sc     (current-column))
@@ -344,7 +344,7 @@ cPlot character: ") ;; start <= end
     (move-to-column left t)
     (picture-update-desired-column t)
     (flet ((fun (x) (funcall fun x)))
-      (picture-draw-pixels
+      (picture-draw-pixels
        (do* ((xi 0 (1+ xi))
              (x) (y) (yi)
              (pixels nil))
@@ -353,7 +353,7 @@ cPlot character: ") ;; start <= end
          (setq y  (let ((y (unwind-protect (fun x))))
                     (if (< y 0.0) 0.0 (if (< 1.0 y) 1.0 y))))
          (setq yi (round (* height (- 1.0 y))))
-         (push (cons xi yi) pixels))
+         (push (cons xi yi) pixels))
        plot-char))
     (goto-line sl)
     (move-to-column sc t)))
@@ -424,7 +424,7 @@ BUG:    Only draws ellipse of even width and height.



-(defvar picture-fill-pixel ?*
+(defvar picture-fill-pixel ?*
   "The default pixel used to fill forms.")


@@ -569,9 +569,9 @@ DO:      Apply wc on the file visited in the current buffer.

 (defun pjb-search-in-all-buffers (string)
   (interactive "sString: ")
-  (let ( (list (buffer-list))
+  (let ( (list (buffer-list))
         buffer )
-    (save-excursion
+    (save-excursion
       (while list
         (setq buffer (car list)
               list   (cdr list))
@@ -581,14 +581,14 @@ DO:      Apply wc on the file visited in the current buffer.
             (setq list nil)
             (setq buffer nil))))
     (when buffer (switch-to-buffer buffer))))
-
+



 (defun* tempfile (&key directory prefix suffix name mode)
   (flet ((option (flag value)
                  (if value
-                     (format "%s %s"
+                     (format "%s %s"
                              (shell-quote-argument flag)
                              (shell-quote-argument value)))))
     (let ((lines (split-string (shell-command-to-string
@@ -650,9 +650,9 @@ Default to the URL around or before point.  A new Lynx process is run
 in an Xterm window using the Xterm program named by `browse-url-xterm-program'
 with possible additional arguments `browse-url-xterm-args'."
   (interactive (browse-url-interactive-arg "Lynx URL: "))
-  (apply #'start-process `(,(concat "lynx" url) nil
+  (apply #'start-process `(,(concat "lynx" url) nil
                             "pjb-xterm" ; ,browse-url-xterm-program
-                            ,@browse-url-xterm-args
+                            ,@browse-url-xterm-args
                             "-geometry" "80x40+10+0" "-bg" "#eeff99"
                             "-e" "lynx" ,url)))

@@ -675,10 +675,10 @@ with possible additional arguments `browse-url-xterm-args'."
   (interactive "r")
   (let* ( (s (string-to-vector (buffer-substring start end)))
          (l (length s))
-          (r nil)
-          (i 0)
+          (r nil)
+          (i 0)
           c C )
-    (while (< i l)
+    (while (< i l)
       (setq c (aref s i))
       (setq C (upcase   c))
       (setq c (downcase c))
@@ -712,10 +712,10 @@ with possible additional arguments `browse-url-xterm-args'."



-(defvar pjb-listing-light "LightBlue"
+(defvar pjb-listing-light "LightBlue"
   "Background color of light listing area.") ;;pjb-listing-light

-(defvar pjb-listing-dark "LightSteelBlue"
+(defvar pjb-listing-dark "LightSteelBlue"
   "Background color of dark listing area.") ;;pjb-listing-dark

 (defun pjb-colorize-listing-region (arg)
@@ -728,7 +728,7 @@ DO:      Colorize the region with group of lines (normaly 1 by 1)
   (setq arg (prefix-numeric-value arg))
   (setq current-prefix-arg nil)
   (let ( (lines-forward (1+ (or arg 1)))
-        (color (cons pjb-listing-light pjb-listing-dark))
+        (color (cons pjb-listing-light pjb-listing-dark))
          (start (region-beginning))
          (end   (region-end)) )
     ;; round the end to the beginning of next line.
@@ -764,7 +764,7 @@ DO:      Search an address in my address book (~/private/info/personnes.form)
 "
   (interactive "MSearch address: ")
   (let ((personnes-forms (buffer-named "personnes.forms")))
-    (if personnes-forms
+    (if personnes-forms
         (switch-to-buffer personnes-forms)
         (forms-find-file (format "%sprivate/info/personnes.forms"
                            (namestring (user-homedir-pathname))))))
@@ -773,7 +773,7 @@ DO:      Search an address in my address book (~/private/info/personnes.form)

 (defvar pjb-cross-references-rejected-regexp
   "\\(^\\.?#\\|~$\\|\\.\\(elc\\|o\\|a\\)$\\)"
-  "A regexp matching file names that should not be searched
+  "A regexp matching file names that should not be searched
 for cross references.")

 (defun pjb-cross-references ()
@@ -783,14 +783,14 @@ DO:      Grep current directory for sources containing the current word.
   (interactive)
   (let ( (word  (current-word))
         (files (nremove-nil
-                (mapcar (lambda (name)
+                (mapcar (lambda (name)
                           (cond
                             ((file-directory-p name) nil)
                             ((string-match pjb-cross-references-rejected-regexp
                                            name) nil)
                             (t (shell-quote-argument name))) )
                         (directory-files "." nil nil t)))) )
-    (grep (format "grep -n -e %s %s"
+    (grep (format "grep -n -e %s %s"
             (shell-quote-argument word) (unsplit-string files " ")))))


@@ -799,7 +799,7 @@ DO:      Grep current directory for sources containing the current word.

 (defun pjb-backcolors ()
   "
-DO:     Insert in the current buffer a list of colors and
+DO:     Insert in the current buffer a list of colors and
         facemenu-set-background them.
 "
   (interactive)
@@ -812,11 +812,11 @@ DO:     Insert in the current buffer a list of colors and
        b 10 12
        (let ((min (point)))
          (set-mark min)
-         (printf " *   Color :  #%x%x%x   * \n"
+         (printf " *   Color :  #%x%x%x   * \n"
                  (funcall f r) (funcall f g) (funcall f b))
-         (facemenu-set-background
+         (facemenu-set-background
           (format "#%x%x%x"
-            (funcall f r) (funcall f g) (funcall f b))
+            (funcall f r) (funcall f g) (funcall f b))
           min (point))))))))


@@ -828,7 +828,7 @@ DO:     Insert in the current buffer a list of colors and
     (save-window-excursion
      (find-file (or custom-file user-init-file))
      (goto-char (point-min))
-     (forward-sexp)
+     (forward-sexp)
      (while (and (< (point) (point-max))
                  (not
                   (let ((form (progn (backward-sexp) (sexp-at-point))))
@@ -858,14 +858,14 @@ DO:     Insert in the current buffer a list of colors and

 (defun chronometre (lambda-body &optional outstream)
   "
-DO:     Chronometre the execution of `lambda-body'.
+DO:     Chronometre the execution of `lambda-body'.
         Writes a message indicating the time it took.
 RETURN: (cons seconds the result of `lambda-body').
 "
   (let* ((start  (current-time))
          (result (funcall lambda-body))
-         (stop   (current-time))
-         (time   (- (emacs-time-to-seconds stop)
+         (stop   (current-time))
+         (time   (- (emacs-time-to-seconds stop)
                     (emacs-time-to-seconds start))) )
     (printf outstream "Took %f seconds." time)
     (cons time result)))
@@ -908,9 +908,9 @@ space does not end a sentence, so don't break a line there."
         (let ((initial (point))
               end)
           ;; If using hard newlines, break at every one for filling
-          ;; purposes rather than using paragraph breaks.
+          ;; purposes rather than using paragraph breaks.
           (if use-hard-newlines
-              (progn
+              (progn
                 (while (and (setq end (text-property-any (point) (point-max)
                                                          'hard t))
                             (not (= (character "\n") (char-after end)))
@@ -951,7 +951,7 @@ space does not end a sentence, so don't break a line there."
     (dolist (line (permutations words))
       (dolist (word line)
         (insert (format "%s "
-                  (if (and (listp word) (eq 'quote (car word)))
+                  (if (and (listp word) (eq 'quote (car word)))
                       (cadr word) word))))
       (insert "\n"))))

@@ -1016,7 +1016,7 @@ Add the selection to the local fortune file.
   "The number of horizontal pixels eaten by the window manager.")


-(defvar *current-frame* nil)
+(defvar *current-frame* nil)

 (defun current-frame ()
   "
@@ -1120,7 +1120,7 @@ RETURN: The maximum number of columns that can be displayed on this frame
   "Enlarge the window to span the whole screen."
   (interactive)
   (let ((*current-frame* (current-frame)))
-    (set-frame-width  *current-frame*
+    (set-frame-width  *current-frame*
                       (max-frame-column-number
                        *current-frame* (+ (if current-prefix-arg 64 0) 34)))
     (set-frame-height *current-frame* (max-frame-line-number *current-frame*))
@@ -1204,7 +1204,7 @@ POS:    Either an integer denoting a X window position,
         or a list (+ int) denoting a X window position starting out of screen.
         (+ -2) means two pixels out of the left side of the screen.
 RETURN: The X window position for the frame corresponding to pos on the x axis.
-        A positive number is relative to the left screen border, and toward
+        A positive number is relative to the left screen border, and toward
         the right,
         a negative number is relative to the right screen border, and
         toward the right too  (its absolute value, toward the left).
@@ -1227,7 +1227,7 @@ POS:    Either an integer denoting a X window position,
         (+ -2) means two pixels out of the top side of the screen.
 RETURN: The X window position for the frame corresponding to pos on the y axis.
         A positive number is relative to the top screen border, and down,
-        a negative number is relative to the bottom screen border, and down too
+        a negative number is relative to the bottom screen border, and down too
         (its absolute value, up).
 SEE:   position-x
 "
@@ -1248,7 +1248,7 @@ RETURN: The origin of the screen where the frame lies.

 NOTE:   For multi-screen displays, the coordinate system could be such that
         the origin of a screen may be expressed in negative coordinates.
-        In this case, the returned values may be lists of the form:
+        In this case, the returned values may be lists of the form:
         (+ -|x|) (+ -|y|).
 "
   (let ((frame (or frame (current-frame))))
@@ -1274,7 +1274,7 @@ RETURN: The origin and width and height of the screen where the frame lies,


 ;;;
-;;;
+;;;
 ;;;

 (defvar *frame-maximized-states*)
@@ -1293,9 +1293,9 @@ On MacOSX, negative prefix diminishes the size of the window to leave
 space for the dock.  A zerop prefix will use toggle-frame-fullscreen when
 available.

-Vertical decorations    Vertical decorations
+Vertical decorations    Vertical decorations
 in screen.              out of screen.
-
+
 +---------++---------+
 |         ..         |
 |         .. 1       |  -1
@@ -1328,9 +1328,9 @@ in screen.              out of screen.
 +---------++---------+

 +----+----++----+----+
-| 41 | 51 || 61 | 71 |
+| 41 | 51 || 61 | 71 |
 +----+----++----+----+  No decorationless here.
-| 42 | 52 || 62 | 72 |
+| 42 | 52 || 62 | 72 |
 +----+----++----+----+

 +------+------+------+
@@ -1399,11 +1399,11 @@ Multiply by -1 = without decoration.
                    (hpref  (cond ; 1..19
                              ((< prefix 20)   prefix)
                              ((< prefix 1000) (truncate prefix 10))
-                             (t               (truncate prefix 10))))
+                             (t               (truncate prefix 10))))
                    (vpref  (cond ; 0,1,2,3
                              ((< prefix   20) 0)
                              ((< prefix 1000) (mod prefix 10))
-                             (t               0)))
+                             (t               0)))
                    (left   (+ screen-left
                               (case hpref
                                 ((1 2 4 11 111 8) 0)
@@ -1509,12 +1509,12 @@ Multiply by -1 = without decoration.


 (defvar *frame-maximized-states* (make-hash-table)
-  "Maps frames to their maximized state: When not maximized = nil;
+  "Maps frames to their maximized state: When not maximized = nil;
                                          when maximized = ((x y) w h)")
 ;; (setf *frame-maximized-states* (make-hash-table))

 ;; assuming each frame has its own state.
-;; The following is to clean up the entry in the hash table when the
+;; The following is to clean up the entry in the hash table when the
 ;; frame is deleted:
 (defun pjb-delete-frame-meat (frame)
   (remhash frame *frame-maximized-states*))
@@ -1750,7 +1750,7 @@ SEE-ALSO:  blind-text-region

 (defun filter-region (fun &optional start end)
   "
-DO:    Apply the function fun(character)->string to the region from
+DO:    Apply the function fun(character)->string to the region from
        start or (min (point) (mark)) to end or (max (point) (mark)).
        The region is replaced at the end of the processing.
 "
@@ -1763,7 +1763,7 @@ DO:    Apply the function fun(character)->string to the region from
        ((<= end pos)
         (progn
           (delete-region start end)
-          (insert (apply (function concatenate)
+          (insert (apply (function concatenate)
                          'string (nreverse replacement)))))
     (push (funcall fun pos ch) replacement)))

@@ -1779,17 +1779,17 @@ DO:         Substitutes every alphanumeric text by a 'x'.
 SEE-ALSO:   activate-peril-sensitive-sunglasses
 "
   (interactive "*r")
-  (filter-region
-   (lambda (pos ch)
+  (filter-region
+   (lambda (pos ch)
      (cond ((or (is-space (character ch))
                 (cl:string= "\n" ch)
                 (cl:string= "=" ch)
                 (and (cl:string/= "\n" ch)
-                     (cl:string=  "=" (buffer-substring-no-properties
+                     (cl:string=  "=" (buffer-substring-no-properties
                                     (- pos 1) pos)))
-                (and (cL:string/= "\n" (buffer-substring-no-properties
+                (and (cL:string/= "\n" (buffer-substring-no-properties
                                       (- pos 1) pos))
-                     (cl:string=  "=" (buffer-substring-no-properties
+                     (cl:string=  "=" (buffer-substring-no-properties
                                     (- pos 2) (- pos 1)))))
             ch)
            ((alphanumericp (character ch)) "x")
@@ -1813,9 +1813,9 @@ SEE-ALSO:   activate-peril-sensitive-sunglasses
 ;;;----------------------------------------------------------------------------
 ;;; Keymaps:
 ;;;----------------------------------------------------------------------------
-
+
 (defun make-keymap-local ()
-  "Creates a buffer local keymap to have local-set-key define keys local
+  "Creates a buffer local keymap to have local-set-key define keys local
 to the buffer instead of local to the mode."
   (interactive)
   (let ((km (make-keymap)))
@@ -1863,7 +1863,7 @@ to the buffer instead of local to the mode."
                                              (length (first b)))
                                           (string< (first a)
                                                    (first b)))))))
-                 (princ (second item)))))))
+                 (princ (second item)))))))
     (switch-to-buffer (format "Keybindings in %s" (buffer-name)))
     (erase-buffer)
     (insert data)
@@ -1998,7 +1998,7 @@ to the buffer instead of local to the mode."

 (defun eppelle ()
   (interactive)
-  (let ((text
+  (let ((text
          (if (or (not mark-active) (eql (point) (mark)))
              (read-from-minibuffer "Word: ")
              (buffer-substring-no-properties (min (point) (mark))
@@ -2073,7 +2073,7 @@ to the buffer instead of local to the mode."
                     (?Я . "Яков")

                     ;; Aleph Boaz Gimel David Hagar Vav Ze'ev Hava Tiach Yona
-                    ;; Carmel Lea Moshe Nesher Samekh A'in Pesel Tsipor Korakh
+                    ;; Carmel Lea Moshe Nesher Samekh A'in Pesel Tsipor Korakh
                     ;; Ruth Shamir Telem
                     ;; #+clisp
                     ;; (let ((codes '(("Aleph" "_ALEF")
@@ -2112,81 +2112,81 @@ to the buffer instead of local to the mode."
                     ;;       (when (string/= "" code)
                     ;;         (print (cons (intern (format nil "?~C" ch)) code))))))

-                    (?ׁ . "Shamir")
-                    (?א . "Aleph")
-                    (?ב . "Boaz")
-                    (?ג . "Gimel")
-                    (?ד . "David")
-                    (?ה . "Hagar")
-                    (?ו . "Vav")
-                    (?ז . "Ze'ev")
-                    (?ח . "Hagar Hava")
-                    (?ט . "Tiach")
-                    (?י . "Yona")
-                    (?ך . "Carmel")
-                    (?כ . "Carmel")
-                    (?ל . "Lea")
-                    (?ם . "Moshe")
-                    (?מ . "Moshe")
-                    (?ן . "Nesher")
-                    (?נ . "Nesher")
-                    (?ס . "Samekh")
-                    (?ע . "A'in")
-                    (?ף . "Pesel")
-                    (?פ . "Pesel")
-                    (?ץ . "Tsipor")
-                    (?צ . "Tsipor")
-                    (?ק . "Korakh")
-                    (?ר . "Ruth")
-                    (?ש . "Shamir")
-                    (?ת . "Telem")
-                    (?װ . "Vav Vav")
-                    (?ױ . "Vav Yona")
-                    (?ײ . "Yona Yona")
-                    (?יִ . "Yona")
-                    (?ײַ . "Yona")
-                    (?ﬠ . "A'in")
-                    (?ﬡ . "Aleph")
-                    (?ﬢ . "David")
-                    (?ﬣ . "Hagar")
-                    (?ﬤ . "Carmel")
-                    (?ﬥ . "Lea")
-                    (?ﬦ . "Moshe")
-                    (?ﬧ . "Ruth")
-                    (?ﬨ . "Telem")
-                    (?שׁ . "Shamir")
-                    (?שׂ . "Shamir")
-                    (?שּׁ . "Shamir")
-                    (?שּׂ . "Shamir")
-                    (?אַ . "Aleph")
-                    (?אָ . "Aleph")
-                    (?אּ . "Aleph")
-                    (?בּ . "Boaz")
-                    (?גּ . "Gimel")
-                    (?דּ . "David")
-                    (?הּ . "Hagar")
-                    (?וּ . "Vav")
-                    (?זּ . "Ze'ev")
-                    (?טּ . "Tiach")
-                    (?יּ . "Yona")
-                    (?ךּ . "Carmel")
-                    (?כּ . "Carmel")
-                    (?לּ . "Lea")
-                    (?מּ . "Moshe")
-                    (?נּ . "Nesher")
-                    (?סּ . "Samekh")
-                    (?ףּ . "Pesel")
-                    (?פּ . "Pesel")
-                    (?צּ . "Tsipor")
-                    (?קּ . "Korakh")
-                    (?רּ . "Ruth")
-                    (?שּ . "Shamir")
-                    (?תּ . "Telem")
-                    (?וֹ . "Vav")
-                    (?בֿ . "Boaz")
-                    (?כֿ . "Carmel")
-                    (?פֿ . "Pesel")
-                    (?ﭏ . "Aleph Lea")
+                    (?ׁ . "Shamir")
+                    (?א . "Aleph")
+                    (?ב . "Boaz")
+                    (?ג . "Gimel")
+                    (?ד . "David")
+                    (?ה . "Hagar")
+                    (?ו . "Vav")
+                    (?ז . "Ze'ev")
+                    (?ח . "Hagar Hava")
+                    (?ט . "Tiach")
+                    (?י . "Yona")
+                    (?ך . "Carmel")
+                    (?כ . "Carmel")
+                    (?ל . "Lea")
+                    (?ם . "Moshe")
+                    (?מ . "Moshe")
+                    (?ן . "Nesher")
+                    (?נ . "Nesher")
+                    (?ס . "Samekh")
+                    (?ע . "A'in")
+                    (?ף . "Pesel")
+                    (?פ . "Pesel")
+                    (?ץ . "Tsipor")
+                    (?צ . "Tsipor")
+                    (?ק . "Korakh")
+                    (?ר . "Ruth")
+                    (?ש . "Shamir")
+                    (?ת . "Telem")
+                    (?װ . "Vav Vav")
+                    (?ױ . "Vav Yona")
+                    (?ײ . "Yona Yona")
+                    (?יִ . "Yona")
+                    (?ײַ . "Yona")
+                    (?ﬠ . "A'in")
+                    (?ﬡ . "Aleph")
+                    (?ﬢ . "David")
+                    (?ﬣ . "Hagar")
+                    (?ﬤ . "Carmel")
+                    (?ﬥ . "Lea")
+                    (?ﬦ . "Moshe")
+                    (?ﬧ . "Ruth")
+                    (?ﬨ . "Telem")
+                    (?שׁ . "Shamir")
+                    (?שׂ . "Shamir")
+                    (?שּׁ . "Shamir")
+                    (?שּׂ . "Shamir")
+                    (?אַ . "Aleph")
+                    (?אָ . "Aleph")
+                    (?אּ . "Aleph")
+                    (?בּ . "Boaz")
+                    (?גּ . "Gimel")
+                    (?דּ . "David")
+                    (?הּ . "Hagar")
+                    (?וּ . "Vav")
+                    (?זּ . "Ze'ev")
+                    (?טּ . "Tiach")
+                    (?יּ . "Yona")
+                    (?ךּ . "Carmel")
+                    (?כּ . "Carmel")
+                    (?לּ . "Lea")
+                    (?מּ . "Moshe")
+                    (?נּ . "Nesher")
+                    (?סּ . "Samekh")
+                    (?ףּ . "Pesel")
+                    (?פּ . "Pesel")
+                    (?צּ . "Tsipor")
+                    (?קּ . "Korakh")
+                    (?רּ . "Ruth")
+                    (?שּ . "Shamir")
+                    (?תּ . "Telem")
+                    (?וֹ . "Vav")
+                    (?בֿ . "Boaz")
+                    (?כֿ . "Carmel")
+                    (?פֿ . "Pesel")
+                    (?ﭏ . "Aleph Lea")
                     )))
     (switch-to-buffer "*Eppelle*")
     (goto-char (point-max))
@@ -2198,7 +2198,7 @@ to the buffer instead of local to the mode."
        for tr = (assoc* (upcase ch) alphabet :test (function =))
        do  (insert (if tr (format "%s " (cdr tr)) (format "%c" ch))))
     (insert "\n")))
-
+


 ;;;----------------------------------------------------------------------------
@@ -2404,7 +2404,7 @@ FILE-AND-OPTION: either an atom evaluated to a path,
       `(with-file (,file-and-options) ,@body)
       ;; destructuring-bind is broken, we cannot give anything else than nil
       ;; as default values:
-
+
       (destructuring-bind (path &key (save nil savep) (kill nil killp)
                                   (literal nil literalp))
           file-and-options
@@ -2521,7 +2521,7 @@ FILE-AND-OPTION: either an atom evaluated to a path,
 ;;;----------------------------------------------------------------------------
 ;;; multi-file replace
 ;;;----------------------------------------------------------------------------
-;;; recursive-replace-string
+;;; recursive-replace-string

 (defvar *recursive-replace-ignored-directories* *ignorable-directories*)

@@ -2539,8 +2539,7 @@ FILE-AND-OPTION: either an atom evaluated to a path,
         (t
          nil)))))

-(defun* recursive-replace-string (from-string to-string
-                                              &key directory recursive delimited exceptions)
+(defun* recursive-replace-string (from-string to-string &key directory recursive delimited exceptions)
   "Replace the all occurences of `from-string' by `to-string' in all the files in the directory.
 If `recursive' is true (or a prefix argument is given), then the files are searched recursively
 otherwise only the files directly in the given `directory' are modified.
@@ -2553,7 +2552,10 @@ recursive search.  Backup files (name ending in ~) are ignored too.
           (arguments (query-replace-read-args
                       (format "Replace string in all files in %s" directory)
                       nil)))
-     (list (first arguments) (second arguments) directory (third arguments) nil)))
+     (list (first arguments) (second arguments)
+           :directory directory
+           :recursive (third arguments)
+           :delimited nil)))
   (with-files (file directory :recursive recursive :exceptions (exception-function exceptions))
     (with-file (file)
       (message "Processing %S" file)
@@ -2574,7 +2576,10 @@ recursive search.  Backup files (name ending in ~) are ignored too.
           (arguments (query-replace-read-args
                       (format "Replace string in all files in %s" directory)
                       nil)))
-     (list (first arguments) (second arguments) directory (third arguments) nil)))
+     (list (first arguments) (second arguments)
+           :directory directory
+           :recursive (third arguments)
+           :delimited nil)))
   (with-files (file directory :recursive recursive :exceptions (exception-function exceptions))
     (with-file (file)
       (message "Processing %S" file)
@@ -2767,5 +2772,93 @@ Attribution: ?"
         (if (= p (point-min)) (setq p (1- p))
             (setq p (point)))))))

+
+
+(defvar *find-file-at-point-file-regexp*
+  "^\\([ \t]*\\|[-=#+/ \t]* \\)\\(\\([^: \n\t]*\\)\\(:\\([0-9]+\\)\\)\\):?")
+(defvar *find-file-at-point-file-regexp--link-match* 2)
+(defvar *find-file-at-point-file-regexp--path-match* 3)
+(defvar *find-file-at-point-file-regexp--lino-match* 5)
+(defvar *find-file-at-point-file--last* 'find-next-file)
+
+(defun ffap-clean-path (dir path)
+  (let ((path (if (and (< 0 (length path))
+                       (= ?/ (char path 0)))
+                  path
+                  (concat dir "/" path))))
+    (when (file-exists-p path)
+      path)))
+
+(defun find-file-at-point ()
+  (interactive)
+  (save-match-data
+   (when (looking-at *find-file-at-point-file-regexp*)
+     (let ((path (ffap-clean-path
+                  default-directory
+                  (match-string *find-file-at-point-file-regexp--path-match*)))
+           (lino (and (match-string *find-file-at-point-file-regexp--lino-match*)
+                      (string-to-number
+                       (match-string *find-file-at-point-file-regexp--lino-match*)))))
+       (if path
+           (progn
+             (find-file path)
+             (when lino
+               (goto-char (point-min))
+               (forward-line (1- lino))))
+           (error "No such file %s"  (match-string 1)))))))
+
+(defun find-next/previous-file (search next)
+  (when (and (boundp 'find-file-at-point-paths-buffer)
+             (or (bufferp find-file-at-point-paths-buffer)
+                 (stringp find-file-at-point-paths-buffer)))
+    (switch-to-buffer find-file-at-point-paths-buffer))
+  (save-match-data
+   (let ((buffer (current-buffer)))
+     (when (funcall search *find-file-at-point-file-regexp* nil t)
+       (goto-char (match-beginning 0))
+       (find-file-at-point)
+       (make-variable-buffer-local 'find-file-at-point-paths-buffer)
+       (setf find-file-at-point-paths-buffer buffer)
+       (with-current-buffer buffer
+         (goto-char (funcall next 0)))))))
+
+(defun find-next-file ()
+  (interactive)
+  (unless (eq 'find-next-file *find-file-at-point-file--last*)
+    (find-next/previous-file (function re-search-forward) (function match-end)))
+  (setf *find-file-at-point-file--last* 'find-next-file)
+  (find-next/previous-file (function re-search-forward) (function match-end)))
+
+(defun find-previous-file ()
+  (interactive)
+  (when (eq 'find-next-file *find-file-at-point-file--last*)
+    (find-next/previous-file (function re-search-backward) (function match-beginning)))
+  (setf *find-file-at-point-file--last* 'find-previous-file)
+  (find-next/previous-file (function re-search-backward) (function match-beginning)))
+
+(global-set-key (kbd "A-n") 'find-next-file)
+(global-set-key (kbd "A-p") 'find-previous-file)
+
+(defun find-file-at-point--button-action (button)
+  (goto-char (button-start button))
+  (beginning-of-line)
+  (find-file-at-point))
+
+(defun add-find-file-buttons ()
+  (interactive)
+  (save-excursion
+   (goto-char (point-min))
+   (while (re-search-forward *find-file-at-point-file-regexp* (point-max) t)
+     (message "Found %s" (match-string *find-file-at-point-file-regexp--link-match*))
+     (make-text-button
+      (progn (beginning-of-line) (point))
+      (progn (end-of-line) (+ 1 (point)))
+      'action 'find-file-at-point--button-action)))
+  ;; button navigation:
+  (local-set-key (kbd "TAB") (lambda () (interactive) (forward-button 1 t t)))
+  (local-set-key (kbd "<backtab>") (lambda () (interactive) (backward-button 1 t t))))
+
+
+
 (provide 'pjb-emacs)
 ;;;: THE END ;;;;
diff --git a/pjb-objc-edit.el b/pjb-objc-edit.el
index 4261703..44a686b 100644
--- a/pjb-objc-edit.el
+++ b/pjb-objc-edit.el
@@ -5,10 +5,10 @@
 ;;;;SYSTEM:             POSIX
 ;;;;USER-INTERFACE:     NONE
 ;;;;DESCRIPTION
-;;;;
+;;;;
 ;;;;    A few utilities to help editing Objective-C++ code with
 ;;;;    strange style rules.
-;;;;
+;;;;
 ;;;;AUTHORS
 ;;;;    <PJB> Pascal Bourguignon <pbourguignon@dxo.com>
 ;;;;MODIFICATIONS
@@ -16,19 +16,19 @@
 ;;;;BUGS
 ;;;;LEGAL
 ;;;;    AGPL3
-;;;;
+;;;;
 ;;;;    Copyright Pascal Bourguignon 2012 - 2012
-;;;;
+;;;;
 ;;;;    This program is free software: you can redistribute it and/or modify
 ;;;;    it under the terms of the GNU Affero General Public License as published by
 ;;;;    the Free Software Foundation, either version 3 of the License, or
 ;;;;    (at your option) any later version.
-;;;;
+;;;;
 ;;;;    This program 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 Affero General Public License for more details.
-;;;;
+;;;;
 ;;;;    You should have received a copy of the GNU Affero General Public License
 ;;;;    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ;;;;**************************************************************************
@@ -36,6 +36,7 @@
 (require 'cc-mode)
 (require 'semantic)
 (require 'pjb-objc-ide)
+(require 'paredit)

 (defparameter pjb-objc-edit--*c++-operators*
   '((1 :left-to-right                     ;  highest
@@ -134,7 +135,7 @@ position is (member :prefix :infix :suffix)


 ;; (pjb-objc-edit--special-character-operators)
-;;
+;;
 ;; ((">>=" :infix) ("<<=" :infix) ("->*" :infix) ("|=" :infix) ("^=" :infix)
 ;;  ("&=" :infix) ("%=" :infix) ("/=" :infix) ("*=" :infix) ("-=" :infix)
 ;;  ("+=" :infix) ("?:" :infix) ("||" :infix) ("&&" :infix) ("!=" :infix)
@@ -214,7 +215,7 @@ position is (member :prefix :infix :suffix)
 	 )
        )

-
+
      )))


@@ -349,9 +350,9 @@ position is (member :prefix :infix :suffix)
            (setf (symbol-function 'paredit-in-string-p)   (first saved)
                  (symbol-function 'paredit-in-comment-p)  (second saved)))))))

-(pjb-objc-edit-define-wrapper pjb-objc-edit-open-round           paredit-open-round)
-(pjb-objc-edit-define-wrapper pjb-objc-edit-close-round          paredit-close-round)
-(pjb-objc-edit-define-wrapper pjb-objc-edit-open-square          paredit-open-square)
+(pjb-objc-edit-define-wrapper pjb-objc-edit-open-round           paredit-open-round)
+(pjb-objc-edit-define-wrapper pjb-objc-edit-close-round          paredit-close-round)
+(pjb-objc-edit-define-wrapper pjb-objc-edit-open-square          paredit-open-square)
 (pjb-objc-edit-define-wrapper pjb-objc-edit-close-square         paredit-close-square)
 (pjb-objc-edit-define-wrapper pjb-objc-edit-open-curly           paredit-open-curly
   (backward-char 1)
@@ -367,9 +368,9 @@ position is (member :prefix :infix :suffix)
   (forward-char 1)
   (insert "\n") (c-indent-line-or-region))
 (pjb-objc-edit-define-wrapper pjb-objc-edit-close-curly          paredit-close-curly)
-(pjb-objc-edit-define-wrapper pjb-objc-edit-wrap-sexp            paredit-wrap-sexp)
+(pjb-objc-edit-define-wrapper pjb-objc-edit-wrap-sexp            paredit-wrap-sexp)
 (pjb-objc-edit-define-wrapper pjb-objc-edit-wrap-square          paredit-wrap-square)
-(pjb-objc-edit-define-wrapper pjb-objc-edit-wrap-curly           paredit-wrap-curly)
+(pjb-objc-edit-define-wrapper pjb-objc-edit-wrap-curly           paredit-wrap-curly)
 (pjb-objc-edit-define-wrapper pjb-objc-edit-backward-delete      paredit-backward-delete)
 (pjb-objc-edit-define-wrapper pjb-objc-edit-backward-kill-word   paredit-backward-kill-word)

@@ -378,7 +379,7 @@ position is (member :prefix :infix :suffix)
   (interactive)
   (loop
      for (command . keys)
-     in '((pjb-ide-insert-tag-comment           "C-c p")
+     in '((pjb-ide-insert-tag-comment           "C-c p")
           (paredit-forward-slurp-sexp           "C-<right>"   "A-<right>"   "A-f" "C-)")
           (paredit-forward-barf-sexp            "C-<left>"    "A-<left>"    "A-g" "C-}")
           (paredit-backward-slurp-sexp          "C-M-<right>" "A-s-<right>" "A-d" "C-(")
@@ -409,7 +410,7 @@ position is (member :prefix :infix :suffix)
           (sources-find-file-named              "C-c C-x C-f")
           (pjb-ide-insert-documentation-comment "C-c C-;"))
      do (loop for key in keys do (local-set-key (read-kbd-macro key) command)))
-  (auto-complete-mode 1)
+  ;; (auto-complete-mode 1)
   (global-set-key (kbd "C-c C-x C-f") 'sources-find-file-named)
   (pjb-objc-edit-add-font-lock-keywords))

diff --git a/pjb-sources.el b/pjb-sources.el
index 0dd3bf5..ca9115f 100644
--- a/pjb-sources.el
+++ b/pjb-sources.el
@@ -3541,6 +3541,34 @@ SProject Type: ")



+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defun comment-line (start end)
+  "Comments a region using the infamous 'line' boxing style:
+
+/*
+ * Like
+ * this.
+ */
+
+"
+  (interactive "r")
+  (save-excursion
+   ;; Insert end of comment:
+   (goto-char end)
+   (unless (bolp)
+     (insert "\n"))
+   (insert " */\n")
+
+   (with-marker (end end)
+     ;; Insert begin of comment:
+     (goto-char start)
+     (unless (bolp)
+       (insert "\n"))
+     (insert "/*\n")
+     ;; Add line header:
+     (replace-regexp "^" " * " nil (point) (- end 1)))))
+

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (provide 'pjb-sources)
diff --git a/trustonic.el b/trustonic.el
new file mode 100644
index 0000000..7bcdc2a
--- /dev/null
+++ b/trustonic.el
@@ -0,0 +1,483 @@
+;;; trustonic-c-style -- c-style following Trustonic coding conventions
+;;;; -*- mode:emacs-lisp;coding:utf-8 -*-
+;;;;**************************************************************************
+;;;;FILE:               trustonic.el
+;;;;LANGUAGE:           emacs lisp
+;;;;SYSTEM:             POSIX
+;;;;USER-INTERFACE:     NONE
+;;;;DESCRIPTION
+;;;;
+;;;;    Emacs configuration used at Trustonics Ltd.
+;;;;
+;;;;    Add to your ~/.emacs:
+;;;;
+;;;;         (require 'trustonic)
+;;;;
+;;;;    Then new C, Objective-C or C++ buffers will get the trustonic style.
+;;;;
+;;;;    To change the c-style manually:
+;;;;
+;;;;        M-x c-set-style RET trustonic RET
+;;;;
+;;;;AUTHORS
+;;;;    <PJB> Pascal Bourguignon <pjb@informatimago.com>
+;;;;MODIFICATIONS
+;;;;    2016-06-09 <PJB> Adapted to trustonic.
+;;;;    2012-11-15 <PJB> Created.
+;;;;BUGS
+;;;;LEGAL
+;;;;    GPL3
+;;;;
+;;;;    Copyright Pascal Bourguignon 2012 - 2016
+;;;;
+;;;;    This program 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 3 of the License, or
+;;;;    (at your option) any later version.
+;;;;
+;;;;    This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+;;;;**************************************************************************
+;;; Commentary:
+;;; http://wiki.trustonic.internal/confluence/display/mc/Coding+Guidelines+And+Conventions
+;;; Code:
+
+(require 'cl) ; always
+(require 'cc-mode)
+
+(defmacro* with-marker ((var position) &body body)
+  (let ((vposition (gensym))) ; so (eq var position) still works.
+    `(let* ((,vposition ,position)
+            (,var (make-marker)))
+       (set-marker ,var ,vposition)
+       (unwind-protect (progn ,@body)
+         (set-marker ,var nil)))))
+
+(setf auto-mode-alist (append '(("\\.m$"  . objc-mode)
+                                ("\\.mm$" . objc-mode))
+                              auto-mode-alist))
+
+
+(c-add-style
+ "trustonic"
+ '((c-backslash-column             .  78)
+
+   (c-backslash-max-column         . 128)
+
+   (c-basic-offset                 .   4)
+
+   (c-block-comment-prefix         . "* ")
+
+   (c-cleanup-list                 . (list-close-comma
+                                      scope-operator))
+
+   (c-comment-only-line-offset     . (0 . 0))
+
+   ;; (c-comment-prefix-regexp)
+
+   (c-doc-comment-style            . javadoc)
+
+   (c-hanging-braces-alist         . (
+                                      ;; (statement-cont)
+                                      ;; (brace-list-intro)
+                                      (inexpr-class-open    . (before after))
+                                      (inexpr-class-close   . (before after))
+
+                                      (defun-open           . (before after)) ; Brace that opens a function definition.
+                                      (defun-close          . (before after)) ; Brace that closes a function definition.
+                                      (class-open           . (before after)) ; Brace that opens a class definition.
+                                      (class-close          . (before after)) ; Brace that closes a class definition.
+                                      (inline-open          . (before after)) ; Brace that opens an in-class inline method.
+                                      (inline-close         . (before after)) ; Brace that closes an in-class inline method.
+                                      (block-open           . (before after)) ; Statement block open brace.
+                                      (block-close          . (before after)) ; Statement block close brace.
+                                      (brace-list-open      . (before after)) ; Open brace of an enum or static array list.
+                                      (brace-list-close     . (before after)) ; Close brace of an enum or static array list.
+                                      (brace-entry-open     . (before after)) ; Subsequent lines in an enum or static array
+                                      (statement-case-open  . (before after)) ; The first line in a case block starting with brace.
+                                      (substatement-open    . (before after)) ; The brace that opens a substatement block.
+                                      (extern-lang-open     . (before after)) ; Brace that opens an "extern" block.
+
+
+
+
+
+
+
+                                      (extern-lang-close    . (before after)) ; Brace that closes an "extern" block.
+                                      (namespace-open       . (before after))
+                                      (namespace-close      . (before after))
+                                      (module-open          . (before after))
+                                      (module-close         . (before after))
+                                      (composition-open     . (before after))
+                                      (composition-close)   . (before after)))
+
+   (c-hanging-colons-alist         . ((case-label           . (after))
+                                      (label                . (after))
+                                      (access-label         . (after))
+                                      (member-init-intro    . ())
+                                      (inher-intro          . ())))
+
+   (c-hanging-semi&comma-criteria  . ())
+
+   ;; (c-indent-comment-alist)
+
+   (c-indent-comments-syntactically-p . nil)
+
+   (c-label-minimum-indentation       . 2)
+
+   (c-offsets-alist                   . (
+
+                                         (string             . 0)
+                                         ;; Inside multi-line string.
+
+                                         (c                  . 1)
+                                         ;; Inside a multi-line C style block comment.
+
+                                         (defun-open         . 0)
+                                         ;; Brace that opens a function definition.
+
+                                         (defun-close        . 0)
+                                         ;; Brace that closes a function definition.
+
+                                         (defun-block-intro  . +)
+                                         ;; The first line in a top-level defun.
+
+                                         (class-open         . 0)
+                                         ;; Brace that opens a class definition.
+
+                                         (class-close        . 0)
+                                         ;; Brace that closes a class definition.
+
+                                         (inline-open        . 0)
+                                         ;; Brace that opens an in-class inline method.
+
+                                         (inline-close       . 0)
+                                         ;; Brace that closes an in-class inline method.
+
+                                         (func-decl-cont     . +)
+                                         ;; The region between a function definition's
+                                         ;; argument list and the function opening brace
+                                         ;; (excluding K&R argument declarations).  In C, you
+                                         ;; cannot put anything but whitespace and comments
+                                         ;; between them; in C++ and Java, throws declarations
+                                         ;; and other things can appear in this context.
+
+                                         (knr-argdecl-intro     . +)
+                                         ;; First line of a K&R C argument declaration.
+
+                                         (knr-argdecl           . +)
+                                         ;; Subsequent lines in a K&R C argument declaration.
+
+                                         (topmost-intro         . 0)
+                                         ;; The first line in a topmost construct definition.
+
+                                         (topmost-intro-cont    . 0)
+                                         ;; Topmost definition continuation lines.
+
+                                         (member-init-intro     . +)
+                                         ;; First line in a member initialization list.
+
+                                         (member-init-cont      . ++)
+                                         ;; Subsequent member initialization list lines.
+
+                                         (inher-intro           . +)
+                                         ;; First line of a multiple inheritance list.
+
+                                         (inher-cont            . ++)
+                                         ;; Subsequent multiple inheritance lines.
+
+                                         (block-open            . 0)
+                                         ;; Statement block open brace.
+
+                                         (block-close           . 0)
+                                         ;; Statement block close brace.
+
+                                         (brace-list-open       . 0)
+                                         ;; Open brace of an enum or static array list.
+
+                                         (brace-list-close      . 0)
+                                         ;; Close brace of an enum or static array list.
+
+                                         (brace-list-intro      . +)
+                                         ;; First line in an enum or static array list.
+
+                                         (brace-list-entry      . 0)
+                                         ;; Subsequent lines in an enum or static array list.
+
+                                         (brace-entry-open      . +)
+                                         ;; Subsequent lines in an enum or static array
+                                         ;; list that start with an open brace.
+
+                                         (statement             . 0)
+                                         ;; A C (or like) statement.
+
+                                         (statement-cont        . ++)
+                                         ;; A continuation of a C (or like) statement.
+
+                                         (statement-block-intro . +)
+                                         ;; The first line in a new statement block.
+
+                                         (statement-case-intro  . +)
+                                         ;; The first line in a case "block".
+
+                                         (statement-case-open   . +)
+                                         ;; The first line in a case block starting with brace.
+
+                                         (substatement          . 0)
+                                         ;; The first line after an if/while/for/do/else.
+
+                                         (substatement-open     . 0)
+                                         ;; The brace that opens a substatement block.
+
+                                         (substatement-label    . /)
+                                         ;; Labelled line after an if/while/for/do/else.
+
+                                         (case-label            . +)
+                                         ;; A "case" or "default" label.
+
+                                         (access-label          . 0)
+                                         ;; C++ private/protected/public access label.
+
+                                         (label                 . /)
+                                         ;; Any ordinary label.
+
+                                         (do-while-closure      . 0)
+                                         ;; The "while" that ends a do/while construct.
+
+                                         (else-clause           . 0)
+                                         ;; The "else" of an if/else construct.
+
+                                         (catch-clause          . 0)
+                                         ;; The "catch" or "finally" of a try/catch construct.
+
+                                         (comment-intro         . 0)
+                                         ;; A line containing only a comment introduction.
+
+                                         (arglist-intro         . +)
+                                         ;; The first line in an argument list.
+
+                                         (arglist-cont          . +)
+                                         ;; Subsequent argument list lines when no
+                                         ;; arguments follow on the same line as the
+                                         ;; arglist opening paren.
+
+                                         (arglist-cont-nonempty . +)
+                                         ;; Subsequent argument list lines when at
+                                         ;; least one argument follows on the same
+                                         ;; line as the arglist opening paren.
+
+                                         (arglist-close         . 0)
+                                         ;; The solo close paren of an argument list.
+
+                                         (stream-op             . +)
+                                         ;; Lines continuing a stream operator construct.
+
+                                         (inclass               . +)
+                                         ;; The construct is nested inside a class definition.
+                                         ;; Used together with e.g. `topmost-intro'.
+
+                                         (cpp-macro             . [0])
+                                         ;; The start of a C preprocessor macro definition.
+
+                                         (cpp-macro-cont        . [8])
+                                         ;; Inside a multi-line C preprocessor macro definition.
+
+                                         (friend                . 0)
+                                         ;; A C++ friend declaration.
+
+                                         (objc-method-intro     . [0])
+                                         ;; The first line of an Objective-C method definition.
+
+                                         (objc-method-args-cont . 0)
+                                         ;; Lines continuing an Objective-C method definition.
+
+                                         (objc-method-call-cont . (c-lineup-ObjC-method-call-colons ++))
+                                         ;; Lines continuing an Objective-C method call.
+
+                                         (extern-lang-open      . 0)
+                                         ;; Brace that opens an "extern" block.
+
+                                         (extern-lang-close     . 0)
+                                         ;; Brace that closes an "extern" block.
+
+                                         (inextern-lang         . +)
+                                         ;; Analogous to the `inclass' syntactic symbol,
+                                         ;; but used inside "extern" blocks.
+
+                                         (namespace-open        . 0)
+
+                                         (namespace-close       . 0)
+
+                                         (innamespace           . +)
+                                         ;; Similar to the three `extern-lang' symbols, but for
+                                         ;; C++ "namespace" blocks.
+
+                                         (module-open           . 0)
+
+                                         (module-close          . 0)
+
+                                         (inmodule              . +)
+                                         ;; Similar to the three `extern-lang' symbols, but for
+                                         ;; CORBA IDL "module" blocks.
+
+                                         (composition-open      . 0)
+
+                                         (composition-close     . 0)
+
+                                         (incomposition         . +)
+                                         ;; Similar to the three `extern-lang' symbols, but for
+                                         ;; CORBA CIDL "composition" blocks.
+
+                                         (template-args-cont    . +)
+                                         ;; C++ template argument list continuations.
+
+                                         (inlambda              . +)
+                                         ;; In the header or body of a lambda function.
+
+                                         (lambda-intro-cont     . ++)
+                                         ;; Continuation of the header of a lambda function.
+
+                                         (inexpr-statement      . +)
+                                         ;; The statement is inside an expression.
+
+                                         (inexpr-class          . +)
+                                         ;; The class is inside an expression.  Used e.g. for
+                                         ;; Java anonymous classes.
+                                         ))
+   ;; Only called when c-syntactic-indentation is non nil.
+   ;; (c-special-indent-hook . user-fun)
+
+
+   (tab-width                     . 4)  ; the true one!
+
+   (c-indent-level                . 4)  ; Indentation of C statements with
+                                        ; respect to containing block.
+
+   (c-brace-imaginary-offset      . 0)  ; Imagined indentation of a C open brace
+                                        ; that actually follows a statement.
+
+   (c-brace-offset                . 0)  ; Extra indentation for braces, compared
+                                        ; with other text in same context.
+
+   (c-argdecl-indent              . +)  ; Indentation level of declarations of
+                                        ; C function arguments.
+
+   (c-label-offset                . -)  ; Offset of C label lines and case
+                                        ; statements relative to usual
+                                        ; indentation.
+
+   (c-continued-statement-offset  . 8)  ; Extra indent for lines not starting
+                                        ; new statements.
+
+   (c-continued-brace-offset      . 0)  ; Extra indent for substatements that
+					; start with open-braces.
+
+
+   (c-auto-newline                . t)  ; Non-nil means automatically newline
+					; before and after braces, and after
+					; colons and semicolons, inserted in C
+					; code. If you do not want a leading
+					; newline before braces then use:
+					; (define-key c-mode-map \"{\"
+					;          'electric-c-semi)"
+
+   (c-tab-always-indent           . t)  ; Non-nil means TAB in C mode should
+					; always reindent the current line,
+					; regardless of where in the line point
+					; is when the TAB command is used.
+   ))
+
+
+
+(defun trustonic-c-mode-common-meat ()
+  "Meat for `c-mode-hook` for Trustonic code."
+  (interactive)
+  (c-set-style "trustonic")
+  (c-toggle-auto-newline 1))
+
+(add-hook 'c-mode-common-hook 'trustonic-c-mode-common-meat)
+
+
+
+(defun trustonic-company-name ()
+  "Substitute __MyCompanyName__ by Trustonic Ltd· in the whole current buffer."
+  (interactive)
+  (goto-char (point-min))
+  (while (re-search-forward "__MyCompanyName__" nil t)
+    (delete-region (match-beginning 0) (match-end 0))
+    (insert "Trustonic Ltd."))
+  (goto-char (point-min))
+  (message "Did you mind setting the company name in XCode preferences?"))
+
+
+(defun trustonic-remove-unneeded-spaces (start end)
+  "Remove duplicate spaces in the region.  (Inverse function of align-cols).
+START the start point
+END the end point."
+  (interactive "r")
+  (goto-char start)
+  (with-marker (end end)
+    (while (< (point) end)
+      (cond
+
+        ((looking-at "\"\\([^\\\"]\\|\\.\\)*\"")
+         (message "string ")
+         ;; skip over strings
+         (goto-char (match-end 0)))
+
+        ((looking-at "//.*\n")
+         (message "//comment ")
+         ;; skip over // comments
+         (goto-char (match-end 0)))
+
+        ((looking-at "/\\*\\(.\\|\n\\)*?\\*/")
+         (message "/*comment ")
+         ;; skip over C comments..
+         (goto-char (match-end 0)))
+
+        ((looking-at "  +")
+         (message "whitespaces ")
+         (delete-region (1+ (match-beginning 0)) (match-end 0)))
+
+        (t
+         (message ". ")
+         (forward-char 1))))
+    (indent-region start end)))
+
+
+(defun trustonic-remove-interlines ()
+  "Remove duplicate lines after toplevel closing braces."
+  (interactive)
+  (save-excursion
+   (goto-char (point-min))
+   (while (re-search-forward "^\\(}\\|@end\\) *\\(\n *\\)*\n" nil t)
+     (let ((token (match-string 1)))
+       (delete-region (match-beginning 0) (match-end 0))
+       (insert (cond
+                 ((string= token "}")    "}\n\n")
+                 ((string= token "@end") "@end\n\n")
+                 (t                      (format "%s\n\n" token))))))))
+
+
+(defun trustonic-insert-interlines ()
+  "Insert duplicate lines after toplevel closing braces."
+  (interactive)
+  (save-excursion
+   (goto-char (point-min))
+   (while (re-search-forward "^\\(}\\|@end\\) *\\(\n *\\)*\n" nil t)
+     (let ((token (match-string 1)))
+       (delete-region (match-beginning 0) (match-end 0))
+       (insert (cond
+                 ((string= token "}")    "}\n\n\n")
+                 ((string= token "@end") "@end\n\n\n\n")
+                 (t                      (format "%s\n\n" token))))))))
+
+
+(provide 'trustonic-c-style)
+;;; trustonic.el ends here
ViewGit