-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added VHDL Support via Emacs #1980
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
library ieee; | ||
use ieee.std_logic_1164.all; | ||
entity test is | ||
port( | ||
clk : in std_logic; | ||
d : in std_logic; | ||
q : out std_logic); | ||
end test; | ||
architecture rtl of test is | ||
begin | ||
process (clk) | ||
begin | ||
if rising_edge(clk) then | ||
q <= d; | ||
end if; | ||
end; | ||
end rtl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
library ieee; | ||
use ieee.std_logic_1164.all; | ||
entity test is | ||
port( | ||
clk : in std_logic; | ||
d : in std_logic ; | ||
q :out std_logic ); | ||
end test; | ||
architecture rtl of test is | ||
begin | ||
process (clk) | ||
begin | ||
if rising_edge(clk) then | ||
q <= d; | ||
end if; | ||
end; | ||
end rtl; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/beautifiers/vhdl-beautifier/emacs-vhdl-formating-script.lisp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
(defun vhdl-batch-indent-region () | ||
"Run `f90-batch-beatify-region' on the specified filename. | ||
Use this from the command line, with `-batch'; | ||
it won't work in an interactive Emacs. | ||
For example, invoke \"emacs -batch -l ~/.emacs-batch-vhdl-indent -f vhdl-batch-indent-region file.f\"" | ||
(if (not noninteractive) | ||
(error "`vhdl-batch-indent-region' is to be used only with -batch")) | ||
(let ((make-backup-files nil) | ||
(version-control nil) | ||
(auto-save-default nil) | ||
(find-file-run-dired nil) | ||
(kept-old-versions 259259) | ||
(kept-new-versions 259259)) | ||
(let ((error 0) | ||
file | ||
(files ())) | ||
(while command-line-args-left | ||
(setq file (expand-file-name (car command-line-args-left))) | ||
(cond ((not (file-exists-p file)) | ||
(message ">> %s does not exist!" file) | ||
(setq error 1 | ||
command-line-args-left (cdr command-line-args-left))) | ||
((file-directory-p file) | ||
(setq command-line-args-left | ||
(nconc (directory-files file) | ||
(cdr command-line-args-left)))) | ||
(t | ||
(setq files (cons file files) | ||
command-line-args-left (cdr command-line-args-left))))) | ||
(while files | ||
(setq file (car files) | ||
files (cdr files)) | ||
(condition-case err | ||
(progn | ||
(if buffer-file-name (kill-buffer (current-buffer))) | ||
(find-file file) | ||
(buffer-disable-undo (current-buffer)) | ||
(set-buffer-modified-p nil) | ||
(vhdl-mode) | ||
(message (file-name-nondirectory buffer-file-name)) | ||
; compute indentation of first | ||
; line | ||
(vhdl-beautify-buffer) | ||
(save-buffer) | ||
)))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
### | ||
Requires https://www.gnu.org/software/emacs/ | ||
### | ||
|
||
"use strict" | ||
Beautifier = require('../beautifier') | ||
path = require("path") | ||
|
||
module.exports = class VhdlBeautifier extends Beautifier | ||
name: "Vhdl Beautifier" | ||
link: "https://www.gnu.org/software/emacs/" | ||
executables: [ | ||
{ | ||
name: "Emacs" | ||
cmd: "emacs" | ||
homepage: "https://www.gnu.org/software/emacs/" | ||
installation: "https://www.gnu.org/software/emacs/" | ||
version: { | ||
parse: (text) -> text.match(/Emacs (\d+\.\d+\.\d+)/)[1] | ||
} | ||
} | ||
] | ||
|
||
options: { | ||
Vhdl: true | ||
} | ||
|
||
beautify: (text, language, options) -> | ||
@debug('vhdl-beautifier', options) | ||
emacs = @exe("emacs") | ||
|
||
emacs_path = options.emacs_path | ||
emacs_script_path = options.emacs_script_path | ||
|
||
if not emacs_script_path | ||
emacs_script_path = path.resolve(__dirname, "emacs-vhdl-formating-script.lisp") | ||
|
||
@debug('vhdl-beautifier', 'emacs script path: ' + emacs_script_path) | ||
|
||
args = [ | ||
'--batch' | ||
'-l' | ||
emacs_script_path | ||
'-f' | ||
'vhdl-batch-indent-region' | ||
tempFile = @tempFile("temp", text) | ||
] | ||
|
||
if emacs_path | ||
@deprecateOptionForExecutable("Emacs", "emacs_path", "Path") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This |
||
@run(emacs_path, args, {ignoreReturnCode: false}) | ||
.then(=> | ||
@readFile(tempFile) | ||
) | ||
else | ||
emacs.run(args, {ignoreReturnCode: false}) | ||
.then(=> | ||
@readFile(tempFile) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,6 +73,7 @@ module.exports = class Languages | |
"ux_markup" | ||
"vala" | ||
"vue" | ||
"vhdl" | ||
"visualforce" | ||
"xml" | ||
"xtemplate" | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
emacs_path
.