Skip to content
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

remove annoying template from error messages #4

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions README.mkdn
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
flymake-cursor.el
=================

NOTE: This project is no longer actively maintained, please consider https://github.com/flycheck/flycheck instead.
This is a fork of https://github.com/flymake/emacs-flymake-cursor
which is fork of https://www.emacswiki.org/emacs/flymake-cursor.el.

This project is a plugin for Emacs to work in conjunction with flymake.el
it displays any flymake error for the current line on the minibuffer.
It also works with latest flymake (Emacs >= 26) unlike upstream

The project is a fork of http://www.emacswiki.org/emacs/flymake-cursor.el
This project is a plugin for Emacs to work in conjunction with
flymake.el it displays any flymake error for the current line on the
minibuffer.

It adds the following features:

Expand All @@ -20,14 +22,17 @@ It adds the following features:

INSTALLATION
------------
Clone repo

####Package Manager
This package is available on [MELPA](https://melpa.org) and [MELPA Stable](https://stable.melpa.org), so you can
```
M-x package-install flymake-cursor
#### use-package
```lisp
(use-package flymake-cursor
:load-path "~/.emacs.d/lisp/emacs-flymake-cursor" ;; cloned repo path
:config
(flymake-cursor-mode))
```

####Self installation
#### manual
Place `flymake-cursor.el` within your Emacs `load-path` and the following to your
`.emacs` file or your `init.el`:

Expand Down
21 changes: 14 additions & 7 deletions flymake-cursor.el
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,27 @@ the mode directly."

(defun flymake-cursor-get-errors-at-point ()
"Gets the first `flymake-cursor-number-of-errors-to-display` flymake errors on the line at point."
(let ((line-err-info-list (nth 0 (flymake-find-err-info flymake-err-info (line-number-at-pos)))))
(let ((line-err-info-list (flymake-cursor-get-errors)))
(if flymake-cursor-number-of-errors-to-display
(butlast line-err-info-list (- (length line-err-info-list) flymake-cursor-number-of-errors-to-display))
(butlast line-err-info-list (- (length line-err-info-list) flymake-cursor-number-of-errors-to-display))
line-err-info-list)))

(defun flymake-cursor-get-errors ()
(cond ((boundp 'flymake-err-info) ; emacs < 26
(let ((lineno (line-number-at-pos)))
(car (flymake-find-err-info flymake-err-info lineno))))
((and (fboundp 'flymake-diagnostic-text)
(fboundp 'flymake-diagnostics)) ; emacs >= 26
(flymake-diagnostics (point)))))

(defun flymake-cursor-pyflake-determine-message (error)
"pyflake is flakey if it has compile problems, this adjusts the
message to display, so there is one ;)"
(cond ((not (or (eq major-mode 'Python) (eq major-mode 'python-mode) t)))
((null (flymake-ler-file error))
;; normal message do your thing
(flymake-ler-text error))
(t ;; could not compile error
(format "compile error, problem on line %s" (flymake-ler-line error)))))
((fboundp 'flymake-diagnostic-text)
(let ((msg (flymake-diagnostic-text error))) msg))
(t
(flymake-ler-text error))))

(defun flymake-cursor-safe-to-display ()
"Returns t if Flymake Cursor is safe to display to the minibuffer or nil if
Expand Down