* bug#18014: 24.3; Unused Lexical argument warning, when argument is used in a function...
@ 2014-07-14 12:25 Matthew Fidler
2014-07-14 12:28 ` Matthew Fidler
2014-07-14 14:47 ` Eli Zaretskii
0 siblings, 2 replies; 12+ messages in thread
From: Matthew Fidler @ 2014-07-14 12:25 UTC (permalink / raw)
To: 18014
[-- Attachment #1: Type: text/plain, Size: 17831 bytes --]
I'm getting a warning for ergoemacs-translate:
Compiling file
e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el at Mon
Jul 14 07:17:14 2014
ergoemacs-translate.el:695:1:Warning: Unused lexical argument `key'
I do use the argument key to calculate the translation, but the compiler
claims I am not. I'm not sure if it is a bug in the warning or a bug in
my code. For now, I can change key to _key to ignore the warning, but I
do think that this is an invalid warning.
Here is the offending function:
(defun ergoemacs-translate (key)
"Translates KEY and returns a plist of the translations.
:shift-translated
S-a -> a
M-S-a -> M-a
C-S-a -> C-a
Anything without shift is nil.
All other translations are defined in `ergoemacs-translations'.
There are also :XXX-key and :XXX-pretty for actual key-strokes
and `ergoemacs-pretty-key' descriptions.
"
(let* ((ret (gethash key ergoemacs-translate-hash))
(orig-key (or (and (stringp key) key) (key-description key)))
case-fold-search
only-key
shift-translated
(ergoemacs-use-ergoemacs-key-descriptions t)
shifted-key
unshifted-key)
(if ret ret
(cond
((string-match "\\(^<.+>$\\|SPC\\|DEL\\|ESC\\|RET\\|TAB\\)" key)
(setq only-key (replace-regexp-in-string "[CMS]-" "" key t))
(if (string-match "S-" key)
(setq shifted-key (replace-match "" t nil key))
(setq shifted-key (concat "S-" key))))
(t
(setq only-key (replace-regexp-in-string "^.*\\(.\\)$" "\\1" key t)
shifted-key (assoc only-key ergoemacs-shifted-assoc))
(when shifted-key
(setq shifted-key (cdr shifted-key)))))
(when (and (string-match "\\([A-Z]\\)$" key)
(not (string-match
"\\<\\(SPC\\|DEL\\|ESC\\|RET\\|TAB\\)\\>" key)))
(setq key
(replace-match
(concat "S-" (downcase (match-string 1 key))) t t key)))
(when shifted-key
(setq unshifted-key only-key)
(unless (string-match
"\\(^<.+>$\\|\\<SPC\\>\\|\\<DEL\\>\\|\\<ESC\\>\\|\\<RET\\>\\|\\<TAB\\>\\)"
shifted-key)
(when (string-match "[A-Z]" shifted-key)
(setq shifted-key (concat "S-" (downcase shifted-key))))
(when (string-match "[A-Z]" unshifted-key)
(setq unshifted-key (concat "S-" (downcase unshifted-key))))))
(when (string-match "S-" key)
(setq shift-translated (replace-regexp-in-string "S-" "" key t)))
(if shift-translated
(progn
(setq ret (plist-put ret ':shift-translated
(ergoemacs-translate-shifted shift-translated)))
(setq ret (plist-put ret ':shift-translated-key (read-kbd-macro
(ergoemacs-translate-shifted shift-translated) t)))
(setq ret (plist-put ret ':shift-translated-pretty
(ergoemacs-pretty-key shift-translated))))
(setq ret (plist-put ret ':shift-translated nil))
(setq ret (plist-put ret ':shift-translated-key nil))
(setq ret (plist-put ret ':shift-translated-pretty nil)))
(when shifted-key
(setq ret (plist-put ret ':shifted (ergoemacs-translate-shifted
shifted-key)))
(setq ret (plist-put ret ':shifted-key (read-kbd-macro
(ergoemacs-translate-shifted shifted-key) t)))
(setq ret (plist-put ret ':shifted-pretty (ergoemacs-pretty-key
shifted-key))))
(when unshifted-key
(setq ret (plist-put ret ':unshifted (ergoemacs-translate-shifted
unshifted-key)))
(setq ret (plist-put ret ':unshifted-key (read-kbd-macro
(ergoemacs-translate-shifted unshifted-key) t)))
(setq ret (plist-put ret ':unshifted-pretty (ergoemacs-pretty-key
unshifted-key))))
(setq ret (plist-put ret ':ctl (ergoemacs-translate-shifted
(concat "C-" unshifted-key))))
(setq ret (plist-put ret ':ctl-key (read-kbd-macro (plist-get ret
':ctl) t)))
(setq ret (plist-put ret ':ctl-pretty (ergoemacs-pretty-key
(plist-get ret ':ctl))))
(setq ret (plist-put ret ':raw (ergoemacs-translate-shifted
(replace-regexp-in-string
"\\<[CSMS]-" "" key))))
(setq ret (plist-put ret ':raw-key (read-kbd-macro (plist-get ret
':raw) t)))
(setq ret (plist-put ret ':raw-pretty (ergoemacs-pretty-key
(plist-get ret ':raw))))
(if (assoc (plist-get ret ':raw) ergoemacs-shifted-assoc)
(progn
(setq ret (plist-put ret ':raw-shift
(ergoemacs-translate-shifted
(replace-regexp-in-string
"\\<[CSM]-" ""
(cdr (assoc (plist-get ret ':raw)
ergoemacs-shifted-assoc))))))
(setq ret (plist-put ret ':raw-shift-key
(read-kbd-macro (plist-get ret
':raw-shift) t)))
(setq ret (plist-put ret ':raw-shift-pretty
(ergoemacs-pretty-key
(plist-get ret ':raw-shift)))))
(setq ret (plist-put ret ':raw-shift nil))
(setq ret (plist-put ret ':raw-shift-key nil))
(setq ret (plist-put ret ':raw-shift-pretty nil)))
(setq ret (plist-put ret ':alt (ergoemacs-translate-shifted
(concat "M-" unshifted-key))))
(setq ret (plist-put ret ':alt-key (read-kbd-macro (plist-get ret
':alt) t)))
(setq ret (plist-put ret ':alt-pretty (ergoemacs-pretty-key
(plist-get ret ':alt))))
(when unshifted-key
(setq ret (plist-put ret ':alt-ctl (ergoemacs-translate-shifted
(concat "M-C-" unshifted-key))))
(setq ret (plist-put ret ':alt-ctl-key (read-kbd-macro (plist-get
ret ':alt-ctl) t)))
(setq ret (plist-put ret ':alt-ctl-pretty (ergoemacs-pretty-key
(plist-get ret ':alt-ctl)))))
(when shifted-key
(setq ret (plist-put ret ':ctl-shift (ergoemacs-translate-shifted
(concat "C-" shifted-key))))
(setq ret (plist-put ret ':ctl-shift-key (read-kbd-macro (plist-get
ret ':ctl-shift) t)))
(setq ret (plist-put ret ':ctl-shift-pretty (ergoemacs-pretty-key
(plist-get ret ':ctl-shift))))
(setq ret (plist-put ret ':alt-shift (ergoemacs-translate-shifted
(concat "M-" shifted-key))))
(setq ret (plist-put ret ':alt-shift-key (read-kbd-macro (plist-get
ret ':alt-shift) t)))
(setq ret (plist-put ret ':alt-shift-pretty (ergoemacs-pretty-key
(plist-get ret ':alt-shift))))
(setq ret (plist-put ret ':alt-ctl-shift
(ergoemacs-translate-shifted
(concat "M-C-"
shifted-key))))
(setq ret (plist-put ret ':alt-ctl-shift-key (read-kbd-macro
(plist-get ret ':alt-ctl-shift) t)))
(setq ret (plist-put ret ':alt-ctl-shift-pretty
(ergoemacs-pretty-key (plist-get ret ':alt-ctl-shift)))))
(maphash
(lambda(key plist)
(setq ret (ergoemacs-translation-install plist orig-key ret)))
ergoemacs-translations)
(puthash orig-key ret ergoemacs-translate-hash)
(puthash key ret ergoemacs-translate-hash)
ret)))
In GNU Emacs 24.3.1 (i386-mingw-nt6.1.7601)
of 2013-03-17 on MARVIN
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --with-gcc (4.7) --cflags
-ID:/devel/emacs/libs/libXpm-3.5.8/include
-ID:/devel/emacs/libs/libXpm-3.5.8/src
-ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
-ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
-ID:/devel/emacs/libs/giflib-4.1.4-1/include
-ID:/devel/emacs/libs/jpeg-6b-4/include
-ID:/devel/emacs/libs/tiff-3.8.2-1/include
-ID:/devel/emacs/libs/gnutls-3.0.9/include
-ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include
-ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2'
Important settings:
value of $EMACSDATA:
C:\Users\fidlema3\EmacsPortable.App\App\eps\..\emacs-24.3\etc
value of $EMACSDOC:
C:\Users\fidlema3\EmacsPortable.App\App\eps\..\emacs-24.3\etc
value of $EMACSLOADPATH:
C:\Users\fidlema3\EmacsPortable.App\App\eps\..\site-lisp;C:\Users\fidlema3\EmacsPortable.App\App\eps\..\emacs-24.3\lisp
value of $LANG: en
locale-coding-system: cp1252
default enable-multibyte-characters: t
Major mode: Emacs-Lisp
Minor modes in effect:
eldoc-mode: t
rainbow-mode: t
show-paren-mode: t
golden-ratio-mode: t
keyfreq-autosave-mode: t
keyfreq-mode: t
Info-breadcrumbs-in-mode-line-mode: t
tabbar-mwheel-mode: t
tabbar-mode: t
savehist-mode: t
global-linum-mode: t
linum-mode: t
global-subword-mode: t
subword-mode: t
yas-global-mode: t
yas-minor-mode: t
ido-ubiquitous-mode: t
global-auto-complete-mode: t
auto-complete-mode: t
auto-indent-global-mode: t
auto-indent-mode: t
smartparens-global-mode: t
smartparens-mode: t
helm-mode: t
helm-match-plugin-mode: t
helm-occur-match-plugin-mode: t
delete-selection-mode: t
ergoemacs-mode: t
global-undo-tree-mode: t
undo-tree-mode: t
ido-everywhere: t
shell-dirtrack-mode: t
flyspell-mode: t
recentf-mode: t
tooltip-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
column-number-mode: t
line-number-mode: t
auto-fill-function: do-auto-fill
transient-mark-mode: t
Recent input:
<down-mouse-1> <drag-mouse-1> <down-mouse-1> <mouse-1>
M-3 <apps> g e r r g o e m a c s - t h e m e - <return>
<apps> y e r g o e m a c s - t r a n <return> <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <menu-bar> <emacs-lisp> <byte-compile>
<help-echo> <down-mouse-1> <mouse-1> <help-echo> <help-echo>
<down-mouse-1> <mouse-2> <wheel-down> <wheel-down>
<wheel-down> <down-mouse-1> <mouse-1> M-u M-j o r i
M-e M-e M-e M-e M-e M-e M-e M-e M-h o r i g - k e y
M-h M-h M-j M-j M-j M-e M-e M-e M-e M-e M-e M-e M-e
M-e M-e M-i M-i M-i M-i M-u M-. C-q ) M-e M-n M-n M-n
M-n M-n M-n M-n M-n M-n M-n M-n M-n M-n M-n C-w C-g
C-z M-u M-u M-u M-u M-u M-u M-u M-u M-u M-m M-y M-y
M-i M-8 M-8 <apps> e e a n d SPC <apps> e e s t r i
n g p SPC k e y M-i SPC M-l M-l M-l M-n M-8 <apps>
e e o r SPC M-. M-n M-n SPC <apps> e e k e y - d e
s c r i p t i o n SPC k e y M-e M-e M-e M-e M-e M-e
M-e M-e M-e M-e M-8 M-x <backspace> <apps> r <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <menu-bar> <emacs-lisp> <byte-compile>
<down-mouse-1> <mouse-1> <apps> w M-r M-3 <help-echo>
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
<help-echo> <menu-bar> <emacs-lisp> <byte-compile>
<help-echo> <down-mouse-1> <mouse-2> <help-echo> <down-mouse-1>
<mouse-1> <down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1>
<lwindow> <down-mouse-1> <mouse-1> M-SPC M-. M-c <help-echo>
<down-mouse-1> <mouse-1> <help-echo> <help-echo> <help-echo>
<menu-bar> <help-menu> <send-bug-report>
Recent messages:
Mark set
Mark saved where search started [2 times]
Quit
Type 8 to expand again, - to contract, 0 to reset [3 times]
Saving file
e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el...
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el
Compiling
e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el...done
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.elc
Compiling
e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el...done
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.elc
Load-path shadows:
c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/ess-20130628.1043/.dir-locals
hides
c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/highlight-symbol-20130628.1552/.dir-locals
c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/ess-20130628.1043/.dir-locals
hides
c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/js2-mode-20131118.1516/.dir-locals
e:/EmacsPortable.App/Data/start/shared/init hides
c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/init
c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/custom hides
c:/Users/fidlema3/EmacsPortable.App/App/eps/../emacs-24.3/lisp/custom
c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/ess-20130628.1043/.dir-locals
hides
c:/Users/fidlema3/EmacsPortable.App/App/emacs-24.3/lisp/gnus/.dir-locals
c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/cl-lib-0.3/cl-lib
hides
c:/Users/fidlema3/EmacsPortable.App/App/emacs-24.3/lisp/emacs-lisp/cl-lib
Features:
(shadow sort mail-extr emacsbug message rfc822 mml mml-sec mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mail-utils expand-region
text-mode-expansions the-org-mode-expansions html-mode-expansions
er-basic-expansions expand-region-custom expand-region-core misearch
multi-isearch ergoemacs-macros image-file vc-git helm-misc
browse-kill-ring ruler-mode mule-util diminish eldoc rainbow-mode melpa
o-blog o-blog-bootstrap o-blog-i18n o-blog-grid o-blog-source
o-blog-alert time-stamp html2text sgml-mode htmlize maxframe
w32-fullscreen epshell paren golden-ratio keyfreq solarized-light-theme
solarized info+ tabbar-ruler color tabbar savehist linum-off linum
subword extend-dnd dired+ iimage ob-ditaa ob-clojure ob-haskell ob-js
ob-python ob-ruby ob-perl ob-plantuml ob-R ob-sh org-clock org-exp
ob-exp org-exp-blocks org-agenda textmate-to-yas texmate-to-yas
textmate-import texmate-import yasnippet ido-ubiquitous pos-tip
auto-complete-config auto-complete popup auto-indent-mode
smartparens-config smartparens dash helm-mode helm-files image-dired
dired-x dired-aux thingatpt helm-buffers helm-elscreen helm-tags
helm-bookmark helm-adaptative helm-info helm-net browse-url xml url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap helm-plugin helm-locate helm-help
helm-match-plugin helm-grep helm-regexp grep helm-external helm-utils
dired compile helm printing ps-print ps-def lpr ergoemacs-menus delsel
ergoemacs-mode two-column ergoemacs-advices cus-edit cus-start cus-load
ergoemacs-extras ergoemacs-shortcuts ergoemacs-translate descr-text
help-mode ergoemacs-functions ergoemacs-modal ergoemacs-unbind edmacro
kmacro ergoemacs-themes ergoemacs-theme-engine eieio-base
ergoemacs-layouts undo-tree diff ess-smart-underscore ess ess-inf
ess-mode ess-noweb-mode ess-utils ess-custom executable ess-compat
ess-R-object-tooltip ac-helm-autoloads ace-jump-mode-autoloads
auctex-autoloads tex-site auto-compile-autoloads auto-complete-autoloads
auto-indent-mode-autoloads autopair-autoloads bm-autoloads
browse-kill-ring-autoloads diminish-autoloads dired+-autoloads
ergoemacs-mode-autoloads ess-smart-underscore-autoloads evil-autoloads
evil-numbers-autoloads expand-region-autoloads extend-dnd-autoloads
flx-ido-autoloads flx-autoloads fold-dwim-autoloads
golden-ratio-autoloads goto-chg-autoloads helm-autoloads help+-autoloads
highlight-symbol-autoloads htmlize-autoloads icicles-autoloads
ido-ubiquitous-autoloads ido-vertical-mode-autoloads info+-autoloads
js2-mode-autoloads finder-inf keyfreq-autoloads lacarte-autoloads
linum-off-autoloads melpa-autoloads monokai-theme-autoloads
multi-term-autoloads multiple-cursors-autoloads nsis-mode-autoloads
ntcmd-autoloads org-cua-dwim-autoloads org-outlook-autoloads org-outlook
org-protocol org-readme-autoloads lib-requires-autoloads
header2-autoloads http-post-simple-autoloads org-table-comment-autoloads
packed-autoloads magit-autoloads git-rebase-mode-autoloads
git-commit-mode-autoloads paredit-autoloads phi-search-autoloads
popup-autoloads pos-tip-autoloads powerline-autoloads powerline
powerline-separators powerline-themes projectile-autoloads
rainbow-mode-autoloads s-autoloads slime-autoloads smartparens-autoloads
dash-autoloads smex-autoloads solarized-theme-autoloads
sr-speedbar-autoloads ssh-autoloads tabbar-ruler-autoloads info
tabbar-autoloads textmate-to-yas-autoloads undo-tree-autoloads
visual-regexp-autoloads cl-lib-autoloads yaoddmuse-autoloads
yasnippet-autoloads zenburn-theme-autoloads uniquify ffap url-parse
url-vars saveplace package org warnings ob-tangle ob-ref ob-lob ob-table
org-footnote org-src ob-comint ob-keys org-pcomplete org-list org-faces
org-entities noutline outline easy-mmode org-version ob-emacs-lisp ob
org-compat org-macs ob-eval org-loaddefs find-func cal-menu calendar
cal-loaddefs ido tramp tramp-compat auth-source eieio byte-opt bytecomp
byte-compile cconv gnus-util mm-util mail-prsvr password-cache
tramp-loaddefs shell pcomplete comint ansi-color ring format-spec
flyspell rw-hunspell rw-ispell ispell rw-language-and-country-codes
server recentf tree-widget wid-edit easymenu advice help-fns
advice-preload cl-macs gv cl cl-lib time-date tooltip ediff-hook
vc-hooks lisp-float-type mwheel dos-w32 ls-lisp w32-common-fns
disp-table w32-win w32-vars tool-bar dnd fontset image regexp-opt fringe
tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face macroexp files text-properties overlay sha1 md5 base64 format
env code-pages mule custom widget hashtable-print-readable backquote
make-network-process w32 multi-tty emacs)
[-- Attachment #2: Type: text/html, Size: 21524 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#18014: 24.3; Unused Lexical argument warning, when argument is used in a function...
2014-07-14 12:25 bug#18014: 24.3; Unused Lexical argument warning, when argument is used in a function Matthew Fidler
@ 2014-07-14 12:28 ` Matthew Fidler
2014-07-14 14:47 ` Eli Zaretskii
1 sibling, 0 replies; 12+ messages in thread
From: Matthew Fidler @ 2014-07-14 12:28 UTC (permalink / raw)
To: 18014
[-- Attachment #1: Type: text/plain, Size: 18947 bytes --]
As a follow-up, when changing key to _key, I get the following warning
Compiling file
e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el at Mon
Jul 14 07:27:43 2014
ergoemacs-translate.el:695:1:Warning: argument `_key' not left unused
It can't be both...
On Mon, Jul 14, 2014 at 7:25 AM, Matthew Fidler <matthew.fidler@gmail.com>
wrote:
> I'm getting a warning for ergoemacs-translate:
>
> Compiling file
> e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el at Mon
> Jul 14 07:17:14 2014
> ergoemacs-translate.el:695:1:Warning: Unused lexical argument `key'
>
> I do use the argument key to calculate the translation, but the compiler
> claims I am not. I'm not sure if it is a bug in the warning or a bug in
> my code. For now, I can change key to _key to ignore the warning, but I
> do think that this is an invalid warning.
>
> Here is the offending function:
>
> (defun ergoemacs-translate (key)
> "Translates KEY and returns a plist of the translations.
>
> :shift-translated
> S-a -> a
> M-S-a -> M-a
> C-S-a -> C-a
> Anything without shift is nil.
>
> All other translations are defined in `ergoemacs-translations'.
>
> There are also :XXX-key and :XXX-pretty for actual key-strokes
> and `ergoemacs-pretty-key' descriptions.
>
> "
> (let* ((ret (gethash key ergoemacs-translate-hash))
> (orig-key (or (and (stringp key) key) (key-description key)))
> case-fold-search
> only-key
> shift-translated
> (ergoemacs-use-ergoemacs-key-descriptions t)
> shifted-key
> unshifted-key)
> (if ret ret
> (cond
> ((string-match "\\(^<.+>$\\|SPC\\|DEL\\|ESC\\|RET\\|TAB\\)" key)
> (setq only-key (replace-regexp-in-string "[CMS]-" "" key t))
> (if (string-match "S-" key)
> (setq shifted-key (replace-match "" t nil key))
> (setq shifted-key (concat "S-" key))))
> (t
> (setq only-key (replace-regexp-in-string "^.*\\(.\\)$" "\\1" key t)
> shifted-key (assoc only-key ergoemacs-shifted-assoc))
> (when shifted-key
> (setq shifted-key (cdr shifted-key)))))
> (when (and (string-match "\\([A-Z]\\)$" key)
> (not (string-match
> "\\<\\(SPC\\|DEL\\|ESC\\|RET\\|TAB\\)\\>" key)))
> (setq key
> (replace-match
> (concat "S-" (downcase (match-string 1 key))) t t key)))
> (when shifted-key
> (setq unshifted-key only-key)
> (unless (string-match
> "\\(^<.+>$\\|\\<SPC\\>\\|\\<DEL\\>\\|\\<ESC\\>\\|\\<RET\\>\\|\\<TAB\\>\\)"
> shifted-key)
> (when (string-match "[A-Z]" shifted-key)
> (setq shifted-key (concat "S-" (downcase shifted-key))))
> (when (string-match "[A-Z]" unshifted-key)
> (setq unshifted-key (concat "S-" (downcase unshifted-key))))))
> (when (string-match "S-" key)
> (setq shift-translated (replace-regexp-in-string "S-" "" key t)))
>
> (if shift-translated
> (progn
> (setq ret (plist-put ret ':shift-translated
> (ergoemacs-translate-shifted shift-translated)))
> (setq ret (plist-put ret ':shift-translated-key
> (read-kbd-macro (ergoemacs-translate-shifted shift-translated) t)))
> (setq ret (plist-put ret ':shift-translated-pretty
> (ergoemacs-pretty-key shift-translated))))
> (setq ret (plist-put ret ':shift-translated nil))
> (setq ret (plist-put ret ':shift-translated-key nil))
> (setq ret (plist-put ret ':shift-translated-pretty nil)))
>
> (when shifted-key
> (setq ret (plist-put ret ':shifted (ergoemacs-translate-shifted
> shifted-key)))
> (setq ret (plist-put ret ':shifted-key (read-kbd-macro
> (ergoemacs-translate-shifted shifted-key) t)))
> (setq ret (plist-put ret ':shifted-pretty (ergoemacs-pretty-key
> shifted-key))))
> (when unshifted-key
> (setq ret (plist-put ret ':unshifted (ergoemacs-translate-shifted
> unshifted-key)))
> (setq ret (plist-put ret ':unshifted-key (read-kbd-macro
> (ergoemacs-translate-shifted unshifted-key) t)))
> (setq ret (plist-put ret ':unshifted-pretty (ergoemacs-pretty-key
> unshifted-key))))
> (setq ret (plist-put ret ':ctl (ergoemacs-translate-shifted
> (concat "C-" unshifted-key))))
> (setq ret (plist-put ret ':ctl-key (read-kbd-macro (plist-get ret
> ':ctl) t)))
> (setq ret (plist-put ret ':ctl-pretty (ergoemacs-pretty-key
> (plist-get ret ':ctl))))
>
> (setq ret (plist-put ret ':raw (ergoemacs-translate-shifted
> (replace-regexp-in-string
> "\\<[CSMS]-" "" key))))
> (setq ret (plist-put ret ':raw-key (read-kbd-macro (plist-get ret
> ':raw) t)))
> (setq ret (plist-put ret ':raw-pretty (ergoemacs-pretty-key
> (plist-get ret ':raw))))
> (if (assoc (plist-get ret ':raw) ergoemacs-shifted-assoc)
> (progn
> (setq ret (plist-put ret ':raw-shift
> (ergoemacs-translate-shifted
> (replace-regexp-in-string
> "\\<[CSM]-" ""
> (cdr (assoc (plist-get ret ':raw)
> ergoemacs-shifted-assoc))))))
> (setq ret (plist-put ret ':raw-shift-key
> (read-kbd-macro (plist-get ret
> ':raw-shift) t)))
> (setq ret (plist-put ret ':raw-shift-pretty
> (ergoemacs-pretty-key
> (plist-get ret ':raw-shift)))))
> (setq ret (plist-put ret ':raw-shift nil))
> (setq ret (plist-put ret ':raw-shift-key nil))
> (setq ret (plist-put ret ':raw-shift-pretty nil)))
>
> (setq ret (plist-put ret ':alt (ergoemacs-translate-shifted
> (concat "M-" unshifted-key))))
> (setq ret (plist-put ret ':alt-key (read-kbd-macro (plist-get ret
> ':alt) t)))
> (setq ret (plist-put ret ':alt-pretty (ergoemacs-pretty-key
> (plist-get ret ':alt))))
>
> (when unshifted-key
> (setq ret (plist-put ret ':alt-ctl (ergoemacs-translate-shifted
> (concat "M-C-"
> unshifted-key))))
> (setq ret (plist-put ret ':alt-ctl-key (read-kbd-macro (plist-get
> ret ':alt-ctl) t)))
> (setq ret (plist-put ret ':alt-ctl-pretty (ergoemacs-pretty-key
> (plist-get ret ':alt-ctl)))))
>
> (when shifted-key
> (setq ret (plist-put ret ':ctl-shift (ergoemacs-translate-shifted
> (concat "C-" shifted-key))))
> (setq ret (plist-put ret ':ctl-shift-key (read-kbd-macro
> (plist-get ret ':ctl-shift) t)))
> (setq ret (plist-put ret ':ctl-shift-pretty (ergoemacs-pretty-key
> (plist-get ret ':ctl-shift))))
> (setq ret (plist-put ret ':alt-shift (ergoemacs-translate-shifted
> (concat "M-" shifted-key))))
> (setq ret (plist-put ret ':alt-shift-key (read-kbd-macro
> (plist-get ret ':alt-shift) t)))
> (setq ret (plist-put ret ':alt-shift-pretty (ergoemacs-pretty-key
> (plist-get ret ':alt-shift))))
> (setq ret (plist-put ret ':alt-ctl-shift
> (ergoemacs-translate-shifted
> (concat "M-C-"
> shifted-key))))
> (setq ret (plist-put ret ':alt-ctl-shift-key (read-kbd-macro
> (plist-get ret ':alt-ctl-shift) t)))
> (setq ret (plist-put ret ':alt-ctl-shift-pretty
> (ergoemacs-pretty-key (plist-get ret ':alt-ctl-shift)))))
> (maphash
> (lambda(key plist)
> (setq ret (ergoemacs-translation-install plist orig-key ret)))
> ergoemacs-translations)
> (puthash orig-key ret ergoemacs-translate-hash)
> (puthash key ret ergoemacs-translate-hash)
> ret)))
>
>
> In GNU Emacs 24.3.1 (i386-mingw-nt6.1.7601)
> of 2013-03-17 on MARVIN
> Windowing system distributor `Microsoft Corp.', version 6.1.7601
> Configured using:
> `configure --with-gcc (4.7) --cflags
> -ID:/devel/emacs/libs/libXpm-3.5.8/include
> -ID:/devel/emacs/libs/libXpm-3.5.8/src
> -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
> -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
> -ID:/devel/emacs/libs/giflib-4.1.4-1/include
> -ID:/devel/emacs/libs/jpeg-6b-4/include
> -ID:/devel/emacs/libs/tiff-3.8.2-1/include
> -ID:/devel/emacs/libs/gnutls-3.0.9/include
> -ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include
> -ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2'
>
> Important settings:
> value of $EMACSDATA:
> C:\Users\fidlema3\EmacsPortable.App\App\eps\..\emacs-24.3\etc
> value of $EMACSDOC:
> C:\Users\fidlema3\EmacsPortable.App\App\eps\..\emacs-24.3\etc
> value of $EMACSLOADPATH:
> C:\Users\fidlema3\EmacsPortable.App\App\eps\..\site-lisp;C:\Users\fidlema3\EmacsPortable.App\App\eps\..\emacs-24.3\lisp
> value of $LANG: en
> locale-coding-system: cp1252
> default enable-multibyte-characters: t
>
> Major mode: Emacs-Lisp
>
> Minor modes in effect:
> eldoc-mode: t
> rainbow-mode: t
> show-paren-mode: t
> golden-ratio-mode: t
> keyfreq-autosave-mode: t
> keyfreq-mode: t
> Info-breadcrumbs-in-mode-line-mode: t
> tabbar-mwheel-mode: t
> tabbar-mode: t
> savehist-mode: t
> global-linum-mode: t
> linum-mode: t
> global-subword-mode: t
> subword-mode: t
> yas-global-mode: t
> yas-minor-mode: t
> ido-ubiquitous-mode: t
> global-auto-complete-mode: t
> auto-complete-mode: t
> auto-indent-global-mode: t
> auto-indent-mode: t
> smartparens-global-mode: t
> smartparens-mode: t
> helm-mode: t
> helm-match-plugin-mode: t
> helm-occur-match-plugin-mode: t
> delete-selection-mode: t
> ergoemacs-mode: t
> global-undo-tree-mode: t
> undo-tree-mode: t
> ido-everywhere: t
> shell-dirtrack-mode: t
> flyspell-mode: t
> recentf-mode: t
> tooltip-mode: t
> mouse-wheel-mode: t
> file-name-shadow-mode: t
> global-font-lock-mode: t
> font-lock-mode: t
> blink-cursor-mode: t
> auto-composition-mode: t
> auto-encryption-mode: t
> auto-compression-mode: t
> column-number-mode: t
> line-number-mode: t
> auto-fill-function: do-auto-fill
> transient-mark-mode: t
>
> Recent input:
> <down-mouse-1> <drag-mouse-1> <down-mouse-1> <mouse-1>
> M-3 <apps> g e r r g o e m a c s - t h e m e - <return>
> <apps> y e r g o e m a c s - t r a n <return> <help-echo>
> <help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
> <help-echo> <menu-bar> <emacs-lisp> <byte-compile>
> <help-echo> <down-mouse-1> <mouse-1> <help-echo> <help-echo>
> <down-mouse-1> <mouse-2> <wheel-down> <wheel-down>
> <wheel-down> <down-mouse-1> <mouse-1> M-u M-j o r i
> M-e M-e M-e M-e M-e M-e M-e M-e M-h o r i g - k e y
> M-h M-h M-j M-j M-j M-e M-e M-e M-e M-e M-e M-e M-e
> M-e M-e M-i M-i M-i M-i M-u M-. C-q ) M-e M-n M-n M-n
> M-n M-n M-n M-n M-n M-n M-n M-n M-n M-n M-n C-w C-g
> C-z M-u M-u M-u M-u M-u M-u M-u M-u M-u M-m M-y M-y
> M-i M-8 M-8 <apps> e e a n d SPC <apps> e e s t r i
> n g p SPC k e y M-i SPC M-l M-l M-l M-n M-8 <apps>
> e e o r SPC M-. M-n M-n SPC <apps> e e k e y - d e
> s c r i p t i o n SPC k e y M-e M-e M-e M-e M-e M-e
> M-e M-e M-e M-e M-8 M-x <backspace> <apps> r <help-echo>
> <help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
> <help-echo> <menu-bar> <emacs-lisp> <byte-compile>
> <down-mouse-1> <mouse-1> <apps> w M-r M-3 <help-echo>
> <help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
> <help-echo> <menu-bar> <emacs-lisp> <byte-compile>
> <help-echo> <down-mouse-1> <mouse-2> <help-echo> <down-mouse-1>
> <mouse-1> <down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1>
> <lwindow> <down-mouse-1> <mouse-1> M-SPC M-. M-c <help-echo>
> <down-mouse-1> <mouse-1> <help-echo> <help-echo> <help-echo>
> <menu-bar> <help-menu> <send-bug-report>
>
> Recent messages:
> Mark set
> Mark saved where search started [2 times]
> Quit
> Type 8 to expand again, - to contract, 0 to reset [3 times]
> Saving file
> e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el...
> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el
> Compiling
> e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el...done
> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.elc
> Compiling
> e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el...done
> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.elc
>
> Load-path shadows:
> c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/ess-20130628.1043/.dir-locals
> hides
> c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/highlight-symbol-20130628.1552/.dir-locals
> c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/ess-20130628.1043/.dir-locals
> hides
> c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/js2-mode-20131118.1516/.dir-locals
> e:/EmacsPortable.App/Data/start/shared/init hides
> c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/init
> c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/custom hides
> c:/Users/fidlema3/EmacsPortable.App/App/eps/../emacs-24.3/lisp/custom
> c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/ess-20130628.1043/.dir-locals
> hides
> c:/Users/fidlema3/EmacsPortable.App/App/emacs-24.3/lisp/gnus/.dir-locals
> c:/Users/fidlema3/EmacsPortable.App/Data/start/EmacsMate/elpa-24.3/cl-lib-0.3/cl-lib
> hides
> c:/Users/fidlema3/EmacsPortable.App/App/emacs-24.3/lisp/emacs-lisp/cl-lib
>
> Features:
> (shadow sort mail-extr emacsbug message rfc822 mml mml-sec mm-decode
> mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
> sendmail rfc2047 rfc2045 ietf-drums mail-utils expand-region
> text-mode-expansions the-org-mode-expansions html-mode-expansions
> er-basic-expansions expand-region-custom expand-region-core misearch
> multi-isearch ergoemacs-macros image-file vc-git helm-misc
> browse-kill-ring ruler-mode mule-util diminish eldoc rainbow-mode melpa
> o-blog o-blog-bootstrap o-blog-i18n o-blog-grid o-blog-source
> o-blog-alert time-stamp html2text sgml-mode htmlize maxframe
> w32-fullscreen epshell paren golden-ratio keyfreq solarized-light-theme
> solarized info+ tabbar-ruler color tabbar savehist linum-off linum
> subword extend-dnd dired+ iimage ob-ditaa ob-clojure ob-haskell ob-js
> ob-python ob-ruby ob-perl ob-plantuml ob-R ob-sh org-clock org-exp
> ob-exp org-exp-blocks org-agenda textmate-to-yas texmate-to-yas
> textmate-import texmate-import yasnippet ido-ubiquitous pos-tip
> auto-complete-config auto-complete popup auto-indent-mode
> smartparens-config smartparens dash helm-mode helm-files image-dired
> dired-x dired-aux thingatpt helm-buffers helm-elscreen helm-tags
> helm-bookmark helm-adaptative helm-info helm-net browse-url xml url
> url-proxy url-privacy url-expand url-methods url-history url-cookie
> url-domsuf url-util mailcap helm-plugin helm-locate helm-help
> helm-match-plugin helm-grep helm-regexp grep helm-external helm-utils
> dired compile helm printing ps-print ps-def lpr ergoemacs-menus delsel
> ergoemacs-mode two-column ergoemacs-advices cus-edit cus-start cus-load
> ergoemacs-extras ergoemacs-shortcuts ergoemacs-translate descr-text
> help-mode ergoemacs-functions ergoemacs-modal ergoemacs-unbind edmacro
> kmacro ergoemacs-themes ergoemacs-theme-engine eieio-base
> ergoemacs-layouts undo-tree diff ess-smart-underscore ess ess-inf
> ess-mode ess-noweb-mode ess-utils ess-custom executable ess-compat
> ess-R-object-tooltip ac-helm-autoloads ace-jump-mode-autoloads
> auctex-autoloads tex-site auto-compile-autoloads auto-complete-autoloads
> auto-indent-mode-autoloads autopair-autoloads bm-autoloads
> browse-kill-ring-autoloads diminish-autoloads dired+-autoloads
> ergoemacs-mode-autoloads ess-smart-underscore-autoloads evil-autoloads
> evil-numbers-autoloads expand-region-autoloads extend-dnd-autoloads
> flx-ido-autoloads flx-autoloads fold-dwim-autoloads
> golden-ratio-autoloads goto-chg-autoloads helm-autoloads help+-autoloads
> highlight-symbol-autoloads htmlize-autoloads icicles-autoloads
> ido-ubiquitous-autoloads ido-vertical-mode-autoloads info+-autoloads
> js2-mode-autoloads finder-inf keyfreq-autoloads lacarte-autoloads
> linum-off-autoloads melpa-autoloads monokai-theme-autoloads
> multi-term-autoloads multiple-cursors-autoloads nsis-mode-autoloads
> ntcmd-autoloads org-cua-dwim-autoloads org-outlook-autoloads org-outlook
> org-protocol org-readme-autoloads lib-requires-autoloads
> header2-autoloads http-post-simple-autoloads org-table-comment-autoloads
> packed-autoloads magit-autoloads git-rebase-mode-autoloads
> git-commit-mode-autoloads paredit-autoloads phi-search-autoloads
> popup-autoloads pos-tip-autoloads powerline-autoloads powerline
> powerline-separators powerline-themes projectile-autoloads
> rainbow-mode-autoloads s-autoloads slime-autoloads smartparens-autoloads
> dash-autoloads smex-autoloads solarized-theme-autoloads
> sr-speedbar-autoloads ssh-autoloads tabbar-ruler-autoloads info
> tabbar-autoloads textmate-to-yas-autoloads undo-tree-autoloads
> visual-regexp-autoloads cl-lib-autoloads yaoddmuse-autoloads
> yasnippet-autoloads zenburn-theme-autoloads uniquify ffap url-parse
> url-vars saveplace package org warnings ob-tangle ob-ref ob-lob ob-table
> org-footnote org-src ob-comint ob-keys org-pcomplete org-list org-faces
> org-entities noutline outline easy-mmode org-version ob-emacs-lisp ob
> org-compat org-macs ob-eval org-loaddefs find-func cal-menu calendar
> cal-loaddefs ido tramp tramp-compat auth-source eieio byte-opt bytecomp
> byte-compile cconv gnus-util mm-util mail-prsvr password-cache
> tramp-loaddefs shell pcomplete comint ansi-color ring format-spec
> flyspell rw-hunspell rw-ispell ispell rw-language-and-country-codes
> server recentf tree-widget wid-edit easymenu advice help-fns
> advice-preload cl-macs gv cl cl-lib time-date tooltip ediff-hook
> vc-hooks lisp-float-type mwheel dos-w32 ls-lisp w32-common-fns
> disp-table w32-win w32-vars tool-bar dnd fontset image regexp-opt fringe
> tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow
> timer select scroll-bar mouse jit-lock font-lock syntax facemenu
> font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan
> thai tai-viet lao korean japanese hebrew greek romanian slovak czech
> european ethiopic indian cyrillic chinese case-table epa-hook
> jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
> cus-face macroexp files text-properties overlay sha1 md5 base64 format
> env code-pages mule custom widget hashtable-print-readable backquote
> make-network-process w32 multi-tty emacs)
>
[-- Attachment #2: Type: text/html, Size: 22405 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#18014: 24.3; Unused Lexical argument warning, when argument is used in a function...
2014-07-14 12:25 bug#18014: 24.3; Unused Lexical argument warning, when argument is used in a function Matthew Fidler
2014-07-14 12:28 ` Matthew Fidler
@ 2014-07-14 14:47 ` Eli Zaretskii
[not found] ` <CAOmN8O5ROfi5W44fBJe=sUs28TR1CDVQ2hWZoU0D4BTOGmKESg@mail.gmail.com>
1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2014-07-14 14:47 UTC (permalink / raw)
To: Matthew Fidler; +Cc: 18014
> Date: Mon, 14 Jul 2014 07:25:56 -0500
> From: Matthew Fidler <matthew.fidler@gmail.com>
>
> I'm getting a warning for ergoemacs-translate:
>
> Compiling file
> e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el at Mon
> Jul 14 07:17:14 2014
> ergoemacs-translate.el:695:1:Warning: Unused lexical argument `key'
>
> I do use the argument key to calculate the translation, but the compiler
> claims I am not. I'm not sure if it is a bug in the warning or a bug in
> my code. For now, I can change key to _key to ignore the warning, but I
> do think that this is an invalid warning.
>
> Here is the offending function:
And which one is the offending line 695, please?
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#18014: Fwd: bug#18014: 24.3; Unused Lexical argument warning, when argument is used in a function...
[not found] ` <CAOmN8O5ROfi5W44fBJe=sUs28TR1CDVQ2hWZoU0D4BTOGmKESg@mail.gmail.com>
@ 2014-07-14 14:58 ` Matthew Fidler
2014-07-14 15:30 ` Eli Zaretskii
1 sibling, 0 replies; 12+ messages in thread
From: Matthew Fidler @ 2014-07-14 14:58 UTC (permalink / raw)
To: 18014
[-- Attachment #1: Type: text/plain, Size: 1232 bytes --]
---------- Forwarded message ----------
From: Matthew Fidler <matthew.fidler@gmail.com>
Date: Mon, Jul 14, 2014 at 9:57 AM
Subject: Re: bug#18014: 24.3; Unused Lexical argument warning, when
argument is used in a function...
To: Eli Zaretskii <eliz@gnu.org>
Its the beginning of the function in the bug report.
https://github.com/ergoemacs/ergoemacs-mode/blob/7a30c03b59eab2b720c16f6cd8099c499fec1cc2/ergoemacs-translate.el#L695
On Mon, Jul 14, 2014 at 9:47 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Mon, 14 Jul 2014 07:25:56 -0500
> > From: Matthew Fidler <matthew.fidler@gmail.com>
> >
> > I'm getting a warning for ergoemacs-translate:
> >
> > Compiling file
> > e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.el at
> Mon
> > Jul 14 07:17:14 2014
> > ergoemacs-translate.el:695:1:Warning: Unused lexical argument `key'
> >
> > I do use the argument key to calculate the translation, but the compiler
> > claims I am not. I'm not sure if it is a bug in the warning or a bug in
> > my code. For now, I can change key to _key to ignore the warning, but I
> > do think that this is an invalid warning.
> >
> > Here is the offending function:
>
> And which one is the offending line 695, please?
>
[-- Attachment #2: Type: text/html, Size: 2252 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#18014: 24.3; Unused Lexical argument warning, when argument is used in a function...
[not found] ` <CAOmN8O5ROfi5W44fBJe=sUs28TR1CDVQ2hWZoU0D4BTOGmKESg@mail.gmail.com>
2014-07-14 14:58 ` bug#18014: Fwd: " Matthew Fidler
@ 2014-07-14 15:30 ` Eli Zaretskii
2014-07-14 15:46 ` Matthew Fidler
1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2014-07-14 15:30 UTC (permalink / raw)
To: Matthew Fidler; +Cc: 18014
> Date: Mon, 14 Jul 2014 09:57:38 -0500
> From: Matthew Fidler <matthew.fidler@gmail.com>
>
> Its the beginning of the function in the bug report.
>
> https://github.com/ergoemacs/ergoemacs-mode/blob/7a30c03b59eab2b720c16f6cd8099c499fec1cc2/ergoemacs-translate.el#L695
Then I cannot reproduce this, neither with Emacs 24.3 nor with the
latest pretest 24.3.92. I downloaded ergoemacs-translate.el and
ergoemacs-macros.el from that repository, and I get a clean compile.
Did you try this in a fresh Emacs, e.g. "emacs -batch -f batch-byte-compile"?
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#18014: 24.3; Unused Lexical argument warning, when argument is used in a function...
2014-07-14 15:30 ` Eli Zaretskii
@ 2014-07-14 15:46 ` Matthew Fidler
2014-07-14 15:47 ` Matthew Fidler
0 siblings, 1 reply; 12+ messages in thread
From: Matthew Fidler @ 2014-07-14 15:46 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 18014
[-- Attachment #1: Type: text/plain, Size: 2355 bytes --]
Yes. I can reproduce with a fresh emacs. My build script uses a fresh
emacs but calls it by :
~src/ergoemacs-mode $ make
emacs -Q --batch -L . --eval \
"(progn \
(setq byte-compile-error-on-warn t) \
(batch-byte-compile))" *.el
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-advices.elc
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-extras.elc
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-functions.elc
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-layouts.elc
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-macros.elc
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-menus.elc
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-modal.elc
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-mode.elc
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-shortcuts.elc
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-test.elc
Wrote
e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-theme-engine.elc
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-themes.elc
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-track.elc
In toplevel form:
ergoemacs-translate.el:695:1:Warning: Unused lexical argument `key'
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.elc
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-unbind.elc
~src/ergoemacs-mode $
It also errors on 24.3:
https://travis-ci.org/ergoemacs/ergoemacs-mode/jobs/29898482
And also errors on the 24.4 trunk (in ubuntu, I believe):
https://travis-ci.org/ergoemacs/ergoemacs-mode/jobs/29898483
On Mon, Jul 14, 2014 at 10:30 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Mon, 14 Jul 2014 09:57:38 -0500
> > From: Matthew Fidler <matthew.fidler@gmail.com>
> >
> > Its the beginning of the function in the bug report.
> >
> >
> https://github.com/ergoemacs/ergoemacs-mode/blob/7a30c03b59eab2b720c16f6cd8099c499fec1cc2/ergoemacs-translate.el#L695
>
> Then I cannot reproduce this, neither with Emacs 24.3 nor with the
> latest pretest 24.3.92. I downloaded ergoemacs-translate.el and
> ergoemacs-macros.el from that repository, and I get a clean compile.
>
> Did you try this in a fresh Emacs, e.g. "emacs -batch -f
> batch-byte-compile"?
>
[-- Attachment #2: Type: text/html, Size: 3447 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#18014: 24.3; Unused Lexical argument warning, when argument is used in a function...
2014-07-14 15:46 ` Matthew Fidler
@ 2014-07-14 15:47 ` Matthew Fidler
2014-07-14 16:01 ` Matthew Fidler
2014-07-14 16:17 ` Eli Zaretskii
0 siblings, 2 replies; 12+ messages in thread
From: Matthew Fidler @ 2014-07-14 15:47 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 18014
[-- Attachment #1: Type: text/plain, Size: 2616 bytes --]
Also 24.3 does not exit when the warning occurs (which is another bug,
actually)
On Mon, Jul 14, 2014 at 10:46 AM, Matthew Fidler <matthew.fidler@gmail.com>
wrote:
> Yes. I can reproduce with a fresh emacs. My build script uses a fresh
> emacs but calls it by :
>
> ~src/ergoemacs-mode $ make
> emacs -Q --batch -L . --eval \
> "(progn \
> (setq byte-compile-error-on-warn t) \
> (batch-byte-compile))" *.el
> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-advices.elc
> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-extras.elc
> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-functions.elc
> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-layouts.elc
> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-macros.elc
> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-menus.elc
> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-modal.elc
> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-mode.elc
> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-shortcuts.elc
> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-test.elc
> Wrote
> e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-theme-engine.elc
> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-themes.elc
> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-track.elc
> In toplevel form:
>
> ergoemacs-translate.el:695:1:Warning: Unused lexical argument `key'
> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.elc
> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-unbind.elc
> ~src/ergoemacs-mode $
>
> It also errors on 24.3:
>
> https://travis-ci.org/ergoemacs/ergoemacs-mode/jobs/29898482
>
>
> And also errors on the 24.4 trunk (in ubuntu, I believe):
>
> https://travis-ci.org/ergoemacs/ergoemacs-mode/jobs/29898483
>
>
>
>
> On Mon, Jul 14, 2014 at 10:30 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> > Date: Mon, 14 Jul 2014 09:57:38 -0500
>> > From: Matthew Fidler <matthew.fidler@gmail.com>
>> >
>> > Its the beginning of the function in the bug report.
>> >
>> >
>> https://github.com/ergoemacs/ergoemacs-mode/blob/7a30c03b59eab2b720c16f6cd8099c499fec1cc2/ergoemacs-translate.el#L695
>>
>> Then I cannot reproduce this, neither with Emacs 24.3 nor with the
>> latest pretest 24.3.92. I downloaded ergoemacs-translate.el and
>> ergoemacs-macros.el from that repository, and I get a clean compile.
>>
>> Did you try this in a fresh Emacs, e.g. "emacs -batch -f
>> batch-byte-compile"?
>>
>
>
[-- Attachment #2: Type: text/html, Size: 4029 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#18014: 24.3; Unused Lexical argument warning, when argument is used in a function...
2014-07-14 15:47 ` Matthew Fidler
@ 2014-07-14 16:01 ` Matthew Fidler
2014-07-14 16:18 ` Eli Zaretskii
2014-07-14 16:17 ` Eli Zaretskii
1 sibling, 1 reply; 12+ messages in thread
From: Matthew Fidler @ 2014-07-14 16:01 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 18014
[-- Attachment #1: Type: text/plain, Size: 2913 bytes --]
You probably downloaded the version with lexical binding disabled.
Sorry, I should have linked to the version with lexical binding enabled.
On Jul 14, 2014 10:47 AM, "Matthew Fidler" <matthew.fidler@gmail.com> wrote:
> Also 24.3 does not exit when the warning occurs (which is another bug,
> actually)
>
>
> On Mon, Jul 14, 2014 at 10:46 AM, Matthew Fidler <matthew.fidler@gmail.com
> > wrote:
>
>> Yes. I can reproduce with a fresh emacs. My build script uses a fresh
>> emacs but calls it by :
>>
>> ~src/ergoemacs-mode $ make
>> emacs -Q --batch -L . --eval \
>> "(progn \
>> (setq byte-compile-error-on-warn t) \
>> (batch-byte-compile))" *.el
>> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-advices.elc
>> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-extras.elc
>> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-functions.elc
>> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-layouts.elc
>> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-macros.elc
>> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-menus.elc
>> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-modal.elc
>> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-mode.elc
>> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-shortcuts.elc
>> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-test.elc
>> Wrote
>> e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-theme-engine.elc
>> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-themes.elc
>> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-track.elc
>> In toplevel form:
>>
>> ergoemacs-translate.el:695:1:Warning: Unused lexical argument `key'
>> Wrote
>> e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-translate.elc
>> Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/ergoemacs-unbind.elc
>> ~src/ergoemacs-mode $
>>
>> It also errors on 24.3:
>>
>> https://travis-ci.org/ergoemacs/ergoemacs-mode/jobs/29898482
>>
>>
>> And also errors on the 24.4 trunk (in ubuntu, I believe):
>>
>> https://travis-ci.org/ergoemacs/ergoemacs-mode/jobs/29898483
>>
>>
>>
>>
>> On Mon, Jul 14, 2014 at 10:30 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>>
>>> > Date: Mon, 14 Jul 2014 09:57:38 -0500
>>> > From: Matthew Fidler <matthew.fidler@gmail.com>
>>> >
>>> > Its the beginning of the function in the bug report.
>>> >
>>> >
>>> https://github.com/ergoemacs/ergoemacs-mode/blob/7a30c03b59eab2b720c16f6cd8099c499fec1cc2/ergoemacs-translate.el#L695
>>>
>>> Then I cannot reproduce this, neither with Emacs 24.3 nor with the
>>> latest pretest 24.3.92. I downloaded ergoemacs-translate.el and
>>> ergoemacs-macros.el from that repository, and I get a clean compile.
>>>
>>> Did you try this in a fresh Emacs, e.g. "emacs -batch -f
>>> batch-byte-compile"?
>>>
>>
>>
>
[-- Attachment #2: Type: text/html, Size: 4505 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#18014: 24.3; Unused Lexical argument warning, when argument is used in a function...
2014-07-14 15:47 ` Matthew Fidler
2014-07-14 16:01 ` Matthew Fidler
@ 2014-07-14 16:17 ` Eli Zaretskii
1 sibling, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2014-07-14 16:17 UTC (permalink / raw)
To: Matthew Fidler; +Cc: 18014
> Date: Mon, 14 Jul 2014 10:47:10 -0500
> From: Matthew Fidler <matthew.fidler@gmail.com>
> Cc: 18014@debbugs.gnu.org
>
> Also 24.3 does not exit when the warning occurs (which is another bug,
> actually)
That's not a bug, that's the intended behavior: warnings don't stop
compilation.
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#18014: 24.3; Unused Lexical argument warning, when argument is used in a function...
2014-07-14 16:01 ` Matthew Fidler
@ 2014-07-14 16:18 ` Eli Zaretskii
2014-07-14 19:46 ` Matthew Fidler
0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2014-07-14 16:18 UTC (permalink / raw)
To: Matthew Fidler; +Cc: 18014
> Date: Mon, 14 Jul 2014 11:01:12 -0500
> From: Matthew Fidler <matthew.fidler@gmail.com>
> Cc: 18014@debbugs.gnu.org
>
> You probably downloaded the version with lexical binding disabled.
>
> Sorry, I should have linked to the version with lexical binding enabled.
So how about posting a complete, self-contained recipe that could be
used to reproduce the problem?
TIA
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#18014: 24.3; Unused Lexical argument warning, when argument is used in a function...
2014-07-14 16:18 ` Eli Zaretskii
@ 2014-07-14 19:46 ` Matthew Fidler
2014-07-15 14:18 ` Eli Zaretskii
0 siblings, 1 reply; 12+ messages in thread
From: Matthew Fidler @ 2014-07-14 19:46 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 18014
[-- Attachment #1.1: Type: text/plain, Size: 1407 bytes --]
Easy enough. Put these in a directory, say ~/emacs-bug-1801 and run the
following command:
emacs -Q --batch -L . --eval \
"(progn \
(setq byte-compile-error-on-warn t) \
(batch-byte-compile))" *.el
On Emacs 24.3 the following warning will occur:
In toplevel form:
bug.el:10:1:Warning: Unused lexical argument `key' *<<--- Incorrect; key is
a used lexical argument*
Wrote e:/EmacsPortable.App/Data/src/ergoemacs-mode/bug.elc
In toplevel form:
bug2.el:10:1:Warning: argument `_key' not left unused
*<<--- Correct; _key is a used lexical argument*Wrote
e:/EmacsPortable.App/Data/src/ergoemacs-mode/bug2.elc
Also on emacs 24.3, even though batch-byte-compile-error-on-warn is set to
t, it will ignore the errors, which is not what I expect when I set this
option.
On Emacs trunk (24.4) it will not ignore the error but cause the make to
fail.
Matt
Type the following
On Mon, Jul 14, 2014 at 11:18 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Mon, 14 Jul 2014 11:01:12 -0500
> > From: Matthew Fidler <matthew.fidler@gmail.com>
> > Cc: 18014@debbugs.gnu.org
> >
> > You probably downloaded the version with lexical binding disabled.
> >
> > Sorry, I should have linked to the version with lexical binding enabled.
>
> So how about posting a complete, self-contained recipe that could be
> used to reproduce the problem?
>
> TIA
>
[-- Attachment #1.2: Type: text/html, Size: 2237 bytes --]
[-- Attachment #2: bug.el --]
[-- Type: text/plain, Size: 7493 bytes --]
;;; -*- lexical-binding: t; byte-compile-error-on-warn: t -*-
(declare-function ergoemacs-translate-shifted "ergoemacs-translate.el")
(declare-function ergoemacs-pretty-key "ergoemacs-translate.el")
(declare-function ergoemacs-translation-install "ergoemacs-translate.el")
(defvar ergoemacs-translate-hash)
(defvar ergoemacs-shifted-assoc)
(defvar ergoemacs-translations)
(defvar ergoemacs-use-ergoemacs-key-descriptions)
(defun ergoemacs-translate (key)
"Translates KEY and returns a plist of the translations.
:shift-translated
S-a -> a
M-S-a -> M-a
C-S-a -> C-a
Anything without shift is nil.
All other translations are defined in `ergoemacs-translations'.
There are also :XXX-key and :XXX-pretty for actual key-strokes
and `ergoemacs-pretty-key' descriptions.
"
(let* ((ret (gethash key ergoemacs-translate-hash))
(orig-key key)
case-fold-search
only-key
shift-translated
(ergoemacs-use-ergoemacs-key-descriptions t)
shifted-key
unshifted-key)
(if ret ret
(unless (stringp key)
(setq key (key-description key)
orig-key key))
(cond
((string-match "\\(^<.+>$\\|SPC\\|DEL\\|ESC\\|RET\\|TAB\\)" key)
(setq only-key (replace-regexp-in-string "[CMS]-" "" key t))
(if (string-match "S-" key)
(setq shifted-key (replace-match "" t nil key))
(setq shifted-key (concat "S-" key))))
(t
(setq only-key (replace-regexp-in-string "^.*\\(.\\)$" "\\1" key t)
shifted-key (assoc only-key ergoemacs-shifted-assoc))
(when shifted-key
(setq shifted-key (cdr shifted-key)))))
(when (and (string-match "\\([A-Z]\\)$" key)
(not (string-match "\\<\\(SPC\\|DEL\\|ESC\\|RET\\|TAB\\)\\>" key)))
(setq key
(replace-match
(concat "S-" (downcase (match-string 1 key))) t t key)))
(when shifted-key
(setq unshifted-key only-key)
(unless (string-match "\\(^<.+>$\\|\\<SPC\\>\\|\\<DEL\\>\\|\\<ESC\\>\\|\\<RET\\>\\|\\<TAB\\>\\)" shifted-key)
(when (string-match "[A-Z]" shifted-key)
(setq shifted-key (concat "S-" (downcase shifted-key))))
(when (string-match "[A-Z]" unshifted-key)
(setq unshifted-key (concat "S-" (downcase unshifted-key))))))
(when (string-match "S-" key)
(setq shift-translated (replace-regexp-in-string "S-" "" key t)))
(if shift-translated
(progn
(setq ret (plist-put ret ':shift-translated (ergoemacs-translate-shifted shift-translated)))
(setq ret (plist-put ret ':shift-translated-key (read-kbd-macro (ergoemacs-translate-shifted shift-translated) t)))
(setq ret (plist-put ret ':shift-translated-pretty (ergoemacs-pretty-key shift-translated))))
(setq ret (plist-put ret ':shift-translated nil))
(setq ret (plist-put ret ':shift-translated-key nil))
(setq ret (plist-put ret ':shift-translated-pretty nil)))
(when shifted-key
(setq ret (plist-put ret ':shifted (ergoemacs-translate-shifted shifted-key)))
(setq ret (plist-put ret ':shifted-key (read-kbd-macro (ergoemacs-translate-shifted shifted-key) t)))
(setq ret (plist-put ret ':shifted-pretty (ergoemacs-pretty-key shifted-key))))
(when unshifted-key
(setq ret (plist-put ret ':unshifted (ergoemacs-translate-shifted unshifted-key)))
(setq ret (plist-put ret ':unshifted-key (read-kbd-macro (ergoemacs-translate-shifted unshifted-key) t)))
(setq ret (plist-put ret ':unshifted-pretty (ergoemacs-pretty-key unshifted-key))))
(setq ret (plist-put ret ':ctl (ergoemacs-translate-shifted
(concat "C-" unshifted-key))))
(setq ret (plist-put ret ':ctl-key (read-kbd-macro (plist-get ret ':ctl) t)))
(setq ret (plist-put ret ':ctl-pretty (ergoemacs-pretty-key (plist-get ret ':ctl))))
(setq ret (plist-put ret ':raw (ergoemacs-translate-shifted
(replace-regexp-in-string
"\\<[CSMS]-" "" key))))
(setq ret (plist-put ret ':raw-key (read-kbd-macro (plist-get ret ':raw) t)))
(setq ret (plist-put ret ':raw-pretty (ergoemacs-pretty-key
(plist-get ret ':raw))))
(if (assoc (plist-get ret ':raw) ergoemacs-shifted-assoc)
(progn
(setq ret (plist-put ret ':raw-shift
(ergoemacs-translate-shifted
(replace-regexp-in-string
"\\<[CSM]-" ""
(cdr (assoc (plist-get ret ':raw) ergoemacs-shifted-assoc))))))
(setq ret (plist-put ret ':raw-shift-key
(read-kbd-macro (plist-get ret ':raw-shift) t)))
(setq ret (plist-put ret ':raw-shift-pretty
(ergoemacs-pretty-key
(plist-get ret ':raw-shift)))))
(setq ret (plist-put ret ':raw-shift nil))
(setq ret (plist-put ret ':raw-shift-key nil))
(setq ret (plist-put ret ':raw-shift-pretty nil)))
(setq ret (plist-put ret ':alt (ergoemacs-translate-shifted
(concat "M-" unshifted-key))))
(setq ret (plist-put ret ':alt-key (read-kbd-macro (plist-get ret ':alt) t)))
(setq ret (plist-put ret ':alt-pretty (ergoemacs-pretty-key (plist-get ret ':alt))))
(when unshifted-key
(setq ret (plist-put ret ':alt-ctl (ergoemacs-translate-shifted
(concat "M-C-" unshifted-key))))
(setq ret (plist-put ret ':alt-ctl-key (read-kbd-macro (plist-get ret ':alt-ctl) t)))
(setq ret (plist-put ret ':alt-ctl-pretty (ergoemacs-pretty-key (plist-get ret ':alt-ctl)))))
(when shifted-key
(setq ret (plist-put ret ':ctl-shift (ergoemacs-translate-shifted
(concat "C-" shifted-key))))
(setq ret (plist-put ret ':ctl-shift-key (read-kbd-macro (plist-get ret ':ctl-shift) t)))
(setq ret (plist-put ret ':ctl-shift-pretty (ergoemacs-pretty-key (plist-get ret ':ctl-shift))))
(setq ret (plist-put ret ':alt-shift (ergoemacs-translate-shifted
(concat "M-" shifted-key))))
(setq ret (plist-put ret ':alt-shift-key (read-kbd-macro (plist-get ret ':alt-shift) t)))
(setq ret (plist-put ret ':alt-shift-pretty (ergoemacs-pretty-key (plist-get ret ':alt-shift))))
(setq ret (plist-put ret ':alt-ctl-shift (ergoemacs-translate-shifted
(concat "M-C-" shifted-key))))
(setq ret (plist-put ret ':alt-ctl-shift-key (read-kbd-macro (plist-get ret ':alt-ctl-shift) t)))
(setq ret (plist-put ret ':alt-ctl-shift-pretty (ergoemacs-pretty-key (plist-get ret ':alt-ctl-shift)))))
(maphash
(lambda(key plist)
(setq ret (ergoemacs-translation-install plist orig-key ret)))
ergoemacs-translations)
(puthash orig-key ret ergoemacs-translate-hash)
(puthash key ret ergoemacs-translate-hash)
ret)))
[-- Attachment #3: bug2.el --]
[-- Type: text/plain, Size: 7517 bytes --]
;;; -*- lexical-binding: t; byte-compile-error-on-warn: t -*-
(declare-function ergoemacs-translate-shifted "ergoemacs-translate.el")
(declare-function ergoemacs-pretty-key "ergoemacs-translate.el")
(declare-function ergoemacs-translation-install "ergoemacs-translate.el")
(defvar ergoemacs-translate-hash)
(defvar ergoemacs-shifted-assoc)
(defvar ergoemacs-translations)
(defvar ergoemacs-use-ergoemacs-key-descriptions)
(defun ergoemacs-translate (_key)
"Translates _KEY and returns a plist of the translations.
:shift-translated
S-a -> a
M-S-a -> M-a
C-S-a -> C-a
Anything without shift is nil.
All other translations are defined in `ergoemacs-translations'.
There are also :XXX-key and :XXX-pretty for actual key-strokes
and `ergoemacs-pretty-key' descriptions.
"
(let* ((ret (gethash _key ergoemacs-translate-hash))
(orig-key _key)
case-fold-search
only-key
shift-translated
(ergoemacs-use-ergoemacs-key-descriptions t)
shifted-key
unshifted-key)
(if ret ret
(unless (stringp _key)
(setq _key (key-description _key)
orig-key _key))
(cond
((string-match "\\(^<.+>$\\|SPC\\|DEL\\|ESC\\|RET\\|TAB\\)" _key)
(setq only-key (replace-regexp-in-string "[CMS]-" "" _key t))
(if (string-match "S-" _key)
(setq shifted-key (replace-match "" t nil _key))
(setq shifted-key (concat "S-" _key))))
(t
(setq only-key (replace-regexp-in-string "^.*\\(.\\)$" "\\1" _key t)
shifted-key (assoc only-key ergoemacs-shifted-assoc))
(when shifted-key
(setq shifted-key (cdr shifted-key)))))
(when (and (string-match "\\([A-Z]\\)$" _key)
(not (string-match "\\<\\(SPC\\|DEL\\|ESC\\|RET\\|TAB\\)\\>" _key)))
(setq _key
(replace-match
(concat "S-" (downcase (match-string 1 _key))) t t _key)))
(when shifted-key
(setq unshifted-key only-key)
(unless (string-match "\\(^<.+>$\\|\\<SPC\\>\\|\\<DEL\\>\\|\\<ESC\\>\\|\\<RET\\>\\|\\<TAB\\>\\)" shifted-key)
(when (string-match "[A-Z]" shifted-key)
(setq shifted-key (concat "S-" (downcase shifted-key))))
(when (string-match "[A-Z]" unshifted-key)
(setq unshifted-key (concat "S-" (downcase unshifted-key))))))
(when (string-match "S-" _key)
(setq shift-translated (replace-regexp-in-string "S-" "" _key t)))
(if shift-translated
(progn
(setq ret (plist-put ret ':shift-translated (ergoemacs-translate-shifted shift-translated)))
(setq ret (plist-put ret ':shift-translated-key (read-kbd-macro (ergoemacs-translate-shifted shift-translated) t)))
(setq ret (plist-put ret ':shift-translated-pretty (ergoemacs-pretty-key shift-translated))))
(setq ret (plist-put ret ':shift-translated nil))
(setq ret (plist-put ret ':shift-translated-key nil))
(setq ret (plist-put ret ':shift-translated-pretty nil)))
(when shifted-key
(setq ret (plist-put ret ':shifted (ergoemacs-translate-shifted shifted-key)))
(setq ret (plist-put ret ':shifted-key (read-kbd-macro (ergoemacs-translate-shifted shifted-key) t)))
(setq ret (plist-put ret ':shifted-pretty (ergoemacs-pretty-key shifted-key))))
(when unshifted-key
(setq ret (plist-put ret ':unshifted (ergoemacs-translate-shifted unshifted-key)))
(setq ret (plist-put ret ':unshifted-key (read-kbd-macro (ergoemacs-translate-shifted unshifted-key) t)))
(setq ret (plist-put ret ':unshifted-pretty (ergoemacs-pretty-key unshifted-key))))
(setq ret (plist-put ret ':ctl (ergoemacs-translate-shifted
(concat "C-" unshifted-key))))
(setq ret (plist-put ret ':ctl-key (read-kbd-macro (plist-get ret ':ctl) t)))
(setq ret (plist-put ret ':ctl-pretty (ergoemacs-pretty-key (plist-get ret ':ctl))))
(setq ret (plist-put ret ':raw (ergoemacs-translate-shifted
(replace-regexp-in-string
"\\<[CSMS]-" "" _key))))
(setq ret (plist-put ret ':raw-key (read-kbd-macro (plist-get ret ':raw) t)))
(setq ret (plist-put ret ':raw-pretty (ergoemacs-pretty-key
(plist-get ret ':raw))))
(if (assoc (plist-get ret ':raw) ergoemacs-shifted-assoc)
(progn
(setq ret (plist-put ret ':raw-shift
(ergoemacs-translate-shifted
(replace-regexp-in-string
"\\<[CSM]-" ""
(cdr (assoc (plist-get ret ':raw) ergoemacs-shifted-assoc))))))
(setq ret (plist-put ret ':raw-shift-key
(read-kbd-macro (plist-get ret ':raw-shift) t)))
(setq ret (plist-put ret ':raw-shift-pretty
(ergoemacs-pretty-key
(plist-get ret ':raw-shift)))))
(setq ret (plist-put ret ':raw-shift nil))
(setq ret (plist-put ret ':raw-shift-key nil))
(setq ret (plist-put ret ':raw-shift-pretty nil)))
(setq ret (plist-put ret ':alt (ergoemacs-translate-shifted
(concat "M-" unshifted-key))))
(setq ret (plist-put ret ':alt-key (read-kbd-macro (plist-get ret ':alt) t)))
(setq ret (plist-put ret ':alt-pretty (ergoemacs-pretty-key (plist-get ret ':alt))))
(when unshifted-key
(setq ret (plist-put ret ':alt-ctl (ergoemacs-translate-shifted
(concat "M-C-" unshifted-key))))
(setq ret (plist-put ret ':alt-ctl-key (read-kbd-macro (plist-get ret ':alt-ctl) t)))
(setq ret (plist-put ret ':alt-ctl-pretty (ergoemacs-pretty-key (plist-get ret ':alt-ctl)))))
(when shifted-key
(setq ret (plist-put ret ':ctl-shift (ergoemacs-translate-shifted
(concat "C-" shifted-key))))
(setq ret (plist-put ret ':ctl-shift-key (read-kbd-macro (plist-get ret ':ctl-shift) t)))
(setq ret (plist-put ret ':ctl-shift-pretty (ergoemacs-pretty-key (plist-get ret ':ctl-shift))))
(setq ret (plist-put ret ':alt-shift (ergoemacs-translate-shifted
(concat "M-" shifted-key))))
(setq ret (plist-put ret ':alt-shift-key (read-kbd-macro (plist-get ret ':alt-shift) t)))
(setq ret (plist-put ret ':alt-shift-pretty (ergoemacs-pretty-key (plist-get ret ':alt-shift))))
(setq ret (plist-put ret ':alt-ctl-shift (ergoemacs-translate-shifted
(concat "M-C-" shifted-key))))
(setq ret (plist-put ret ':alt-ctl-shift-key (read-kbd-macro (plist-get ret ':alt-ctl-shift) t)))
(setq ret (plist-put ret ':alt-ctl-shift-pretty (ergoemacs-pretty-key (plist-get ret ':alt-ctl-shift)))))
(maphash
(lambda(_key plist)
(setq ret (ergoemacs-translation-install plist orig-key ret)))
ergoemacs-translations)
(puthash orig-key ret ergoemacs-translate-hash)
(puthash _key ret ergoemacs-translate-hash)
ret)))
^ permalink raw reply [flat|nested] 12+ messages in thread
* bug#18014: 24.3; Unused Lexical argument warning, when argument is used in a function...
2014-07-14 19:46 ` Matthew Fidler
@ 2014-07-15 14:18 ` Eli Zaretskii
0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2014-07-15 14:18 UTC (permalink / raw)
To: Matthew Fidler; +Cc: 18014
> Date: Mon, 14 Jul 2014 14:46:04 -0500
> From: Matthew Fidler <matthew.fidler@gmail.com>
> Cc: 18014@debbugs.gnu.org
>
> Easy enough. Put these in a directory, say ~/emacs-bug-1801 and run the
> following command:
>
> emacs -Q --batch -L . --eval \
> "(progn \
> (setq byte-compile-error-on-warn t) \
> (batch-byte-compile))" *.el
>
>
> On Emacs 24.3 the following warning will occur:
>
> In toplevel form:
> bug.el:10:1:Warning: Unused lexical argument `key' *<<--- Incorrect; key is
> a used lexical argument*
The line number in this warning is a lie: the problem is in the lambda
function:
(lambda(key plist)
(setq ret (ergoemacs-translation-install plist orig-key ret)))
which does leave its 'key' argument unused. (If you rename this
argument to something else, leaving the rest of ergoemacs-translate
with the original 'key', the warning will reference the new name.)
> Also on emacs 24.3, even though batch-byte-compile-error-on-warn is set to
> t, it will ignore the errors, which is not what I expect when I set this
> option.
> On Emacs trunk (24.4) it will not ignore the error but cause the make to
> fail.
The last observation doesn't match what I see here: when I compile
bug.el with the current trunk, Emacs issues the warning, not error,
message, and exits with exit code of zero. Which matches what I see
in the code: the warning about unused lexical argument is issued (in
cconv.el) by calling byte-compile-log-warning, which bypasses the
machinery that converts byte-compile warnings to errors; not sure if
this is on purpose or not.
So if you see something different, there's some other factor(s) at
work here.
In any case, this is a separate issue, which probably warrants a
separate report.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2014-07-15 14:18 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-14 12:25 bug#18014: 24.3; Unused Lexical argument warning, when argument is used in a function Matthew Fidler
2014-07-14 12:28 ` Matthew Fidler
2014-07-14 14:47 ` Eli Zaretskii
[not found] ` <CAOmN8O5ROfi5W44fBJe=sUs28TR1CDVQ2hWZoU0D4BTOGmKESg@mail.gmail.com>
2014-07-14 14:58 ` bug#18014: Fwd: " Matthew Fidler
2014-07-14 15:30 ` Eli Zaretskii
2014-07-14 15:46 ` Matthew Fidler
2014-07-14 15:47 ` Matthew Fidler
2014-07-14 16:01 ` Matthew Fidler
2014-07-14 16:18 ` Eli Zaretskii
2014-07-14 19:46 ` Matthew Fidler
2014-07-15 14:18 ` Eli Zaretskii
2014-07-14 16:17 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.