Initial commit
This commit is contained in:
62
elpa/macrostep-20161120.1306/macrostep-autoloads.el
Normal file
62
elpa/macrostep-20161120.1306/macrostep-autoloads.el
Normal file
@@ -0,0 +1,62 @@
|
||||
;;; macrostep-autoloads.el --- automatically extracted autoloads
|
||||
;;
|
||||
;;; Code:
|
||||
(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
|
||||
|
||||
;;;### (autoloads nil "macrostep" "macrostep.el" (23009 31986 656147
|
||||
;;;;;; 654000))
|
||||
;;; Generated autoloads from macrostep.el
|
||||
|
||||
(autoload 'macrostep-mode "macrostep" "\
|
||||
Minor mode for inline expansion of macros in Emacs Lisp source buffers.
|
||||
|
||||
\\<macrostep-keymap>Progressively expand macro forms with \\[macrostep-expand], collapse them with \\[macrostep-collapse],
|
||||
and move back and forth with \\[macrostep-next-macro] and \\[macrostep-prev-macro].
|
||||
Use \\[macrostep-collapse-all] or collapse all visible expansions to
|
||||
quit and return to normal editing.
|
||||
|
||||
\\{macrostep-keymap}
|
||||
|
||||
\(fn &optional ARG)" t nil)
|
||||
|
||||
(autoload 'macrostep-expand "macrostep" "\
|
||||
Expand the macro form following point by one step.
|
||||
|
||||
Enters `macrostep-mode' if it is not already active, making the
|
||||
buffer temporarily read-only. If macrostep-mode is active and the
|
||||
form following point is not a macro form, search forward in the
|
||||
buffer and expand the next macro form found, if any.
|
||||
|
||||
With a prefix argument, the expansion is displayed in a separate
|
||||
buffer instead of inline in the current buffer. Setting
|
||||
`macrostep-expand-in-separate-buffer' to non-nil swaps these two
|
||||
behaviors.
|
||||
|
||||
\(fn &optional TOGGLE-SEPARATE-BUFFER)" t nil)
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil "macrostep-c" "macrostep-c.el" (23009 31986
|
||||
;;;;;; 646147 635000))
|
||||
;;; Generated autoloads from macrostep-c.el
|
||||
|
||||
(autoload 'macrostep-c-mode-hook "macrostep-c" "\
|
||||
|
||||
|
||||
\(fn)" nil nil)
|
||||
|
||||
(add-hook 'c-mode-hook #'macrostep-c-mode-hook)
|
||||
|
||||
;;;***
|
||||
|
||||
;;;### (autoloads nil nil ("macrostep-pkg.el") (23009 31986 636147
|
||||
;;;;;; 625000))
|
||||
|
||||
;;;***
|
||||
|
||||
;; Local Variables:
|
||||
;; version-control: never
|
||||
;; no-byte-compile: t
|
||||
;; no-update-autoloads: t
|
||||
;; End:
|
||||
;;; macrostep-autoloads.el ends here
|
||||
187
elpa/macrostep-20161120.1306/macrostep-c.el
Normal file
187
elpa/macrostep-20161120.1306/macrostep-c.el
Normal file
@@ -0,0 +1,187 @@
|
||||
;;; macrostep-c.el --- macrostep interface to C preprocessor
|
||||
|
||||
;; Copyright (C) 2015 Jon Oddie <j.j.oddie@gmail.com>
|
||||
|
||||
;; Author: Jon Oddie <j.j.oddie@gmail.com>
|
||||
;; Maintainer: Jon Oddie <j.j.oddie@gmail.com>
|
||||
;; Created: 27 November 2015
|
||||
;; Updated: 27 November 2015
|
||||
;; Version: 0.9
|
||||
;; Keywords: c, languages, macro, debugging
|
||||
;; Url: https://github.com/joddie/macrostep
|
||||
|
||||
;; This file is NOT part of GNU Emacs.
|
||||
|
||||
;; 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:
|
||||
|
||||
;; A thin wrapper around Emacs's built-in `cmacexp' library to provide
|
||||
;; basic support for expanding C macros using the `macrostep' user
|
||||
;; interface. To use, position point on a macro use in a C buffer and
|
||||
;; type `M-x macrostep-expand'. The variables `c-macro-preprocessor'
|
||||
;; and especially `c-macro-cppflags' may need to be set correctly for
|
||||
;; accurate expansion.
|
||||
|
||||
;; This is fairly basic compared to the Emacs Lisp `macrostep'. In
|
||||
;; particular, there is no step-by-step expansion, since C macros are
|
||||
;; expanded in a single "cpp" pass, and no pretty-printing.
|
||||
|
||||
;; To hide the buffer containing "cpp" warnings (not recommended), you
|
||||
;; could do something like:
|
||||
;;
|
||||
;; (push `(,(regexp-quote macrostep-c-warning-buffer)
|
||||
;; (display-buffer-no-window))
|
||||
;; display-buffer-alist)
|
||||
|
||||
;;; Code:
|
||||
|
||||
(require 'macrostep)
|
||||
(require 'cmacexp)
|
||||
(require 'cl-lib)
|
||||
|
||||
(eval-and-compile
|
||||
(if (require 'subr-x nil t)
|
||||
(defalias 'macrostep-c-string-trim 'string-trim)
|
||||
(defun macrostep-c-string-trim (string)
|
||||
(when (string-match "\\`[ \t\n\r]+" string)
|
||||
(setq string (replace-match "" t t string)))
|
||||
(when (string-match "[ \t\n\r]+\\'" string)
|
||||
(setq string (replace-match "" t t string)))
|
||||
string)))
|
||||
|
||||
(put 'macrostep-c-non-macro 'error-conditions
|
||||
'(macrostep-c-non-macro error))
|
||||
(put 'macrostep-c-non-macro 'error-message
|
||||
"Text around point is not a macro call.")
|
||||
|
||||
(put 'macrostep-c-expansion-failed 'error-conditions
|
||||
'(macrostep-c-expansion-failed error))
|
||||
(put 'macrostep-c-expansion-failed 'error-message
|
||||
"Macro-expansion failed.")
|
||||
|
||||
(defvar macrostep-c-warning-buffer "*Macroexpansion Warnings*")
|
||||
|
||||
;;;###autoload
|
||||
(defun macrostep-c-mode-hook ()
|
||||
(setq macrostep-sexp-bounds-function
|
||||
#'macrostep-c-sexp-bounds)
|
||||
(setq macrostep-sexp-at-point-function
|
||||
#'macrostep-c-sexp-at-point)
|
||||
(setq macrostep-environment-at-point-function
|
||||
#'ignore)
|
||||
(setq macrostep-expand-1-function
|
||||
#'macrostep-c-expand-1)
|
||||
(setq macrostep-print-function
|
||||
#'macrostep-c-print-function)
|
||||
(add-hook 'macrostep-mode-off-hook
|
||||
#'macrostep-c-mode-off nil t))
|
||||
|
||||
(defun macrostep-c-mode-off (&rest ignore)
|
||||
(when (derived-mode-p 'c-mode)
|
||||
(let ((warning-window
|
||||
(get-buffer-window macrostep-c-warning-buffer)))
|
||||
(when warning-window
|
||||
(quit-window nil warning-window)))))
|
||||
|
||||
;;;###autoload
|
||||
(add-hook 'c-mode-hook #'macrostep-c-mode-hook)
|
||||
|
||||
(defun macrostep-c-sexp-bounds ()
|
||||
(save-excursion
|
||||
(cl-loop
|
||||
(let ((region (macrostep-c-sexp-bounds-1)))
|
||||
(cond
|
||||
((null region)
|
||||
(signal 'macrostep-c-non-macro nil))
|
||||
((macrostep-c-expandable-p region)
|
||||
(cl-return region))
|
||||
(t
|
||||
(condition-case nil
|
||||
(progn
|
||||
(backward-up-list)
|
||||
(skip-syntax-backward "-"))
|
||||
(scan-error
|
||||
(signal 'macrostep-c-non-macro nil)))))))))
|
||||
|
||||
(defun macrostep-c-sexp-bounds-1 ()
|
||||
(let ((region (bounds-of-thing-at-point 'symbol)))
|
||||
(when region
|
||||
(cl-destructuring-bind (symbol-start . symbol-end) region
|
||||
(save-excursion
|
||||
(goto-char symbol-end)
|
||||
(if (looking-at "[[:space:]]*(")
|
||||
(cons symbol-start (scan-sexps symbol-end 1))
|
||||
region))))))
|
||||
|
||||
(defun macrostep-c-expandable-p (region)
|
||||
(cl-destructuring-bind (start . end) region
|
||||
(condition-case nil
|
||||
(cl-destructuring-bind (expansion warnings)
|
||||
(macrostep-c-expand-region start end)
|
||||
(declare (ignore warnings))
|
||||
(and (cl-plusp (length expansion))
|
||||
(not (string= expansion (buffer-substring start end)))))
|
||||
(macrostep-c-expansion-failed nil))))
|
||||
|
||||
(defun macrostep-c-sexp-at-point (start end)
|
||||
(cons start end))
|
||||
|
||||
(defun macrostep-c-expand-1 (region _ignore)
|
||||
(cl-destructuring-bind (start . end) region
|
||||
(cl-destructuring-bind (expansion warnings)
|
||||
(macrostep-c-expand-region start end)
|
||||
(when (cl-plusp (length warnings))
|
||||
(with-current-buffer
|
||||
(get-buffer-create macrostep-c-warning-buffer)
|
||||
(let ((inhibit-read-only t))
|
||||
(erase-buffer)
|
||||
(insert warnings)
|
||||
(goto-char (point-min)))
|
||||
(special-mode)
|
||||
(display-buffer (current-buffer)
|
||||
'(display-buffer-pop-up-window
|
||||
(inhibit-same-window . t)
|
||||
(allow-no-window . t)))))
|
||||
expansion)))
|
||||
|
||||
(defun macrostep-c-expand-region (start end)
|
||||
(let ((expansion
|
||||
(condition-case nil
|
||||
(c-macro-expansion start end
|
||||
(concat c-macro-preprocessor " "
|
||||
c-macro-cppflags))
|
||||
(search-failed
|
||||
(signal 'macrostep-c-expansion-failed nil)))))
|
||||
(with-temp-buffer
|
||||
(save-excursion
|
||||
(insert expansion))
|
||||
(when (looking-at (regexp-quote "/*"))
|
||||
(search-forward "*/"))
|
||||
(let ((warnings (buffer-substring (point-min) (point)))
|
||||
(expansion (buffer-substring (point) (point-max))))
|
||||
(mapcar #'macrostep-c-string-trim (list expansion warnings))))))
|
||||
|
||||
(defun macrostep-c-print-function (expansion &rest _ignore)
|
||||
(with-temp-buffer
|
||||
(insert expansion)
|
||||
(let ((exit-code
|
||||
(shell-command-on-region (point-min) (point-max) "indent" nil t)))
|
||||
(when (zerop exit-code)
|
||||
(setq expansion (macrostep-c-string-trim (buffer-string))))))
|
||||
(insert expansion))
|
||||
|
||||
(provide 'macrostep-c)
|
||||
|
||||
;;; macrostep-c.el ends here
|
||||
BIN
elpa/macrostep-20161120.1306/macrostep-c.elc
Normal file
BIN
elpa/macrostep-20161120.1306/macrostep-c.elc
Normal file
Binary file not shown.
7
elpa/macrostep-20161120.1306/macrostep-pkg.el
Normal file
7
elpa/macrostep-20161120.1306/macrostep-pkg.el
Normal file
@@ -0,0 +1,7 @@
|
||||
(define-package "macrostep" "20161120.1306" "interactive macro expander"
|
||||
'((cl-lib "0.5"))
|
||||
:url "https://github.com/joddie/macrostep" :keywords
|
||||
'("lisp" "languages" "macro" "debugging"))
|
||||
;; Local Variables:
|
||||
;; no-byte-compile: t
|
||||
;; End:
|
||||
1129
elpa/macrostep-20161120.1306/macrostep.el
Normal file
1129
elpa/macrostep-20161120.1306/macrostep.el
Normal file
File diff suppressed because it is too large
Load Diff
BIN
elpa/macrostep-20161120.1306/macrostep.elc
Normal file
BIN
elpa/macrostep-20161120.1306/macrostep.elc
Normal file
Binary file not shown.
Reference in New Issue
Block a user