diff options
Diffstat (limited to 'lib/skels')
| -rw-r--r-- | lib/skels/jao-skel-cpp.el | 10 | ||||
| -rw-r--r-- | lib/skels/jao-skel-haskell.el | 24 |
2 files changed, 13 insertions, 21 deletions
diff --git a/lib/skels/jao-skel-cpp.el b/lib/skels/jao-skel-cpp.el index 0ddb61e..1180495 100644 --- a/lib/skels/jao-skel-cpp.el +++ b/lib/skels/jao-skel-cpp.el @@ -1,6 +1,6 @@ ;;; jao-skel-cpp.el -*- lexical-binding: t; -*- -;; Copyright (C) 2004, 2005, 2008, 2009, 2022 Jose Antonio Ortega Ruiz +;; Copyright (C) 2004, 2005, 2008, 2009, 2022, 2026 Jose Antonio Ortega Ruiz ;; Author: Jose A Ortega Ruiz <jao@gnu.org> ;; Keywords: tools @@ -50,7 +50,7 @@ ;;; Auxiliar functions (defun jao-skel-cpp--find-other (ext) (file-name-nondirectory - (or (ff-other-file-name) + (or (ff-get-other-file) (concat (file-name-sans-extension (buffer-name)) "." ext)))) (defun jao-skel-cpp-make-guard-name (ns) @@ -68,7 +68,7 @@ (defsubst jao-skel-cpp--ns2str (ns) (mapconcat 'identity ns "::")) (defun jao-skel-cpp--get-ns-list (&optional acc) - (do* ((result acc (cons next result)) + (cl-do* ((result acc (cons next result)) (next (jao-skel-cpp--read-ns (jao-skel-cpp--ns2str acc)) (jao-skel-cpp--read-ns (jao-skel-cpp--ns2str (reverse result))))) ((string= next "") (reverse result)))) @@ -98,11 +98,11 @@ (while (re-search-forward "namespace\\s-\\w+\\s-{\\|}+\\s-//\\s-namespace" nil t) (push (thing-at-point 'line) lines) - (next-line))) + (forward-line))) lines)) (defun jao-skel-cpp--copy-namespace () - (let* ((name (ff-other-file-name)) + (let* ((name (ff-get-file-name)) (buff (and name (find-file-noselect name))) (nlines)) (when buff diff --git a/lib/skels/jao-skel-haskell.el b/lib/skels/jao-skel-haskell.el index 01a9936..0c3c17d 100644 --- a/lib/skels/jao-skel-haskell.el +++ b/lib/skels/jao-skel-haskell.el @@ -1,4 +1,5 @@ -;;; jao-skel-haskell.el --- skeleton for haskell source files -*- lexical-binding: t; -*- +;; jao-skel-haskell.el --- skeleton for haskell -*- lexical-binding: t; -*- + ;; Copyright (C) 2003, 2004, 2005, 2009, 2010, 2012, 2022 Jose A Ortega Ruiz ;; Author: Jose A Ortega Ruiz <jao@member.fsf.org> @@ -19,31 +20,23 @@ ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. -;;; Commentary: - -;; - ;;; Code: (require 'jao-skel) (require 'jao-compilation) +(require 'haskell-mode nil t) -;;; Auxiliar -(defun jao-skel--read-haskell-module () - (let* ((ddir (jao-compilation-root)) - (mbase (and ddir (concat (replace-regexp-in-string "/" "." ddir) - "."))) - (m (read-string "Module prefix (empty for no module): " - (concat (or mbase "") (jao-skel-basename))))) - (or m ""))) +(defun jao-skel-haskell--guess-module () + (if (fboundp 'haskell-guess-module-name) + (haskell-guess-module-name) + (read-string "Module: " (jao-skel-basename)))) (defconst jao-skel--haskell-line (make-string 78 ?-)) -;;; Skeletons (define-skeleton jao-skel-haskell-file "Haskell hs file header" "Brief description: " - '(setq v (jao-skel--read-haskell-module)) + '(setq v (jao-skel-haskell--guess-module)) jao-skel--haskell-line \n "-- |" \n "-- Module: " v \n @@ -63,7 +56,6 @@ "module " v " where " \n \n \n) (jao-skel-install "\\.hs\\'" 'jao-skel-haskell-file) -;; (jao-skel-install "\\.lhs\\'" 'jao-skel-lit-haskell-file) (provide 'jao-skel-haskell) |
