GNU bug report logs - #18014
24.3; Unused Lexical argument warning, when argument is used in a function...

Previous Next

Package: emacs;

Reported by: Matthew Fidler <matthew.fidler <at> gmail.com>

Date: Mon, 14 Jul 2014 12:27:01 UTC

Severity: minor

Tags: notabug

Found in version 24.3

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 18014 in the body.
You can then email your comments to 18014 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#18014; Package emacs. (Mon, 14 Jul 2014 12:27:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matthew Fidler <matthew.fidler <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 14 Jul 2014 12:27:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Matthew Fidler <matthew.fidler <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3; Unused Lexical argument warning, when argument is used in a
 function...
Date: Mon, 14 Jul 2014 07:25:56 -0500
[Message part 1 (text/plain, inline)]
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)
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18014; Package emacs. (Mon, 14 Jul 2014 12:30:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Matthew Fidler <matthew.fidler <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: 24.3; Unused Lexical argument warning, when argument is used in a
 function...
Date: Mon, 14 Jul 2014 07:28:44 -0500
[Message part 1 (text/plain, inline)]
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 <at> 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)
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18014; Package emacs. (Mon, 14 Jul 2014 14:48:02 GMT) Full text and rfc822 format available.

Message #11 received at 18014 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Matthew Fidler <matthew.fidler <at> gmail.com>
Cc: 18014 <at> debbugs.gnu.org
Subject: Re: bug#18014: 24.3;
 Unused Lexical argument warning, when argument is used in
 a	function...
Date: Mon, 14 Jul 2014 17:47:32 +0300
> Date: Mon, 14 Jul 2014 07:25:56 -0500
> From: Matthew Fidler <matthew.fidler <at> 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18014; Package emacs. (Mon, 14 Jul 2014 14:59:01 GMT) Full text and rfc822 format available.

Message #14 received at 18014 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Fidler <matthew.fidler <at> gmail.com>
To: 18014 <at> debbugs.gnu.org
Subject: Fwd: bug#18014: 24.3; Unused Lexical argument warning, when argument
 is used in a function...
Date: Mon, 14 Jul 2014 09:58:16 -0500
[Message part 1 (text/plain, inline)]
---------- Forwarded message ----------
From: Matthew Fidler <matthew.fidler <at> 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 <at> 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 <at> gnu.org> wrote:

> > Date: Mon, 14 Jul 2014 07:25:56 -0500
> > From: Matthew Fidler <matthew.fidler <at> 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?
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18014; Package emacs. (Mon, 14 Jul 2014 15:31:01 GMT) Full text and rfc822 format available.

Message #17 received at 18014 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Matthew Fidler <matthew.fidler <at> gmail.com>
Cc: 18014 <at> debbugs.gnu.org
Subject: Re: bug#18014: 24.3;
 Unused Lexical argument warning, when argument is used in a
 function...
Date: Mon, 14 Jul 2014 18:30:37 +0300
> Date: Mon, 14 Jul 2014 09:57:38 -0500
> From: Matthew Fidler <matthew.fidler <at> 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"?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18014; Package emacs. (Mon, 14 Jul 2014 15:47:02 GMT) Full text and rfc822 format available.

Message #20 received at 18014 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Fidler <matthew.fidler <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 18014 <at> debbugs.gnu.org
Subject: Re: bug#18014: 24.3; Unused Lexical argument warning, when argument
 is used in a function...
Date: Mon, 14 Jul 2014 10:46:08 -0500
[Message part 1 (text/plain, inline)]
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 <at> gnu.org> wrote:

> > Date: Mon, 14 Jul 2014 09:57:38 -0500
> > From: Matthew Fidler <matthew.fidler <at> 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"?
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18014; Package emacs. (Mon, 14 Jul 2014 15:48:01 GMT) Full text and rfc822 format available.

Message #23 received at 18014 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Fidler <matthew.fidler <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 18014 <at> debbugs.gnu.org
Subject: Re: bug#18014: 24.3; Unused Lexical argument warning, when argument
 is used in a function...
Date: Mon, 14 Jul 2014 10:47:10 -0500
[Message part 1 (text/plain, inline)]
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 <at> 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 <at> gnu.org> wrote:
>
>> > Date: Mon, 14 Jul 2014 09:57:38 -0500
>> > From: Matthew Fidler <matthew.fidler <at> 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"?
>>
>
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18014; Package emacs. (Mon, 14 Jul 2014 16:02:02 GMT) Full text and rfc822 format available.

Message #26 received at 18014 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Fidler <matthew.fidler <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 18014 <at> debbugs.gnu.org
Subject: Re: bug#18014: 24.3; Unused Lexical argument warning, when argument
 is used in a function...
Date: Mon, 14 Jul 2014 11:01:12 -0500
[Message part 1 (text/plain, inline)]
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 <at> 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 <at> 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 <at> gnu.org> wrote:
>>
>>> > Date: Mon, 14 Jul 2014 09:57:38 -0500
>>> > From: Matthew Fidler <matthew.fidler <at> 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"?
>>>
>>
>>
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18014; Package emacs. (Mon, 14 Jul 2014 16:18:02 GMT) Full text and rfc822 format available.

Message #29 received at 18014 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Matthew Fidler <matthew.fidler <at> gmail.com>
Cc: 18014 <at> debbugs.gnu.org
Subject: Re: bug#18014: 24.3;
 Unused Lexical argument warning, when argument is used in a
 function...
Date: Mon, 14 Jul 2014 19:17:12 +0300
> Date: Mon, 14 Jul 2014 10:47:10 -0500
> From: Matthew Fidler <matthew.fidler <at> gmail.com>
> Cc: 18014 <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18014; Package emacs. (Mon, 14 Jul 2014 16:19:02 GMT) Full text and rfc822 format available.

Message #32 received at 18014 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Matthew Fidler <matthew.fidler <at> gmail.com>
Cc: 18014 <at> debbugs.gnu.org
Subject: Re: bug#18014: 24.3;
 Unused Lexical argument warning, when argument is used in a
 function...
Date: Mon, 14 Jul 2014 19:18:39 +0300
> Date: Mon, 14 Jul 2014 11:01:12 -0500
> From: Matthew Fidler <matthew.fidler <at> gmail.com>
> Cc: 18014 <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18014; Package emacs. (Mon, 14 Jul 2014 19:47:02 GMT) Full text and rfc822 format available.

Message #35 received at 18014 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Fidler <matthew.fidler <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 18014 <at> debbugs.gnu.org
Subject: Re: bug#18014: 24.3; Unused Lexical argument warning, when argument
 is used in a function...
Date: Mon, 14 Jul 2014 14:46:04 -0500
[Message part 1 (text/plain, inline)]
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 <at> gnu.org> wrote:

> > Date: Mon, 14 Jul 2014 11:01:12 -0500
> > From: Matthew Fidler <matthew.fidler <at> gmail.com>
> > Cc: 18014 <at> 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
>
[Message part 2 (text/html, inline)]
[bug.el (text/plain, attachment)]
[bug2.el (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18014; Package emacs. (Tue, 15 Jul 2014 14:19:02 GMT) Full text and rfc822 format available.

Message #38 received at 18014 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Matthew Fidler <matthew.fidler <at> gmail.com>
Cc: 18014 <at> debbugs.gnu.org
Subject: Re: bug#18014: 24.3;
 Unused Lexical argument warning, when argument is used in a
 function...
Date: Tue, 15 Jul 2014 17:18:53 +0300
> Date: Mon, 14 Jul 2014 14:46:04 -0500
> From: Matthew Fidler <matthew.fidler <at> gmail.com>
> Cc: 18014 <at> 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.




Added tag(s) notabug. Request was from Noam Postavsky <npostavs <at> users.sourceforge.net> to control <at> debbugs.gnu.org. (Wed, 01 Jun 2016 15:42:01 GMT) Full text and rfc822 format available.

Reply sent to Noam Postavsky <npostavs <at> users.sourceforge.net>:
You have taken responsibility. (Wed, 01 Jun 2016 15:45:02 GMT) Full text and rfc822 format available.

Notification sent to Matthew Fidler <matthew.fidler <at> gmail.com>:
bug acknowledged by developer. (Wed, 01 Jun 2016 15:45:02 GMT) Full text and rfc822 format available.

Message #45 received at 18014-done <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: 18014-done <at> debbugs.gnu.org
Subject: Fwd: bug#18014: 24.3; Unused Lexical argument warning, when argument
 is used in a function...
Date: Wed, 1 Jun 2016 11:44:18 -0400
Closing, since this turns out not to have been a bug, but just
confusion due to wrong line numbers in error message (cf bug #2681).




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 30 Jun 2016 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 302 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.