Modified define-frame-parameter.

Pascal J. Bourguignon [2019-06-16 08:01]
Modified define-frame-parameter.
Filename
pjb-hash-table.el
pjb-unicode.el
pjb-xresources.el
diff --git a/pjb-hash-table.el b/pjb-hash-table.el
deleted file mode 100644
index 50e47d2..0000000
--- a/pjb-hash-table.el
+++ /dev/null
@@ -1,56 +0,0 @@
-;;;; -*- mode:emacs-lisp;coding:utf-8 -*-
-;;;;**************************************************************************
-;;;;FILE:               pjb-hash-table.el
-;;;;LANGUAGE:           emacs lisp
-;;;;SYSTEM:             POSIX
-;;;;USER-INTERFACE:     NONE
-;;;;DESCRIPTION
-;;;;
-;;;;    Implements hash table functions.
-;;;;
-;;;;AUTHORS
-;;;;    <PJB> Pascal J. Bourguignon <pjb@informatimago.com>
-;;;;MODIFICATIONS
-;;;;    2017-01-25 <PJB> Added this header.
-;;;;BUGS
-;;;;LEGAL
-;;;;    AGPL3
-;;;;
-;;;;    Copyright Pascal J. Bourguignon 2017 - 2017
-;;;;
-;;;;    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)
-
-(defun* hashtable (&key (test (function eql))
-                        (size nil sizep)
-                        (rehash-size nil rehash-size-p)
-                        (rehash-threshold nil rehash-threshold-p)
-                        elements)
-  "Creates a new hash-table, filled with the given ELEMENTS.
-ELEMENTS must be a list of lists of two items, the key and the value.
-Note: we use the name HASHTABLE to avoid name collision."
-  (let ((table (apply (function make-hash-table)
-                      :test test
-                      (append (when sizep
-                                (list :size size))
-                              (when rehash-size-p
-                                (list :rehash-size rehash-size))
-                              (when rehash-threshold-p
-                                (list :rehash-threshold rehash-threshold))))))
-    (dolist (item elements table)
-      (setf (gethash (first item) table) (second item)))))
-
-
-(provide 'pjb-hash-tabl)
diff --git a/pjb-unicode.el b/pjb-unicode.el
deleted file mode 100644
index 961460e..0000000
--- a/pjb-unicode.el
+++ /dev/null
@@ -1,208 +0,0 @@
-;;;; -*- mode:emacs-lisp;coding:utf-8 -*-
-;;;;**************************************************************************
-;;;;FILE:               pjb-unicode.el
-;;;;LANGUAGE:           emacs lisp
-;;;;SYSTEM:             POSIX
-;;;;USER-INTERFACE:     NONE
-;;;;DESCRIPTION
-;;;;
-;;;;    Implements functions binding locally keys to unicode alphabets.
-;;;;
-;;;;AUTHORS
-;;;;    <PJB> Pascal J. Bourguignon <pjb@informatimago.com>
-;;;;MODIFICATIONS
-;;;;    2017-01-25 <PJB> Added this header.
-;;;;BUGS
-;;;;LEGAL
-;;;;    AGPL3
-;;;;
-;;;;    Copyright Pascal J. Bourguignon 2017 - 2017
-;;;;
-;;;;    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)
-
-(defun pjb-unicode-ascii ()
-  (interactive)
-  (loop for ch from ?0 to ?9
-        do (local-set-key (kbd (string ch)) nil))
-  (loop for ch from ?A to ?Z
-        do (local-set-key (kbd (string ch)) nil)
-           (local-set-key (kbd (string (+ #x20 ch))) nil)))
-
-
-(defun pjb-unicode-parenthesized-latin ()
-  (interactive)
-  (loop for ch from ?0 to ?9
-        for mf from #x1d7f6
-        do  (local-set-key (kbd (string ch))        (string mf)))
-  (loop for ch from ?a to ?z
-        for mf from 9372
-        do (local-set-key (kbd (string ch))          (string mf))))
-
-
-(defun pjb-unicode-circled-latin ()
-  (interactive)
-  (loop for ch from ?0 to ?9
-        for mf from 9450
-        do  (local-set-key (kbd (string ch))        (string mf)))
-  (loop for ch from ?A to ?Z
-        for mf from 9398
-        do (local-set-key (kbd (string ch))          (string mf))
-           (local-set-key (kbd (string (+ #x20 ch))) (string (+ 26 mf)))))
-
-
-(defun pjb-unicode-fullwidth-latin ()
-  (interactive)
-  (loop for ch from ?0 to ?9
-        for mf from 65296
-        do  (local-set-key (kbd (string ch))        (string mf)))
-  (loop for ch from ?A to ?Z
-        for mf from 65313
-        do (local-set-key (kbd (string ch))          (string mf))
-           (local-set-key (kbd (string (+ #x20 ch))) (string (+ 32 mf)))))
-
-(defun pjb-unicode-mathematical-bold ()
-  (interactive)
-  (loop for ch from ?0 to ?9
-        for mf from #x1d7f6
-        do  (local-set-key (kbd (string ch))        (string mf)))
-  (loop for ch from ?A to ?Z
-        for mf from 119808
-        do (local-set-key (kbd (string ch))          (string mf))
-           (local-set-key (kbd (string (+ #x20 ch))) (string (+ 26 mf)))))
-
-(defun pjb-unicode-mathematical-bold-italic ()
-  (interactive)
-  (loop for ch from ?0 to ?9
-        for mf from #x1d7f6
-        do  (local-set-key (kbd (string ch))        (string mf)))
-  (loop for ch from ?A to ?Z
-        for mf from 119912
-        do (local-set-key (kbd (string ch))          (string mf))
-           (local-set-key (kbd (string (+ #x20 ch))) (string (+ 26 mf)))))
-
-(defun pjb-unicode-mathematical-script ()
-  (interactive)
-  (loop for ch from ?0 to ?9
-        for mf from #x1d7f6
-        do  (local-set-key (kbd (string ch))        (string mf)))
-  (loop for ch from ?A to ?Z
-        for mf from 119964
-        do (local-set-key (kbd (string ch))          (string mf))
-           (local-set-key (kbd (string (+ #x20 ch))) (string (+ 26 mf)))))
-
-(defun pjb-unicode-mathematical-script-bold ()
-  (interactive)
-  (loop for ch from ?0 to ?9
-        for mf from 120782
-        do  (local-set-key (kbd (string ch))        (string mf)))
-  (loop for ch from ?A to ?Z
-        for mf from 120016
-        do (local-set-key (kbd (string ch))          (string mf))
-           (local-set-key (kbd (string (+ #x20 ch))) (string (+ 26 mf)))))
-
-(defun pjb-unicode-mathematical-double-struck ()
-  (interactive)
-  (loop for ch from ?0 to ?9
-        for mf from 120792
-        do  (local-set-key (kbd (string ch))        (string mf)))
-  (loop for ch from ?A to ?Z
-        for mf from #x1d538
-        do (local-set-key (kbd (string ch))          (string mf))
-           (local-set-key (kbd (string (+ #x20 ch))) (string (+ 26 mf))))
-  (local-set-key (kbd "C") "ℂ")
-  (local-set-key (kbd "H") "ℍ")
-  (local-set-key (kbd "N") "ℕ")
-  (local-set-key (kbd "P") "ℙ")
-  (local-set-key (kbd "Q") "ℚ")
-  (local-set-key (kbd "R") "ℝ")
-  (local-set-key (kbd "Z") "ℤ"))
-
-(defun pjb-unicode-mathematical-fraktur ()
-  (interactive)
-  (loop for ch from ?1 to ?9
-        for mf from #x02170
-        do  (local-set-key (kbd (string ch))        (string mf)))
-  (loop for ch from ?A to ?Z
-        for mf from #x1d504
-        do (local-set-key (kbd (string ch))          (string mf))
-           (local-set-key (kbd (string (+ #x20 ch))) (string (+ 26 mf))))
-  (local-set-key (kbd "C") "ℭ")
-  (local-set-key (kbd "H") "ℌ")
-  (local-set-key (kbd "I") "ℑ")
-  (local-set-key (kbd "R") "ℜ")
-  (local-set-key (kbd "Z") "ℨ"))
-
-(defun pjb-unicode-mathematical-fraktur-bold ()
-  (interactive)
-  (loop for ch from ?1 to ?9
-        for mf from #x02160
-        do  (local-set-key (kbd (string ch))        (string mf)))
-  (loop for ch from ?A to ?Z
-        for mf from #x1d56c
-        do (local-set-key (kbd (string ch))          (string mf))
-           (local-set-key (kbd (string (+ #x20 ch))) (string (+ 26 mf)))))
-
-(defun pjb-unicode-mathematical-sans-serif ()
-  (interactive)
-  (loop for ch from ?0 to ?9
-        for mf from 120802
-        do  (local-set-key (kbd (string ch))        (string mf)))
-  (loop for ch from ?A to ?Z
-        for mf from #x1d5A0
-        do (local-set-key (kbd (string ch))          (string mf))
-           (local-set-key (kbd (string (+ #x20 ch))) (string (+ 26 mf)))))
-
-(defun pjb-unicode-mathematical-sans-serif-bold ()
-  (interactive)
-  (loop for ch from ?0 to ?9
-        for mf from 120812
-        do  (local-set-key (kbd (string ch))        (string mf)))
-  (loop for ch from ?A to ?Z
-        for mf from #x1d5D4
-        do (local-set-key (kbd (string ch))          (string mf))
-           (local-set-key (kbd (string (+ #x20 ch))) (string (+ 26 mf)))))
-
-(defun pjb-unicode-mathematical-sans-serif-italic ()
-  (interactive)
-  (loop for ch from ?0 to ?9
-        for mf from #x1d7ce
-        do  (local-set-key (kbd (string ch))        (string mf)))
-  (loop for ch from ?A to ?Z
-        for mf from #x1d608
-        do (local-set-key (kbd (string ch))          (string mf))
-           (local-set-key (kbd (string (+ #x20 ch))) (string (+ 26 mf)))))
-
-(defun pjb-unicode-mathematical-sans-serif-bold-italic ()
-  (interactive)
-  (loop for ch from ?0 to ?9
-        for mf from #x1d7ce
-        do  (local-set-key (kbd (string ch))        (string mf)))
-  (loop for ch from ?A to ?Z
-        for mf from 120380
-        do (local-set-key (kbd (string ch))          (string mf))
-           (local-set-key (kbd (string (+ #x20 ch))) (string (+ 26 mf)))))
-
-(defun pjb-unicode-mathematical-monospace ()
-  (interactive)
-  (loop for ch from ?0 to ?9
-        for mf from #x1d7f6
-        do  (local-set-key (kbd (string ch))        (string mf)))
-  (loop for ch from ?A to ?Z
-        for mf from #x1d670
-        do (local-set-key (kbd (string ch))          (string mf))
-           (local-set-key (kbd (string (+ #x20 ch))) (string (+ 26 mf)))))
-
-(provide 'pjb-unicode)
diff --git a/pjb-xresources.el b/pjb-xresources.el
index d518e72..677d8aa 100644
--- a/pjb-xresources.el
+++ b/pjb-xresources.el
@@ -42,8 +42,10 @@ RETURN: The current frame.


 (defmacro define-frame-parameter (name)
-  `(defun ,(intern (format "frame-%s" name)) (&optional frame)
-     (frame-parameter (or frame (selected-frame)) ',name)))
+  (let ((name (intern (format "frame-%s" name))))
+    (unless (fboundp name)
+      `(defun ,name (&optional frame)
+         (frame-parameter (or frame (selected-frame)) ',name)))))

 ;; (dolist (p (frame-parameters)) (insert (format "(define-frame-parameter %s)\n" (car p))))
ViewGit